From c71008f01f20995363055b430de83395fcc243ef Mon Sep 17 00:00:00 2001 From: Christopher Obbard Date: Tue, 15 Aug 2023 11:18:02 +0100 Subject: [PATCH] actions: run: Set postprocess working directory to artifact directory Currently any run action tagged as postprocess will be ran in the recipe directory. The artifacts are stored in this directory by default, unless --artifactdir is passed to Debos to change where the artifacts are stored. The run action documentation states: postprocess -- if set script or command is executed after all other commands and has access to the recipe directory ($RECIPEDIR) and the artifact directory ($ARTIFACTDIR). The working directory will be set to the artifact directory. But this is wrong; currently the working directory of postprocess commands is set to the recipe directory. Set the working directory to the artifact directory instead to allow postprocess commands to be ran in the correct location. Fixes: #345 Signed-off-by: Christopher Obbard --- actions/run_action.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/actions/run_action.go b/actions/run_action.go index c62a028a..1e2ea99b 100644 --- a/actions/run_action.go +++ b/actions/run_action.go @@ -159,6 +159,11 @@ func (run *RunAction) doRun(context debos.DebosContext) error { } } + /* For PostProcess commands, set cwd to artifactdir */ + if run.PostProcess { + cmd.Dir = context.Artifactdir + } + return cmd.Run(label, cmdline...) }