fix(docker): guard commitSha null in plugin interpolation#33275
Merged
Coly010 merged 1 commit intonrwl:masterfrom Oct 28, 2025
Merged
fix(docker): guard commitSha null in plugin interpolation#33275Coly010 merged 1 commit intonrwl:masterfrom
Coly010 merged 1 commit intonrwl:masterfrom
Conversation
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Coly010
approved these changes
Oct 28, 2025
Contributor
|
View your CI Pipeline Execution ↗ for commit f9dff93
☁️ Nx Cloud last updated this comment at |
Contributor
Author
|
Hey @Coly010, it would be lovely if we could get this merged and released on a beta channel. It's currently blocking me from moving forward on a personal project 😬 |
FrozenPandaz
pushed a commit
that referenced
this pull request
Oct 28, 2025
## Current Behavior
Docker plugin assumed `commitSha` was always non-null; when `null`,
`shortCommitSha.slice` caused a runtime error during target
interpolation.
## Expected Behavior
Plugin should succeed even if latest commit SHA cannot be resolved,
simply omitting shortCommitSha-based substitutions.
## Changes
- Added null guard: `shortCommitSha` now set to `commitSha ?
commitSha.slice(0,7) : null`.
- Added test "should not throw when commitSha is null" verifying node /
target creation succeeds.
- No breaking changes; only broadens safe input surface.
## Additional notes
Logic only executes when `commitSha` was previously null (error case);
normal paths unchanged. If consumers interpolate `{shortCommitSha}`,
they should handle possible null (unchanged if interpolation is already
optional).
(cherry picked from commit 1089ffc)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Current Behavior
Docker plugin assumed
commitShawas always non-null; whennull,shortCommitSha.slicecaused a runtime error during target interpolation.Expected Behavior
Plugin should succeed even if latest commit SHA cannot be resolved, simply omitting shortCommitSha-based substitutions.
Changes
shortCommitShanow set tocommitSha ? commitSha.slice(0,7) : null.Additional notes
Logic only executes when
commitShawas previously null (error case); normal paths unchanged. If consumers interpolate{shortCommitSha}, they should handle possible null (unchanged if interpolation is already optional).