-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Map RUNNER_TEMP for container action #4011
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,11 +191,19 @@ public async Task RunAsync(ActionRunStage stage) | |
| ArgUtil.Directory(tempWorkflowDirectory, nameof(tempWorkflowDirectory)); | ||
|
|
||
| container.MountVolumes.Add(new MountVolume("/var/run/docker.sock", "/var/run/docker.sock")); | ||
| if (FeatureManager.IsContainerActionRunnerTempEnabled(ExecutionContext.Global.Variables)) | ||
| { | ||
| container.MountVolumes.Add(new MountVolume(tempDirectory, "/github/runner_temp")); | ||
| } | ||
ericsciple marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| container.MountVolumes.Add(new MountVolume(tempHomeDirectory, "/github/home")); | ||
| container.MountVolumes.Add(new MountVolume(tempWorkflowDirectory, "/github/workflow")); | ||
| container.MountVolumes.Add(new MountVolume(tempFileCommandDirectory, "/github/file_commands")); | ||
| container.MountVolumes.Add(new MountVolume(defaultWorkingDirectory, "/github/workspace")); | ||
|
|
||
| if (FeatureManager.IsContainerActionRunnerTempEnabled(ExecutionContext.Global.Variables)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit : Could we reorder this so that there's just one feature flag check call? The also might help reduce the need for a helper method. Or does the order of operations here matter a lot? E.g. putting the mount of the new temp directory in the feature flag call at the end of the mounting section and then path translate at the beginning of the mapping section? Sorry quite a picky nit, feel free to ignore this, not sure on whether it makes a difference to the behavior Edit: also this would then make it easier to do that check plus an env variable check if added, since we'd be able to just check them all once. Alternatively we can just store the ff value above and then use it.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I optimized the code, to make the diff easier to read when the feature flag is removed (future PR). I prefer checking the feature flag twice rather than introduce a local variable. Rule of thumb: more local variables -> worse readability. Checking the feature flag isn't expensive, it's a dictionary lookup. |
||
| { | ||
| container.AddPathTranslateMapping(tempDirectory, "/github/runner_temp"); | ||
| } | ||
| container.AddPathTranslateMapping(tempHomeDirectory, "/github/home"); | ||
| container.AddPathTranslateMapping(tempWorkflowDirectory, "/github/workflow"); | ||
| container.AddPathTranslateMapping(tempFileCommandDirectory, "/github/file_commands"); | ||
|
|
||
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.
Should we do this also with environment variables? So that we don't have to rely on just feature flags? Same comment for the check below too
Also nit: do we need the helper method since it's a one line helper method?
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.
The feature flag is temporary for safe rollout only. It will be cleaned up in the following runner release.
I didn't have a reason to add an environment variable check in this case, so I kept it clean and under server control. Environment variables help when customers are involved to help try out a pre-release behavior and confirm it works for their scenarios.
The only reason I added the helper method is to make this file read consistently wrt feature flag checks.