Scripts: exit error code 1 when status value is null - #42396
Merged
Conversation
this commit is done to fix pipeline exit in case of failure. status value is `null` in case of failure
amustaque97
requested review from
ajitbohra,
gziolo,
nerrad,
ntwb and
ryanwelcher
as code owners
July 13, 2022 14:33
Member
|
Excellent, thank you for opening an issue 👍🏻 The same issue will apply to the |
|
Size Change: +268 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
gziolo
approved these changes
Jul 14, 2022
gziolo
left a comment
Member
There was a problem hiding this comment.
I'm using macOS, so I can't test it, but code changes look good. @amustaque97, thank you so much for sending this patch.
I'll include an entry in the CHANGELOG file before landing this PR.
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.
Fixes: #41712
What?
Introduced a new variable
EXIT_ERROR_CODEto be used in case the status isnullWhy?
We use
wp-scripts buildto create the webpack build in a CI pipeline.The CI pipeline relies on the return code to determine the job status.
If the build fails with the "JavaScript heap out of memory" error, the wp-scripts build returns status 0.
This causes the next pipeline stage to run, which leads to the deployment of a corrupted build artifact.
How?
This is an environment-specific issue in Linux. In my local mac, it works fine. I have added an OR condition if
statusis null then returnEXIT_ERROR_CODE. In the case of successstatusvalue must be0.Testing Instructions
NODE_OPTIONS="--max_old_space_size=64" yarn wp-scripts buildin Linux environment1`
Screenshots or screencast NA