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

fix: lerna publish script #13254

Merged
merged 3 commits into from
Sep 21, 2023
Merged

fix: lerna publish script #13254

merged 3 commits into from
Sep 21, 2023

Conversation

sobolk
Copy link
Member

@sobolk sobolk commented Sep 21, 2023

Description of changes

Fixes lerna publish script to explicitly exit when ERR! happens.

Issue #, if available

Description of how you validated changes

  1. This PR's build and e2e tests job (this does run publish to verdaccio).

  2. Tested added snippet with faked error.

bcd0740fa72c:~ sobkamil$ nano test_publish.sh
bcd0740fa72c:~ sobkamil$ touch /tmp/publish-results
bcd0740fa72c:~ sobkamil$ ./test_publish.sh
Success! Lerna publish succeeded.
bcd0740fa72c:~ sobkamil$ cp ./lerna_error.txt /tmp/publish-results
bcd0740fa72c:~ sobkamil$ ./test_publish.sh
Fail! Lerna error.
bcd0740fa72c:~ sobkamil$ echo $?
1
bcd0740fa72c:~ sobkamil$ cat test_publish.sh
  number_of_lerna_errors=$(grep -c "lerna ERR" /tmp/publish-results)
  if [[ number_of_lerna_errors -gt 0 ]]; then
    echo "Fail! Lerna error."
    exit 1;
  else
    echo "Success! Lerna publish succeeded."
  fi
bcd0740fa72c:~ sobkamil$ cate lerna_error.txt
-bash: cate: command not found
bcd0740fa72c:~ sobkamil$ cat lerna_error.txt
lerna notice 8.9MB   resources/codepipeline-action-buildspec-generator-lambda.zip
lerna notice 21.0kB  resources/custom-resource-pipeline-awaiter.zip
lerna notice === Tarball Details ===
lerna notice name:          @aws-amplify/amplify-provider-awscloudformation
lerna notice version:       8.6.0-rc.0d5077acf100296.0
lerna notice filename:      aws-amplify-amplify-provider-awscloudformation-8.6.0-rc.0d5077acf100296.0.tgz
lerna notice package size:  8.8 MB
lerna notice unpacked size: 10.6 MB
lerna notice shasum:        fd256b3546ae6e39d682aa6e27902471051e46ea
lerna notice integrity:     sha512-w5/Dc8HrHkFph[...]1ktaPhRdY4fUw==
lerna notice total files:   541
lerna notice
lerna ERR! E503 Service Unavailable
bcd0740fa72c:~ sobkamil$

After changing grep -c to grep .. | wc -l

bcd0740fa72c:~ sobkamil$ nano test_publish.sh
bcd0740fa72c:~ sobkamil$ rm /tmp/publish-results
bcd0740fa72c:~ sobkamil$ touch /tmp/publish-results
bcd0740fa72c:~ sobkamil$ ./test_publish.sh
Success! Lerna publish succeeded.
bcd0740fa72c:~ sobkamil$ echo $?
0
bcd0740fa72c:~ sobkamil$ cp lerna_error.txt /tmp/publish-results
bcd0740fa72c:~ sobkamil$ ./test_publish.sh
Fail! Lerna error.
bcd0740fa72c:~ sobkamil$ echo $?
1

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sobolk sobolk requested a review from a team as a code owner September 21, 2023 20:09
Amplifiyer
Amplifiyer previously approved these changes Sep 21, 2023
awsluja
awsluja previously approved these changes Sep 21, 2023
@sobolk sobolk dismissed stale reviews from awsluja and Amplifiyer via 16c7108 September 21, 2023 20:43
@sobolk sobolk mentioned this pull request Sep 21, 2023
6 tasks
@sobolk sobolk merged commit d2eb338 into aws-amplify:dev Sep 21, 2023
@sobolk sobolk deleted the fix-lerna-publish branch September 21, 2023 21:13
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.

3 participants