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: improve docker release pipeline #675

Merged
merged 12 commits into from
Dec 18, 2023

Conversation

Ferror
Copy link
Contributor

@Ferror Ferror commented Jul 3, 2023

A couple of improvements related to the docker release pipeline.

  1. Building multiple architectures -> standard arm and amd
  2. Using official docker GitHub actions
  3. Specify Dockerfile argument to have control over asyncapi release expected version in the image

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

can you share what would you use ASYNCAPI_CLI_VERSION for? what is the use case for? cause for sure not development as we anyway take sources from npm

Dockerfile Outdated
@@ -1,3 +1,5 @@
ARG ASYNCAPI_CLI_VERSION=0.50.0
Copy link
Member

Choose a reason for hiding this comment

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

ok, now I see where 0.50 got from in the generator PR 😄

anyway, why not latest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy pastes be like that. So let me copy the same answer 😆

It's possible that the latest version will cache and you will end up with a docker image with an invalid generator version. With an argument, you can test past versions locally and ensure that you install the right generator version. Seems like a declarative approach.

Now that I think about it we should after the build actually "test" if the installed version inside the image is the same as release

@Ferror Ferror force-pushed the docker-release-improved branch from acd0b7c to e9daf95 Compare July 6, 2023 13:14
@Ferror Ferror requested a review from derberg July 6, 2023 13:14
Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

@Ferror hey, we will need the same timeout as I mentioned in the generator PR. Can you add it. Afaik workflows now support it natively

@Ferror
Copy link
Contributor Author

Ferror commented Jul 20, 2023

@Ferror hey, we will need the same timeout as I mentioned in the generator PR. Can you add it. Afaik workflows now support it natively

Can you elaborate on what it supports natively? I was more convinced to go with https://docs.github.com/en/actions/using-workflows/reusing-workflows

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Ferror
Copy link
Contributor Author

Ferror commented Jul 20, 2023

@derberg I think I put it all together, but to be honest I find the pipelines weirdly complex. And to have it cohesive must be a different pair of boots 😢

asyncapi/.github#256

@derberg
Copy link
Member

derberg commented Jul 24, 2023

@Ferror sorry, I probably did not explain myself correct, and used phrase timeout instead of delay. Sorry about that.

so basically, docker releases run on release event. Thing is that GitHub release might be created, but npm not yet published. The release pipelines were created over 3y ago, when GitHub Actions did not have all the features in place and we were also learning it live. As far as I remember, when I was setting that up, we made sure the semantic-release plugins are ordered properly https://github.com/asyncapi/generator/blob/master/.releaserc#L16 so the GitHub release is created last. Also logs confirm"

[11:25:20 AM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/npm"
[11:25:20 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/github"

but when I worked on the pipeline, we had random fails of docker publishing, and the conclusion was, after some investigation, that the fact that "logs say" package is published on npm, sometimes there is a "some-seconds" delay before it is available for download.

this is why we had this https://github.com/asyncapi/generator/blob/master/.github/workflows/release-docker.yml#L26 in pipeline for generator docker release.

now, after 3y and github acquisition of npm maybe that improved, and also why CLI docker release did not fail yet. But why taking a risk, we can just have a well described step that just does

name: Short docker release delay
run: sleep 1m #docker image installs generator from npm, this sleep protects this step from any delays on npm side

sorry again for lame initial explanation

@derberg
Copy link
Member

derberg commented Oct 30, 2023

@Ferror yo, do you plan to continue with this one? would be great

@Ferror
Copy link
Contributor Author

Ferror commented Oct 30, 2023

@Ferror yo, do you plan to continue with this one? would be great

Yea. I forgot about it. I will add some improvements like we did for generator and we can release it :)

@Ferror Ferror requested a review from derberg November 5, 2023 20:13
@Ferror Ferror force-pushed the docker-release-improved branch from 8d51d7c to 3d19139 Compare November 7, 2023 17:33
@Ferror Ferror requested a review from derberg November 7, 2023 17:33
@derberg
Copy link
Member

derberg commented Nov 14, 2023

@Ferror Ferror force-pushed the docker-release-improved branch from 61d0836 to e0b1563 Compare November 18, 2023 14:59
@Ferror Ferror force-pushed the docker-release-improved branch from 99146fc to 97764e0 Compare November 30, 2023 13:57
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@derberg
Copy link
Member

derberg commented Dec 18, 2023

@Ferror 1s sleep is not enough. It was 1m originally. We can try 30s now (just changed) and in case it actually still should be 1m we can always modify pipeline. But going with 1s should be avoided

@derberg
Copy link
Member

derberg commented Dec 18, 2023

/rtm

@asyncapi-bot asyncapi-bot merged commit df5f1a6 into asyncapi:master Dec 18, 2023
10 checks passed
@Ferror Ferror deleted the docker-release-improved branch December 18, 2023 17:32
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 1.2.24 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants