Skip to content

Add workdir support#327

Open
raultapia wants to merge 2 commits intoosrf:mainfrom
raultapia:main
Open

Add workdir support#327
raultapia wants to merge 2 commits intoosrf:mainfrom
raultapia:main

Conversation

@raultapia
Copy link

Closes #249

@raultapia raultapia requested a review from tfoote as a code owner May 10, 2025 09:14
Copy link
Collaborator

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this with test coverage. It's great to have.

As mentioned in #249 (comment)

The user extension adjusts the workdir

and it would be good to integrate this with that.

I think that there's a sort of higherarchy

  • If workdir is set explicitly, then use that.
  • If it's not set and you're inside of a mounted path keep the cwd
  • If it's not set, and the current directour is outside of a mounted volume, default to the home directory.

@raultapia
Copy link
Author

I've implemented the hierarchy you proposed with some minor changes. The current status is:

  • If executed without --workdir, defaults to home directory.
  • If executed with --workdir, the current directory is set as WORKDIR from get_user_snippet.
  • If executed with --workdir=path, the directory is set and it overrides the WORKDIR from get_user_snippet.

@tfoote
Copy link
Collaborator

tfoote commented Jun 20, 2025

Thanks for iterating this is making progress, but it isn't dealing withthe workdir interactions with the user extension:

And the workdir will need to be the last snippet to be effective for setting the workdir for the user only, and now potentially effecting the other extensions if it gets evaluated first. I think that it may make more sense to do this as a core capability versus as an extension because of that and the need for the interaction with the mounting and user mechanisms.

Copy link
Collaborator

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments in the main thread. This needs to provide sequencing protection and interact with the user and mount extensions to give the expected potential working directories.

somewhere like

return dockerfile_str

Or else we need to add a sequencing support to extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support --workdir

2 participants