-
Notifications
You must be signed in to change notification settings - Fork 278
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
Correcting dockerize job to run when a release is created #2800
Conversation
.github/workflows/ci.yml
Outdated
@@ -98,7 +98,7 @@ jobs: | |||
dockerize: | |||
needs: [native-image,test] | |||
runs-on: ubuntu-latest | |||
if: startsWith(github.ref, 'refs/tags/v') && github.event_name != 'release' | |||
if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'release' && github.event.action == 'created' |
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.
are you sure about this? before, it ran if it was not for a release. now it will no longer run for those cases.
should it be event_name == release || event_action == created
?
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.
I'm a bit confused as to why this was to run only if not release, yet the ref is a release version tag?
I used event_name == release && event.action == 'created'
because the doc here suggests that release
event type has many activity types and I figured this would protect it from running too often
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.
Especially confused because the release artifact is only uploaded when event_name == 'release'
https://github.com/scalameta/scalafmt/pull/2800/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR89
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.
Unfortunately, I don't remember the reason for this configuration. It may conflict with upload release assets step at line 85. But I suggest to merge it and see what happens.
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.
my question is this: did this line ever run before? if it did, it will no longer run now. is that ok?
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.
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.
we have tried publishing in two ways: by creating a tag locally and pushing it (works, and triggers a release build), or by editing the draft via the ui (doesn't work, no release build is triggered). with one of the recent releases, i forgot and tried the ui way, then repushed the local tag. the reason i suggested the OR approach is that it extends the rule rather than switching it to something completely different.
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.
startsWith(github.ref, 'refs/tags/v') && github.event_name != 'release' || github.event_name == 'release' && github.event.action == 'created'
may be?
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.
exactly! but can be simplified as
startsWith(github.ref, 'refs/tags/v') &&
(github.event_name != 'release' ||
github.event.action == 'created')
removing ... == 'release'
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.
Alright @kitbellew and @poslegm - I did some more digging into this today. Turns out that I may have caused more confusion than help with suggesting we use == 'created'
.
It looks like what caused this was Dependabot's update of our build-push-action
from v1
to v2+
3801986#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03f
That update broke our uploads. The errors we're seeing on the Dockerize
Step(link) are due to build-push-action@v2
using buildx context and so the docker build context did not properly include the download-artifact
step we do immediately before.
I'm going to add a commit(fcfd249) to this PR to address this finding
I can take a look at it next week, but I am not too familiar with the docker stuff. The change does look sensible though. |
.github/workflows/ci.yml
Outdated
@@ -98,7 +98,7 @@ jobs: | |||
dockerize: | |||
needs: [native-image,test] | |||
runs-on: ubuntu-latest | |||
if: startsWith(github.ref, 'refs/tags/v') && github.event_name != 'release' | |||
if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'release' && github.event.action == 'created' |
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.
Unfortunately, I don't remember the reason for this configuration. It may conflict with upload release assets step at line 85. But I suggest to merge it and see what happens.
@@ -100,15 +100,21 @@ jobs: | |||
runs-on: ubuntu-latest | |||
if: startsWith(github.ref, 'refs/tags/v') && github.event_name != 'release' | |||
steps: | |||
- uses: actions/checkout@v2 | |||
- run: git fetch --unshallow |
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.
do we not need this line anymore?
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.
I don't think so - The Dockerfile doesn't use the checkout at all (it's only copy'ing over the artifact )
The only reason I'm including the checkout at all is because the build-push-action
docs mentioned it in "Path" context which was the way I was able to get it working again
Hey, All 🟢 ! Thanks for re-running the tests @kitbellew. |
Awesome, thanks @kitbellew ! Looking forward to keeping an eye on the next release to see how this does. P.S.: Any chance you'd be able to apply the |
how do i apply the label? :) |
Hah, honestly - no idea - I figured if you had merge access you'd also have access to create + apply labels to PRs? |
i probably have access but i have never done it so i don't know which steps to take :) |
@jmherbst could you please take a look:
So, comparing to what happened with v3.0.6, I don't see a difference. Dockerize still failed. |
Sure, taking a look @kitbellew |
I believe this step has been broken for a while. The latest tagged docker container on hub is
v2.7.5
Looking at the actions log from latest release commit https://github.com/scalameta/scalafmt/runs/3777211161
It shows that the artifact was uploaded in the CI:release run, but the
dockerize
job was not executed.The
dockerize
job was executed in the CI:Push run, but the artifact isn't uploaded in that run, so thedockerize
step failsI think this change will correct this behavior, so that when future
v
tag'd releases are created, it will upload the artifact, and then dockerize will run.