feat: expose effective cache-mode to steps via ACTIONS_CACHE_MODE#4538
Open
philip-gai wants to merge 3 commits into
Open
feat: expose effective cache-mode to steps via ACTIONS_CACHE_MODE#4538philip-gai wants to merge 3 commits into
philip-gai wants to merge 3 commits into
Conversation
Export ACTIONS_CACHE_MODE env to node and container action steps when the actions_cache_mode job variable is present and non-empty, mirroring the existing ACTIONS_CACHE_SERVICE_V2 wiring. Also log the effective cache-mode at job start. When the variable is absent or empty, behavior is unchanged.
Add JobExtension L0 tests asserting the job-start cache-mode log line is emitted for each mode and absent when the variable is unset, plus handler regression tests covering coexistence with ACTIONS_CACHE_SERVICE_V2 and that baseline runtime env is unaffected when no cache-mode is set.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes the effective Actions cache mode (from the service-provided actions_cache_mode job variable) to action steps via ACTIONS_CACHE_MODE, and logs the cache mode once at job start to make the effective mode visible in the job header output.
Changes:
- Export
ACTIONS_CACHE_MODEfromactions_cache_modeinNodeScriptActionHandlerandContainerActionHandler. - Log
Actions cache-mode: <mode>during job initialization inJobExtensionwhen the variable is present and non-empty. - Add/extend L0 tests to validate log emission and env export behavior (notably for NodeScriptActionHandler and JobExtension).
Show a summary per file
| File | Description |
|---|---|
| src/Test/L0/Worker/JobExtensionL0.cs | Adds L0 coverage asserting the new job-start log line when actions_cache_mode is set/absent. |
| src/Test/L0/Worker/HandlerL0.cs | Adds L0 coverage asserting ACTIONS_CACHE_MODE is exported by NodeScriptActionHandler for various modes and absent/empty cases. |
| src/Runner.Worker/JobExtension.cs | Logs the effective cache mode at job start when present. |
| src/Runner.Worker/Handlers/NodeScriptActionHandler.cs | Exports ACTIONS_CACHE_MODE for Node-based actions when actions_cache_mode is present and non-empty. |
| src/Runner.Worker/Handlers/ContainerActionHandler.cs | Exports ACTIONS_CACHE_MODE into container action environments when actions_cache_mode is present and non-empty. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Low
- Add ContainerActionHandler L0 coverage (Linux-gated) asserting ACTIONS_CACHE_MODE is exported to the container env when actions_cache_mode is set and absent otherwise, routed through the container-hooks path. - Set the cache-mode variable directly on the initialized job context instead of re-invoking InitializeJob, avoiding a redundant CancellationTokenSource.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the effective Actions cache-mode to job steps and surfaces it in the job log. The mode is delivered by the Actions service as the
actions_cache_modejob variable (one ofnone,read,write,write-only, hyphenated), mirroring the existingactions_uses_cache_service_v2variable.Changes
ACTIONS_CACHE_MODEto steps from theactions_cache_modejob variable inNodeScriptActionHandlerandContainerActionHandler, mirroring the existingACTIONS_CACHE_SERVICE_V2wiring.JobExtension(single info line near the other job header output).Behavior and safety
actions_cache_modejob variable, one ofnone|read|write|write-only(hyphenated, matching the workflow YAML token). The runner passes it through as-is.Tests
read,none,write, andwrite-only(env exported with the value), plus absent and empty cases (env not set).https://github.com/github/actions-persistence/issues/1125