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: get branch on RELEASE event triggered workflow #10495

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

andrei-near
Copy link
Contributor

@andrei-near andrei-near commented Jan 25, 2024

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

@andrei-near andrei-near requested a review from a team as a code owner January 25, 2024 13:44
@andrei-near andrei-near changed the title Fix: get branch on RELEASE event triggered wf Fix: get branch on RELEASE event triggered workflow Jan 25, 2024
Copy link
Collaborator

@Ekleog-NEAR Ekleog-NEAR left a 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

Copy link
Member

@posvyatokum posvyatokum left a 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?

@andrei-near
Copy link
Contributor Author

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.

@andrei-near andrei-near enabled auto-merge January 26, 2024 11:59
@andrei-near andrei-near disabled auto-merge January 26, 2024 11:59
@andrei-near
Copy link
Contributor Author

Thanks! Can you rerun the workflow for 1.37.0-rc.1 after it is corrected?

Done this yesterday, binary is published and already released

@andrei-near
Copy link
Contributor Author

Can we use ${{ github.event.release.tag_name || ’master’ }} instead? This’d also remove the name for the BRANCH variable altogether

we could in the workflow but still need to adjust the binary release bash script because context vars are not passed to it

Copy link

codecov bot commented Jan 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e11f020) 71.99% compared to head (fb27286) 72.01%.

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     
Flag Coverage Δ
backward-compatibility 0.08% <ø> (ø)
db-migration 0.08% <ø> (ø)
genesis-check 1.25% <ø> (ø)
integration-tests 36.93% <ø> (+0.07%) ⬆️
linux 71.27% <ø> (+0.02%) ⬆️
linux-nightly 71.38% <ø> (+0.04%) ⬆️
macos 53.41% <ø> (-1.76%) ⬇️
pytests 1.48% <ø> (ø)
sanity-checks 1.27% <ø> (ø)
unittests 67.98% <ø> (-0.02%) ⬇️
upgradability 0.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrei-near andrei-near added this pull request to the merge queue Jan 26, 2024
Merged via the queue into master with commit d96803a Jan 26, 2024
26 checks passed
@andrei-near andrei-near deleted the missing-branch-on-nearcore-release-wf branch January 26, 2024 12:54
posvyatokum pushed a commit that referenced this pull request Jan 29, 2024
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`
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2024
#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">
posvyatokum pushed a commit that referenced this pull request Jan 30, 2024
#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">
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