Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

obbardc
Copy link
Member

@obbardc obbardc commented Aug 15, 2023

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

@obbardc obbardc self-assigned this Aug 15, 2023
@evelikov
Copy link

evelikov commented Oct 3, 2023

Adding the reproducer (or variant thereof) as a test case would be great.

@obbardc obbardc force-pushed the wip/obbardc/artifactdir-postprocess branch from be044e5 to c71008f Compare January 10, 2024 14:33
@obbardc obbardc added this to the v1.1.4 milestone Jan 10, 2024
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 <chris.obbard@collabora.com>
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>
@obbardc obbardc force-pushed the wip/obbardc/artifactdir-postprocess branch from c71008f to c43257e Compare January 10, 2024 15:20
@@ -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 {
Copy link
Member

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

Copy link
Member

@sjoerdsimons sjoerdsimons left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review required
Development

Successfully merging this pull request may close these issues.

actions: run: Postprocess working directory should be set to the artifact directory
3 participants