-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
actions: run: Set postprocess working directory to artifact directory #433
base: main
Are you sure you want to change the base?
Conversation
Adding the reproducer (or variant thereof) as a test case would be great. |
be044e5
to
c71008f
Compare
Currently Command.Dir is unsed; hook it up such that when commands are not running in a chroot, the working directory can be set. Signed-off-by: Christopher Obbard <[email protected]>
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]>
c71008f
to
c43257e
Compare
@@ -254,6 +254,11 @@ func (cmd Command) Run(label string, cmdline ...string) error { | |||
exe.Env = append(os.Environ(), cmd.extraEnv...) | |||
} | |||
|
|||
// Allow working directory to be set for commands not running in chroot | |||
if len(cmd.Dir) > 0 && cmd.ChrootMethod == CHROOT_METHOD_NONE { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why only for CHROOT_METHOD_NONE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really ensure this get exercised in at least one of the tests
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