Skip to content
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

chore: enable pipefail for snapcraft.yaml.sh #39

Merged
merged 3 commits into from
May 7, 2022
Merged

chore: enable pipefail for snapcraft.yaml.sh #39

merged 3 commits into from
May 7, 2022

Conversation

richardlau
Copy link
Member

Trap empty NODE_VERSION, e.g. if fetching index.tab fails.

Refs: #38

Trap empty `NODE_VERSION`, e.g. if fetching `index.tab` fails.

Refs: #38
@richardlau richardlau marked this pull request as draft May 6, 2022 12:40
@@ -36,7 +36,7 @@ done
# not a release?
if [ -z ${NODE_DISTTYPE+x} ]; then
# nightly
NODE_VERSION="$(curl -sL https://nodejs.org/download/nightly/index.tab | awk '/^v[1-9].*[^a-z0-9]src[^a-z0-9]/ { print substr($1, 2); exit }')"
NODE_VERSION="$(curl -sL --show-error --fail https://nodejs.org/download/nightly/index.tab | awk 'BEGIN { found = 0 } /^v[1-9].*[^a-z0-9]src[^a-z0-9]/ && !found { found = 1; print substr($1, 2) }')"
Copy link
Member Author

@richardlau richardlau May 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the awk script are to make awk read all of the input. Previously the script contained an early exit which causes curl to exit with exit code 23 as the pipe is closed by awk before curl has finished writing to it. This was masked before by the -s (silent) curl option but surfaced when pipefail was enabled.
e.g. https://github.com/nodejs/snap/runs/6322739611?check_suite_focus=true

@richardlau richardlau marked this pull request as ready for review May 6, 2022 15:22
Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@rvagg
Copy link
Member

rvagg commented May 7, 2022

btw, when making changes to snapcraft.yml.sh, you'll need to merge and then cherry-pick that commit to the head of each of the active branches that are in use by cron and push back to this repo; otherwise it'll only be active for the nodeedge / nightly snap

@richardlau richardlau merged commit 12f73b9 into main May 7, 2022
@richardlau richardlau deleted the pipefail branch May 7, 2022 10:03
richardlau added a commit that referenced this pull request May 7, 2022
Trap empty `NODE_VERSION`, e.g. if fetching `index.tab` fails.

Refs: #38
richardlau added a commit that referenced this pull request May 7, 2022
Trap empty `NODE_VERSION`, e.g. if fetching `index.tab` fails.

Refs: #38
richardlau added a commit that referenced this pull request May 7, 2022
Trap empty `NODE_VERSION`, e.g. if fetching `index.tab` fails.

Refs: #38
richardlau added a commit that referenced this pull request May 7, 2022
Trap empty `NODE_VERSION`, e.g. if fetching `index.tab` fails.

Refs: #38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants