Skip to content

Commit

Permalink
actions: run: Set postprocess working directory to artifact directory
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
obbardc committed Aug 15, 2023
1 parent a998e92 commit e3869f8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions actions/run_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,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...)
}

Expand Down

0 comments on commit e3869f8

Please sign in to comment.