-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
7 changed files
with
177 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This action packages the complete Zeebe distribution artifacts. This includes the Go client, | ||
# zbctl, and the Zeebe distribution TAR ball. This excludes the Docker image. See the build-docker | ||
# for that. | ||
|
||
--- | ||
name: Build Zeebe | ||
description: Builds & installs the complete Zeebe distribution | ||
|
||
inputs: | ||
go: | ||
description: If false, will not build zbctl; defaults to true | ||
default: "true" | ||
required: false | ||
java: | ||
description: If false, will not build the Java distribution; defaults to true | ||
default: "true" | ||
required: false | ||
maven-extra-args: | ||
description: Additional CLI arguments which will be passed to the maven install command as is, e.g. "-am -pl util/" | ||
default: "" | ||
required: false | ||
|
||
outputs: | ||
distball: | ||
description: "The path to the Zeebe distribution TAR ball" | ||
value: ${{ steps.build-java.outputs.result }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- if: ${{ inputs.go == 'true' }} | ||
name: Build Go | ||
shell: bash | ||
id: build-go | ||
working-directory: clients/go/cmd/zbctl | ||
run: ./build.sh | ||
- if: ${{ inputs.java == 'true' }} | ||
name: Package Zeebe | ||
shell: bash | ||
id: build-java | ||
run: | | ||
mvn -B -DskipTests -DskipChecks -T1C install ${{ inputs.maven-extra-args }} | ||
export BUILD_DIR=$(mvn -pl dist/ help:evaluate -Dexpression=project.build.directory -q -DforceStdout) | ||
export ARTIFACT=$(mvn -pl dist/ help:evaluate -Dexpression=project.build.finalName -q -DforceStdout) | ||
echo "::set-output name=result::${BUILD_DIR}/${ARTIFACT}.tar.gz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This action sets up the environment with the required tech stack in order to build, install, and | ||
# run Zeebe. | ||
|
||
--- | ||
name: Setup Zeebe | ||
description: Sets up the required stack to build, install, and run Zeebe | ||
|
||
inputs: | ||
go: | ||
description: If true, will set up Golang; defaults to true | ||
required: false | ||
default: "true" | ||
java: | ||
description: If true, will set up Java; defaults to true | ||
required: false | ||
default: "true" | ||
java-version: | ||
description: The JDK version to setup | ||
default: "17" | ||
required: false | ||
maven-version: | ||
description: The Maven version to setup | ||
default: "3.8.5" | ||
required: false | ||
|
||
outputs: {} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- if: ${{ inputs.java == 'true' }} | ||
uses: actions/setup-java@v3.4.1 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ inputs.java-version }} | ||
- if: ${{ inputs.java == 'true' }} | ||
uses: stCarolas/setup-maven@v4.4 | ||
with: | ||
maven-version: ${{ inputs.maven-version }} | ||
- if: ${{ inputs.go == 'true' }} | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: 'clients/go/go.mod' | ||
cache: true | ||
cache-dependency-path: 'clients/go/go.sum' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.