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(docker): use native arm runners #282

Open
wants to merge 5 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .github/workflows/build-and-test-ee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,25 @@ on:
jobs:
build-and-test-ee:
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-22.04
runs-on: ${{ matrix.PLATFORM }}
strategy:
matrix:
DISTRO: [tomcat, wildfly, run]
PLATFORM: [amd64, arm64]
PLATFORM: [ubuntu-22.04, aws-arm-core-4-default]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.PLATFORM != 'amd64' }}
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ matrix.PLATFORM == 'aws-arm-core-4-default' }}
with:
platforms: ${{ matrix.PLATFORM }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build
run: ./pipeline.sh
env:
DISTRO: ${{ matrix.DISTRO }}
EE: true
PLATFORM: ${{ matrix.PLATFORM }}
NEXUS_PASS: ${{ secrets.NEXUS_PASS }}
NEXUS_USER: ${{ secrets.NEXUS_USER }}
VERSION: ${{ github.event.inputs.version }}
Expand All @@ -43,6 +41,5 @@ jobs:
env:
DISTRO: ${{ matrix.DISTRO }}
EE: true
PLATFORM: ${{ matrix.PLATFORM }}
VERSION: ${{ github.event.inputs.version }}
SNAPSHOT: ${{ github.event.inputs.snapshot }}
39 changes: 12 additions & 27 deletions .github/workflows/build-test-and-publish-ce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,26 @@ name: Build, test, and publish CE
on: [pull_request, push, workflow_dispatch]
jobs:
build-and-test:
runs-on: ubuntu-22.04
runs-on: ${{ matrix.PLATFORM }}
strategy:
fail-fast: false
matrix:
DISTRO: [tomcat, wildfly, run]
PLATFORM: [amd64, arm64]
PLATFORM: [ubuntu-22.04, aws-arm-core-4-default]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.PLATFORM != 'amd64' }}
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ matrix.PLATFORM == 'aws-arm-core-4-default' }}
with:
platforms: ${{ matrix.PLATFORM }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: actions/github-script@v7
with:
script: |
Object.keys(process.env).forEach(function (key) {
if (key.startsWith('ACTIONS_')) {
core.info(`${key}=${process.env[key]}`);
core.exportVariable(key, process.env[key]);
}
});
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build
run: ./pipeline.sh
env:
DISTRO: ${{ matrix.DISTRO }}
EE: false
PLATFORM: ${{ matrix.PLATFORM }}
NEXUS_PASS: ${{ secrets.NEXUS_PASS }}
NEXUS_USER: ${{ secrets.NEXUS_USER }}
- name: Test
Expand All @@ -42,25 +30,22 @@ jobs:
env:
DISTRO: ${{ matrix.DISTRO }}
EE: false
PLATFORM: ${{ matrix.PLATFORM }}
publish:
runs-on: ubuntu-20.04
runs-on: aws-arm-core-4-default
needs: build-and-test
if: ${{ github.ref == 'refs/heads/next' || startsWith(github.ref, 'refs/heads/7.') }}
#if: ${{ github.ref == 'refs/heads/next' || startsWith(github.ref, 'refs/heads/7.') }}
strategy:
matrix:
DISTRO: [tomcat, wildfly, run]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64,amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm64,linux/amd64
- name: Expose GitHub Runtime
uses: actions/github-script@v7
uses: actions/github-script@v6
with:
script: |
Object.keys(process.env).forEach(function (key) {
Expand Down
26 changes: 13 additions & 13 deletions pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ else
VERSION_ARGUMENT="--build-arg VERSION=${VERSION}"
fi

IMAGE_NAME=camunda/camunda-bpm-platform:${DISTRO}-${PLATFORM}
IMAGE_NAME=camunda/camunda-bpm-platform:${DISTRO}

docker buildx build . \
-t "${IMAGE_NAME}" \
--platform linux/${PLATFORM} \
--build-arg DISTRO=${DISTRO} \
--build-arg EE=${EE} \
--build-arg USER=${NEXUS_USER} \
--build-arg PASSWORD=${NEXUS_PASS} \
${VERSION_ARGUMENT} \
${SNAPSHOT_ARGUMENT} \
--cache-to type=gha,scope="$GITHUB_REF_NAME-$DISTRO-image" \
--cache-from type=gha,scope="$GITHUB_REF_NAME-$DISTRO-image" \
--load
echo "Runner architecture: $(uname -m)"

echo "::group::Docker build"
docker build . \
-t "${IMAGE_NAME}" \
--build-arg DISTRO=${DISTRO} \
--build-arg EE=${EE} \
--build-arg USER=${NEXUS_USER} \
--build-arg PASSWORD=${NEXUS_PASS} \
${VERSION_ARGUMENT} \
${SNAPSHOT_ARGUMENT}
echo "::endgroup::"

docker inspect "${IMAGE_NAME}" | grep "Architecture" -A2
26 changes: 14 additions & 12 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@ NEXUS_PASS=${NEXUS_PASS:-}
IMAGE=camunda/camunda-bpm-platform

function build_and_push {
echo "::group::Docker build push"
local tags=("$@")
printf -v tag_arguments -- "--tag $IMAGE:%s " "${tags[@]}"
docker buildx build . \
$tag_arguments \
--build-arg DISTRO=${DISTRO} \
--build-arg EE=${EE} \
--build-arg USER=${NEXUS_USER} \
--build-arg PASSWORD=${NEXUS_PASS} \
--cache-from type=gha,scope="$GITHUB_REF_NAME-$DISTRO-image" \
--platform $PLATFORMS \
--push
docker buildx build . \
$tag_arguments \
--build-arg DISTRO=${DISTRO} \
--build-arg EE=${EE} \
--build-arg USER=${NEXUS_USER} \
--build-arg PASSWORD=${NEXUS_PASS} \
--cache-to type=gha,scope="$GITHUB_REF_NAME-$DISTRO-image" \
--cache-from type=gha,scope="$GITHUB_REF_NAME-$DISTRO-image" \
--platform $PLATFORMS
echo "::endgroup::"

echo "Tags released:" >> $GITHUB_STEP_SUMMARY
printf -- "- $IMAGE:%s\n" "${tags[@]}" >> $GITHUB_STEP_SUMMARY
echo "Tags released:" >> $GITHUB_STEP_SUMMARY
printf -- "- $IMAGE:%s\n" "${tags[@]}" >> $GITHUB_STEP_SUMMARY
}

if [ "${EE}" = "true" ]; then
Expand All @@ -38,7 +40,7 @@ if [ $(docker manifest inspect $IMAGE:${DISTRO}-${VERSION} > /dev/null ; echo $?
exit 0
fi

docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"
#docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"

tags=()

Expand Down
18 changes: 6 additions & 12 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ version: '2.4'

services:
camunda:
image: camunda/camunda-bpm-platform:${DISTRO}-${PLATFORM}
platform: linux/${PLATFORM}
image: camunda/camunda-bpm-platform:${DISTRO}
ports:
- "8080:8080"
restart: unless-stopped

camunda-mysql:
image: camunda/camunda-bpm-platform:${DISTRO}-${PLATFORM}
platform: linux/${PLATFORM}
image: camunda/camunda-bpm-platform:${DISTRO}
environment:
- DB_DRIVER=com.mysql.cj.jdbc.Driver
- DB_URL=jdbc:mysql://mysql:3306/process-engine?sendFractionalSeconds=false
Expand All @@ -24,8 +22,7 @@ services:
restart: unless-stopped

camunda-postgres:
image: camunda/camunda-bpm-platform:${DISTRO}-${PLATFORM}
platform: linux/${PLATFORM}
image: camunda/camunda-bpm-platform:${DISTRO}
environment:
- DB_DRIVER=org.postgresql.Driver
- DB_URL=jdbc:postgresql://postgres:5432/camunda
Expand All @@ -39,8 +36,7 @@ services:
restart: unless-stopped

camunda-debug:
image: camunda/camunda-bpm-platform:${DISTRO}-${PLATFORM}
platform: linux/${PLATFORM}
image: camunda/camunda-bpm-platform:${DISTRO}
environment:
- DEBUG=true
ports:
Expand All @@ -49,8 +45,7 @@ services:
restart: unless-stopped

camunda-prometheus-jmx:
image: camunda/camunda-bpm-platform:${DISTRO}-${PLATFORM}
platform: linux/${PLATFORM}
image: camunda/camunda-bpm-platform:${DISTRO}
environment:
- JMX_PROMETHEUS=true
ports:
Expand All @@ -59,8 +54,7 @@ services:
restart: unless-stopped

camunda-password-file:
image: camunda/camunda-bpm-platform:${DISTRO}-${PLATFORM}
platform: linux/${PLATFORM}
image: camunda/camunda-bpm-platform:${DISTRO}
environment:
- DB_DRIVER=com.mysql.cj.jdbc.Driver
- DB_URL=jdbc:mysql://mysql:3306/process-engine?sendFractionalSeconds=false
Expand Down
18 changes: 12 additions & 6 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

function run_test {
echo "::group::Test '$2'"
"$@"
echo "::endgroup::"
}

cd ${DIR}
docker-compose up --force-recreate -d postgres mysql
./test-${DISTRO}.sh camunda
./test-${DISTRO}.sh camunda-mysql
./test-${DISTRO}.sh camunda-postgres
./test-${DISTRO}.sh camunda-password-file
./test-prometheus-jmx-${DISTRO}.sh camunda-prometheus-jmx
./test-debug.sh camunda-debug
run_test ./test-${DISTRO}.sh camunda
run_test ./test-${DISTRO}.sh camunda-mysql
run_test ./test-${DISTRO}.sh camunda-postgres
run_test ./test-${DISTRO}.sh camunda-password-file
run_test ./test-prometheus-jmx-${DISTRO}.sh camunda-prometheus-jmx
run_test ./test-debug.sh camunda-debug
docker-compose down -v
cd -
Loading