-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
Support mounts
field on docker_environment
#20322
Conversation
// NB: We don't include the mount info in the cache. | ||
Self::Docker(image, _) => format!("docker_execution: {image}"), |
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.
This is the only thing I'm not 100% on. Any thoughts?
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.
From my local hacking, I think maybe including it in they key would be good for edits.
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.
OK, so I changed this to use the bind mounts here, but I'm not seeing Pants re-start the container
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.
Keeping this open, since the original comment now applies again 😄
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.
Omitting info from the process cache keys seems a bit dangerous, and something that has to be done carefully. (I'm not the right person to make a final call about the consequences.)
I'm also not sure the best way to test this. Local tests show "it works":
|
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.
I'm also not sure the best way to test this.
What do you think about integration test(s) that run a test (e.g. experimental_test_shell_command
) that checks a particular file provided by a bind mount has particular contents?
I'd like that. We'd have to make sure we use a path that we know exists on the host OS however. Claude.ai seems to suggest |
What about a temporary file that's created in the test? (It'll change from run, but that seems fine.) |
I'm not sure that's doable. If we're using Unless you're suggesting a Python-implemented integration test which runs Pants and uses |
Yeah, that's right. I was under the impression that a normal
I think a test like this won't do the right thing if/when we switch the Pants repo to be a normal Pants build root, using a previously released version to orchestrate the build of the new version of Pants (ala #19774 or #18688). In particular, a test like that will be using the orchestration-Pants docker environments, not validating the behaviour of new-Pants. That is, we'll need "orchestration-Pants"-runs-Python-runs-"new-Pants". |
I don't think that's quite correct. In those situations we really should treat the "backends" we activate as the ones "in-repo" (similar to how we treat those in non-Pants repos) precisely for situations like this. |
Ah, I see. That's quite surprising to me so I wasn't thinking along those lines. I'm curious how it'd work with the |
Me too 😄 Really there's a slider of how we want support to go which probably isn't worth going into detail in this PR other than to say "we aren't sure exactly how it'll look yet" if/when we get there. |
bind_mounts
field on docker_environment
mounts
field on docker_environment
Hm, okay. I'll register now that I think using the in-repo backends (especially I won't block merging this with a test that relies on it, but it would be good to remember/make a note that that test will need reconsideration depending on the approach we take. Also, this appears to be a new feature, rather than a bugfix. We're pretty late in the 2.19 release timeline (e.g. we document a 6 week release spacing, and we're at 5 weeks and 6 days since 2.18.0 right now!), what do you think about not cherry-picking and leaving it for 2.20 (either that, or cherry-pick for 2.19.1)? |
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.
This looks good other than a minor thing about the location of the test, and the still-open question about what should be included in the process cache keys.
Yeah, we can hold off until 2.19.0 is out and then merge/cherry-pick for 2.19.1. |
""" | ||
Mounts to use when starting the container. | ||
|
||
The values should be in the form "<path on host>:<path on container>(:<options>)". |
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.
Is "path on host" correct when volume mounts are taken into consideration?
} | ||
|
||
#[getter] | ||
fn docker_mounts(&self) -> Option<Vec<String>> { |
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.
Nit-pick: Maybe docker_mounts
could return Option<Vec<&str>>
(similar to docker_image
's return value) to allow the caller to decide whether it needs a copy or not?
One use case that I stumbled on today is mounting |
This PR/branch is going stale for at least a few weeks if not months. So if anyone wants to pick it up, let me know. |
For now I will remove the needs-cherrypick label from this, since it's a new feature, so should not generally be cherry-picked to a stable branch. |
I no longer require this. I'll close the PR. Others are welcome to pick it up. |
This change adds a new
mounts
field todocker_environment
to become mounts in the destination container.The expected usage can be -anything, however the specific use-case that motivated this was mounting AWS credentials.