From 1b68017566e278963323e0c0cd5c59adf37b481c Mon Sep 17 00:00:00 2001 From: vatine Date: Tue, 3 Sep 2024 05:10:18 +0200 Subject: [PATCH] fix(executor): add executable permission to staged `script` (#12787) Signed-off-by: Ingvar Mattsson Signed-off-by: Ingvar Co-authored-by: Ingvar Mattsson Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com> --- workflow/executor/executor.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/executor/executor.go b/workflow/executor/executor.go index 3c1c9ff28322..d2702e6af757 100644 --- a/workflow/executor/executor.go +++ b/workflow/executor/executor.go @@ -267,11 +267,13 @@ func (we *WorkflowExecutor) LoadArtifacts(ctx context.Context) error { func (we *WorkflowExecutor) StageFiles() error { var filePath string var body []byte + mode := os.FileMode(0o644) switch we.Template.GetType() { case wfv1.TemplateTypeScript: log.Infof("Loading script source to %s", common.ExecutorScriptSourcePath) filePath = common.ExecutorScriptSourcePath body = []byte(we.Template.Script.Source) + mode = os.FileMode(0o755) case wfv1.TemplateTypeResource: if we.Template.Resource.ManifestFrom != nil && we.Template.Resource.ManifestFrom.Artifact != nil { log.Infof("manifest %s already staged", we.Template.Resource.ManifestFrom.Artifact.Name) @@ -283,7 +285,7 @@ func (we *WorkflowExecutor) StageFiles() error { default: return nil } - err := os.WriteFile(filePath, body, 0o644) + err := os.WriteFile(filePath, body, mode) if err != nil { return argoerrs.InternalWrapError(err) }