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
Reusable build docker action #10017
Reusable build docker action #10017
Conversation
ce65ab9
to
4d8707a
Compare
One thing to note here, the action doesn't work on self hosted runners. It could be made to work by setting up buildx here (or already in our self hosted runner), like on the |
Test Results 812 files + 1 812 suites +1 1h 38m 2s ⏱️ - 5m 52s For more details on these failures, see this check. Results for commit e76b855. ± Comparison against base commit 7f1134c. ♻️ This comment has been updated with latest results. |
I still have to test the deploy, btw, but I could use a pair of eyes to validate the approach. |
e76677a
to
a8f7a6b
Compare
ef20069
to
afad210
Compare
12111c3
to
9681a9c
Compare
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.
Bummer that we can't use it on self-hosted runners. Do you think a second pair of eyes would help to set it up?
The overall approach looks good to me, it's exactly how I imagined it would look like. I can't think of anything that would be problematic or that could be improved.
930c2d2
to
51716bb
Compare
So we can make it work on self-hosted runners in two ways:
|
9681a9c
to
aac645b
Compare
c57897b
to
d50c488
Compare
@oleschoenburg I think I got it to work on self-hosted runners. So our integration tests will also build it, and I've set it up so they will also package the application in the same step, but I feel that might be too opaque. I'm thinking we might want (but not here) to continue building reusable actions, e.g.
I think these are the most common "blocks" we have everywhere. Benefits are centralizing the Maven/Java/Go versions and how the artifacts are built. Downside is things start being a little more "hidden" =/ |
There was a known flaky test, but the rest looks OK. Let me know what you think. |
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.
Awesome, looks good to me 👍
Just two minor comments.
bors merge |
Build succeeded: |
10048: Common reusable actions r=npepinpe a=npepinpe ## Description This PR aggregates the steps to set up the Zeebe environment for packaging, as well as packaging itself, into two reusable actions. By doing this, it removes the duplicate code in the `build-docker` action, and instead relies on the caller having set up and packaged Zeebe beforehand (much like we rely on the checkout step being invoked before). `setup-zeebe` will prepare the environment to build the complete Zeebe distribution. The benefits here is that we centralize once the tech stack, how it's installed, and the versions we require, instead of spreading this everywhere. I've made it configurable so some parts can be ignored, primarily because of the `setup-go` action. If you use that, but do not do anything with Go, it will fail in its post-run when trying to clean a non-existent cache 🤷 The action requires the code to have been checked out beforehand. `build-zeebe` will build the Go client (optional) and the Java distribution (optional). By default, it builds everything. It also requires the environment to be set up beforehand, and the code checked out. It uses the `clients/go/cmd/zbctl/build.sh` script to build the Go client, and will `install` the mvn modules, skipping checks and using `-T1C` to parallelize by default. You can customize the installation via a free-form field letting you set up additional properties to pass to the build. The benefits here is again centralization of the common set up, while allowing enough customization for the various steps. I decided to split both set up and packaging because there are some places where we package the application differently, notably when deploying/releasing. As this will most likely be used in the future for releases, it made sense to me. So the packaging is really more of a "package for non-release cases". It could be changed to allow us to modify the command for packaging (right now you can only pass options, but cannot change the actual goals to execute), and then I suppose it could be reused. I think it might be misleading though to have a build Zeebe action which actually deploys, so I'd rather avoid that for now. ## Related issues related to #10017 Co-authored-by: Nicolas Pepin-Perreault <nicolas.pepin-perreault@camunda.com>
Description
This PR aggregates the steps required to build the Docker image into a reusable action called
build-docker
. The action can build and push the Docker image, as well as package the artifacts for it if need be.Further iterations may want to split packaging out into its own action.
Its usage is as:
The action will set up Docker & Buildx, Java, and Maven. If
package
is true, it will also setupGo
in order to buildzbctl
.When
push
is true, the image is pushed to the given repository, with the tag being made of therepository
andversion
. In the above, this would be equivalent todocker push localhost:5000/camunda/zeebe:current-test
. Ifpush
is false, then the image is built and loaded into the local Docker registry only.If
package
is true, thenzbctl
is compiled, and all the modules are built and installed to the local maven repository. Additionally, the distribution TAR ball is built. If it's false, then the distribution TAR ball is expected to already be present underdist/target/camunda-zeebe-<VERSION>-tar.gz
.If the
version
is omitted, it will be read from the Maven project.Related issues
related to #10013 (as a follow up)
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
backport stable/1.3
) to the PR, in case that fails you need to create backports manually.Testing:
Documentation:
Please refer to our review guidelines.