-
Notifications
You must be signed in to change notification settings - Fork 679
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: get branch on RELEASE event triggered workflow #10495
Conversation
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.
Can we use ${{ github.event.release.tag_name || ’master’ }}
instead? This’d also remove the name for the BRANCH
variable altogether
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.
Thanks! Can you rerun the workflow for 1.37.0-rc.1 after it is corrected?
This would need to be merged into 1.37 branch as well. Only then the triggered WF would function correctly. |
Done this yesterday, binary is published and already released |
we could in the workflow but still need to adjust the binary release bash script because context vars are not passed to it |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #10495 +/- ##
==========================================
+ Coverage 71.99% 72.01% +0.02%
==========================================
Files 720 720
Lines 146328 146328
Branches 146328 146328
==========================================
+ Hits 105343 105385 +42
+ Misses 36132 36100 -32
+ Partials 4853 4843 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
On release triggered workflow runs, the HEAD is detached and no local branch is present. Due to this, BRANCH var ends up as an empty string and this causes failures to publish artifacts: https://github.com/near/nearcore/actions/runs/7640475082/job/20815674136 ++ git branch --show-current + BRANCH= ++ git rev-parse HEAD + COMMIT=c869dd6c1e942f21e27a74c7e47a698de ++ uname this leads to incorrect S3 paths: `s3://build.nearprotocol.com/nearcore/$(uname)/${BRANCH}/latest` -> `s3://build.nearprotocol.com/nearcore/Linux//latest`
#10495 was meant to fix the builds triggered by release events. With actions/checkout GHA action only a single commit is fetched by default and thus missing branch match. To fetch all history for all branches and tags, setting fetch-depth to 0 for both binary and docker image release jobs. This was [tested](https://github.com/near/andrei-playground/actions/runs/7696882172/job/20972653224) on a private repo. <img width="676" alt="Screenshot 2024-01-29 at 13 42 09" src="https://github.com/near/nearcore/assets/122784628/941c1cd8-285e-4853-a9e7-a6ea6885c838">
#10495 was meant to fix the builds triggered by release events. With actions/checkout GHA action only a single commit is fetched by default and thus missing branch match. To fetch all history for all branches and tags, setting fetch-depth to 0 for both binary and docker image release jobs. This was [tested](https://github.com/near/andrei-playground/actions/runs/7696882172/job/20972653224) on a private repo. <img width="676" alt="Screenshot 2024-01-29 at 13 42 09" src="https://github.com/near/nearcore/assets/122784628/941c1cd8-285e-4853-a9e7-a6ea6885c838">
On release triggered workflow runs, the HEAD is detached and no local branch is present.
Due to this, BRANCH var ends up as an empty string and this causes failures to publish artifacts:
https://github.com/near/nearcore/actions/runs/7640475082/job/20815674136
++ git branch --show-current
++ git rev-parse HEAD
++ uname
this leads to incorrect S3 paths:
s3://build.nearprotocol.com/nearcore/$(uname)/${BRANCH}/latest
->s3://build.nearprotocol.com/nearcore/Linux//latest