-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Node 20 -> Node 24 migration feature flagging, opt-in and opt-out environment variables #3948
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
Conversation
I think that if someone sets both of the variables to true, we should default to the same logic that is used when neither is set. Setting both should only happen with user error, I think it's more intuitive that we pick the default in that case. |
…g if both env variables are enabled by the user
That makes sense, modified it |
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.
Pull Request Overview
This PR implements a phased migration strategy for JavaScript/TypeScript actions from Node 20 to Node 24 in GitHub Actions runners. The implementation introduces feature flags for controlled rollout with user controls via environment variables.
Key changes:
- Centralized constants for Node versions, environment variables, and feature flags
- Node version selection logic with three distinct migration phases
- Environment variable precedence handling (workflow over system)
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Runner.Common/Constants.cs | Adds NodeMigration constants for versions, environment variables, and feature flags |
src/Runner.Common/Util/NodeUtil.cs | Implements core node version determination logic with ARM32 compatibility checks |
src/Runner.Worker/FeatureManager.cs | Adds generic feature flag checking methods for migration control |
src/Runner.Worker/Handlers/HandlerFactory.cs | Integrates node version selection logic into action handler creation |
src/Test/L0/Util/NodeUtilL0.cs | Comprehensive unit tests covering all migration phases and edge cases |
Comments suppressed due to low confidence (4)
src/Test/L0/Util/NodeUtilL0.cs:24
- This test case doesn't verify that environment variables are actually ignored in Phase 3. Consider adding an assertion to confirm that the environment variables don't affect the outcome when requireNode24=true.
[InlineData(true, false, true, true, "node24", false)] // Phase 3: Always Node 24 regardless of env vars, no warnings in Phase 3
src/Runner.Worker/Handlers/HandlerFactory.cs:93
- The word 'UNSECURE' in the environment variable name should be 'INSECURE' for correct spelling.
string infoMessage = "Node 20 is being deprecated. This workflow is running with Node 24 by default. " +
"If you need to temporarily use Node 20, you can set the ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true environment variable.";
src/Runner.Common/Constants.cs:183
- The word 'UNSECURE' in the environment variable name should be 'INSECURE' for correct spelling.
public static readonly string AllowUnsecureNodeVersionVariable = "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION";
src/Runner.Common/Util/NodeUtil.cs:79
- The word 'UNSECURE' in the environment variable name should be 'INSECURE' for correct spelling.
warningMessage = $"Both {Constants.Runner.NodeMigration.ForceNode24Variable} and {Constants.Runner.NodeMigration.AllowUnsecureNodeVersionVariable} environment variables are set to true. This is likely a configuration error. Using the default Node version: {defaultVersion}.";
… details and modify to GetEnvironmentVariableDetails method for improved clarity
…de migration flags
Node 20 to Node 24 Migration Strategy
This is a proposal for the migration strategy, nothing here is 100% confirmed yet.
Overview
This PR implements the migration strategy for GitHub Actions JavaScript/TypeScript actions from Node 20 to Node 24, preparing for Node 20's end of life. The approach uses feature flags for a phased rollout, similar to the previous Node 16 to Node 20 migration.
Key Features
Migration Phases
Phase 1: Node 20 Default
Initially Node 20 remains the default:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true
Phase 2: Node 24 Default
When the
actions.runner.usenode24bydefault
flag is enabled:ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true
Phase 3: Node 24 Required
When the
actions.runner.requirenode24
flag is enabled:Environment Variables
The migration uses two environment variables:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true
: Opt into Node 24 during Phase 1ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true
: Fall back to Node 20 during Phase 2These can be set at either the workflow level (in YAML) or runner level (system environment). Workflow settings override runner settings to ensure job-specific control.
Implementation Details
Core Components
The migration strategy includes:
Centralized Constants
Node20
andNode24
Version Selection Logic
User Feedback
Platform Compatibility
Testing & Compatibility
Tests cover:
Backward compatibility is maintained through:
Node Version Selection Logic - Truth Table
Variable Precedence
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24
andACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION
) is evaluated independentlyPhase 1: Node 20 Default (No Feature Flags)
Phase 2: Node 24 Default (useNode24ByDefault=true)
Phase 3: Node 24 Required (requireNode24=true)
In Phase 3, the environment variables are ignored and Node 24 is always used.
Notable Edge Cases
1. Mixed-Source Variables (Workflow vs System)
When variables come from different sources, each is evaluated independently:
Example: ForceNode24=false (Workflow), AllowUnsecure=true (System)
Example: AllowUnsecure=false (Workflow), ForceNode24=true (System)
Key Edge Case in Phase 2: When both variables are true (from any sources)
2. Conflicting Settings
When both variables are set to true from the same source (both from workflow or both from system):
3. ARM32 Linux Platform Compatibility
For Linux ARM32 platforms, Node 24 is not supported:
4. Phase 2 User Notification
In Phase 2, when Node 24 is selected:
Environment Variable Examples
Opt-in to Node 24 using workflow environment variable
You can opt in to Node 24 during Phase 1 by adding the environment variable to your workflow:
This forces actions like
actions/checkout@v4
(which normally uses Node 20) to run with Node 24 instead:Opt-in to Node 24 using system environment variable
You can also opt in at the runner level by setting the system environment variable:
This is how it behaves when node24 is default
When node24 is default, actions can be opted out using the
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION
environment variableACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION
For example:
Environment Variable Precedence
When both system-level and workflow-level environment variables are set:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true
, Node 24 is usedACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true
, Node 20 is used