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 <chris.obbard@collabora.com>
  • Loading branch information
obbardc committed Jan 10, 2024
1 parent ee08ed0 commit c71008f
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 @@ -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...)
}

Expand Down

0 comments on commit c71008f

Please sign in to comment.