Skip to content
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8e15b60
feat: Add Maven Cache Dance and Setup Java and Maven actions for impr…
MichaelsJP Dec 2, 2025
7033235
feat: Add reusable workflow for building Docker images across multipl…
MichaelsJP Dec 2, 2025
494365d
refactor: Streamline Docker build workflow and remove unused Maven de…
MichaelsJP Dec 2, 2025
fe84a27
chore: Deactivate workflow for now
MichaelsJP Dec 2, 2025
8501d90
chore: Fix path to reusable Docker build workflow
MichaelsJP Dec 2, 2025
2c1cd9e
chore: Update workflow reference for building Docker images
MichaelsJP Dec 2, 2025
7f8e62e
chore: Fix setup-java step ID and condition for dependency download
MichaelsJP Dec 2, 2025
069c3ea
chore: Update output type and destination for Docker image build step
MichaelsJP Dec 2, 2025
d55afe2
chore: Update output variable names in Docker build workflow
MichaelsJP Dec 2, 2025
e6fcccd
chore: Add cache-hit output to setup-java-maven action and update wor…
MichaelsJP Dec 2, 2025
b4f446e
chore: Update default Java version to 21 and improve dependency downl…
MichaelsJP Dec 2, 2025
a428c5b
chore: Update cache target path in Maven Cache Dance action
MichaelsJP Dec 2, 2025
2eff173
chore: Update Docker image loading step to use buildx for improved pe…
MichaelsJP Dec 2, 2025
227d768
chore: Update Docker image handling to use OCI format for improved co…
MichaelsJP Dec 2, 2025
af90cdd
chore: Update Docker image handling to use tar format for improved co…
MichaelsJP Dec 2, 2025
118ec38
chore: Refactor Docker tag resolution for improved clarity and mainta…
MichaelsJP Dec 2, 2025
ecf6ada
chore: Format dependency resolution command for improved readability
MichaelsJP Dec 2, 2025
69e3b44
chore: Update Docker actions to specific versions for improved stability
MichaelsJP Dec 2, 2025
b321cfe
chore: Enhance Docker tag resolution by using environment variables f…
MichaelsJP Dec 2, 2025
b480e9b
chore: Add cache hit output to Maven setup and streamline Docker cach…
MichaelsJP Dec 2, 2025
ff9bd9d
chore: Simplify cache hit output handling in Java and Maven setup action
MichaelsJP Dec 2, 2025
3a71743
chore: Apply the github native naming schema for reusable workflows
MichaelsJP Dec 2, 2025
b9881e4
chore: Update Java version in SonarCube analysis and streamline Maven…
MichaelsJP Dec 2, 2025
fe9f688
chore: Streamline Java and Maven setup in vulnerability scanning work…
MichaelsJP Dec 2, 2025
9fd07c8
chore: Remove obsolete Docker development snapshot image CI workflow
MichaelsJP Dec 2, 2025
7ef7493
chore: Remove obsolete RPM build workflow from GitHub Actions
MichaelsJP Dec 2, 2025
a030abe
chore: Implement setup-build-environment action and streamline workflows
MichaelsJP Dec 2, 2025
f879acc
chore: Update integration tests workflow to use 'main' branch and str…
MichaelsJP Dec 2, 2025
412ccb4
chore: Update Java version to 21 in CI workflows and streamline build…
MichaelsJP Dec 3, 2025
41d7871
chore: Enhance GitHub Actions workflows for Sonar analysis and test s…
MichaelsJP Dec 3, 2025
f6590b8
chore: Update Maven test workflow to improve test execution and remov…
MichaelsJP Dec 3, 2025
b8813a3
chore: Update Docker actions to specific versions for consistency and…
MichaelsJP Dec 3, 2025
e390f9a
chore: Update yq action to latest version for improved functionality
MichaelsJP Dec 3, 2025
d1892a8
chore: Refactor Java and Maven setup in GitHub Actions, removing obso…
MichaelsJP Dec 3, 2025
d9c01d2
chore: Update vulnerability scanning workflow to streamline Java and …
MichaelsJP Dec 3, 2025
b39b89a
chore: move reusable workflow to templates directory
MichaelsJP Dec 3, 2025
6c93966
chore: add parse-release-tag action and corresponding test workflow
MichaelsJP Dec 3, 2025
77ebcd2
chore: add workflow to test setup-build-environment action
MichaelsJP Dec 3, 2025
94a612d
chore: enhance documentation for test workflows of parse-release-tag …
MichaelsJP Dec 3, 2025
616df4f
chore: create reusable workflow for building Docker images
MichaelsJP Dec 3, 2025
b4da1c8
chore: move test workflows
MichaelsJP Dec 3, 2025
69b06b1
chore: remove redundant MAVEN_OPTS build-args from workflows and set …
MichaelsJP Dec 3, 2025
3c4c3dd
chore: remove java_version parameter from setup-build-environment act…
MichaelsJP Dec 3, 2025
b0d6aa5
chore: simplify Maven test commands in integration tests workflow
MichaelsJP Dec 3, 2025
82bcb03
chore: enhance reusable Docker build workflow with new inputs and ARM…
MichaelsJP Dec 3, 2025
80d9a54
chore: add configurable dockerfile path input to reusable Docker buil…
MichaelsJP Dec 3, 2025
189e15b
chore: streamline Docker image build workflows and enhance ARM64 hand…
MichaelsJP Dec 3, 2025
37cbe66
chore: simplify vulnerability scanning workflow by removing unnecessa…
MichaelsJP Dec 3, 2025
b9d911c
chore: refactor vulnerability scanning workflow to separate build job…
MichaelsJP Dec 3, 2025
ecb1336
chore: enhance Docker image build workflow with skip_on_draft input f…
MichaelsJP Dec 3, 2025
012c508
chore: enhance setup-build-environment action with Docker cache injec…
MichaelsJP Dec 3, 2025
cb17eb2
chore: enhance reusable Docker image build workflow with artifact han…
MichaelsJP Dec 3, 2025
e3889b9
chore: add checkout step to reusable Docker image build workflow
MichaelsJP Dec 3, 2025
3de38a4
chore: simplify artifact output path for Docker image build
MichaelsJP Dec 3, 2025
b39e1eb
chore: add checkout step to vulnerability scanning workflow
MichaelsJP Dec 3, 2025
195a10e
chore: add checkout step to vulnerability scanning workflow
MichaelsJP Dec 3, 2025
e61bbd0
chore: update artifact path for Docker image handling in vulnerabilit…
MichaelsJP Dec 3, 2025
7ba3910
chore: update artifact path handling in Docker image build workflow
MichaelsJP Dec 3, 2025
3bbfc2c
chore: streamline artifact handling in Docker image workflows
MichaelsJP Dec 4, 2025
704d835
chore: fix conditional logic in vulnerability scanning workflow
MichaelsJP Dec 4, 2025
2d1f8e8
chore: streamline artifact handling in image scanning workflow
MichaelsJP Dec 4, 2025
44ab0fe
chore: remove unused artifact path outputs in Docker image workflows
MichaelsJP Dec 5, 2025
090af3f
chore: fix artifact path handling in Docker image workflow
MichaelsJP Dec 5, 2025
85572f6
chore: fix output type in Docker image workflow
MichaelsJP Dec 5, 2025
eed75a9
chore: enhance Java setup condition in build environment action
MichaelsJP Dec 5, 2025
3c8c3bc
chore: add artifact filename output to Docker image workflows
MichaelsJP Dec 5, 2025
a4354ce
chore: update setup build environment action parameters for Docker
MichaelsJP Dec 5, 2025
68073f5
chore: Always run checkout
MichaelsJP Dec 5, 2025
fc802fc
chore: remove conditional skip for checkout step in Docker workflow
MichaelsJP Dec 5, 2025
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
39 changes: 39 additions & 0 deletions .github/actions/maven-cache-dance/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Maven Cache Dance
description: Prepares all Dockerfiles for Maven cache mounts and injects cache into Docker build
inputs:
builder:
description: The Docker Buildx builder name
required: true
dockerfile:
description: Path to the primary Dockerfile to use for buildkit injection (will still inject cache for all Dockerfiles found)
required: false
default: 'Dockerfile'
skip-extraction:
description: Skip cache extraction if cache hit occurred
required: false
default: 'false'
cache-hit:
description: Whether Maven cache was hit (used for skip-extraction)
required: false
default: ''
outputs: {}
runs:
using: composite
steps:
- name: Prepare all Dockerfiles for Maven cache mount
shell: bash
run: |
# Find and prepare all Dockerfiles in the repository
find . -name "Dockerfile" -o -name "*.Dockerfile" | while read dockerfile; do
sed -i "s|RUN \./mvnw |RUN --mount=type=cache,target=/root/.m2/repository ./mvnw |g" "$dockerfile"
done
- name: Inject Maven cache into Docker build
uses: 'reproducible-containers/buildkit-cache-dance@5b81f4d29dc8397a7d341dba3aeecc7ec54d6361' # v3.3.0
with:
builder: ${{ inputs.builder }}
dockerfile: ${{ inputs.dockerfile }}
skip-extraction: ${{ inputs.cache-hit }}
cache-map: |
{
"/home/runner/.m2/repository": "/root/.m2/repository"
}
28 changes: 28 additions & 0 deletions .github/actions/setup-java-maven/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Setup Java and Maven'
description: 'Set up JDK and Maven with dependency caching'

inputs:
java_version:
description: 'Java version to install'
required: false
default: '21'
outputs:
cache-hit:
description: 'Whether the Maven cache was hit'
runs:
using: 'composite'
steps:
- name: Set up JDK ${{ inputs.java_version }}
id: setup-java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ inputs.java_version }}
cache: 'maven'

- name: Download maven dependencies
if: steps.setup-java.outputs.cache-hit != 'true'
shell: bash
run: |
./mvnw package -Dmaven.test.skip=true -B dependency:go-offline dependency:resolve-plugins dependency:resolve -q
./mvnw clean -q
209 changes: 209 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
name: Build Docker Images (Reusable)
description: Reusable workflow to build Docker images for multiple platforms and stages

on:
workflow_call:
inputs:
push:
description: Whether to push the image to a registry
type: boolean
default: false
tags_publish_amd64:
description: Docker tag for publish image on amd64
type: string
default: 'local/openrouteservice:test'
tags_publish_arm64:
description: Docker tag for publish image on arm64
type: string
default: 'local/openrouteservice:test'
tags_minimal_amd64:
description: Docker tag for minimal image on amd64
type: string
default: 'local/openrouteservice:test-minimal'
tags_minimal_arm64:
description: Docker tag for minimal image on arm64
type: string
default: 'local/openrouteservice:test-minimal'
cache_from_type:
description: Cache backend type (default gha for GitHub Actions)
type: string
default: 'gha'
java_version:
description: Java version to use for Maven builds
type: string
default: '21'
skip_arm64:
description: Skip ARM64 builds
type: boolean
default: false
outputs:
dockerfile_hash:
description: Hash of the Dockerfile
value: ${{ jobs.prepare_environment.outputs.dockerfile_hash }}

jobs:
prepare_environment:
name: Prepare the environment variables
runs-on: ubuntu-latest
outputs:
dockerfile_hash: ${{ steps.dockerfile-hash.outputs.hash }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate Dockerfile hash
id: dockerfile-hash
run: |
HASH=$(sha256sum Dockerfile | cut -d' ' -f1 | cut -c1-8)
echo "hash=$HASH" >> $GITHUB_OUTPUT

prepare_maven_dependencies:
name: Prepare Maven dependencies for ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
needs:
- prepare_environment
strategy:
matrix:
include:
- platform: linux/amd64
name: linux-amd64
runner: ubuntu-latest
- platform: linux/arm64
name: linux-arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java and Maven
uses: ./.github/actions/setup-java-maven
with:
java_version: ${{ inputs.java_version }}

build_docker_images:
name: Build ${{ matrix.image_stage }} for ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
needs:
- prepare_environment
- prepare_maven_dependencies
strategy:
matrix:
include:
- platform: linux/amd64
name: linux-amd64
runner: ubuntu-latest
image_stage: publish
docker_tag_input: tags_publish_amd64
- platform: linux/arm64
name: linux-arm64
runner: ubuntu-24.04-arm
image_stage: publish
docker_tag_input: tags_publish_arm64
- platform: linux/amd64
name: linux-amd64
runner: ubuntu-latest
image_stage: minimal
docker_tag_input: tags_minimal_amd64
- platform: linux/arm64
name: linux-arm64
runner: ubuntu-24.04-arm
image_stage: minimal
docker_tag_input: tags_minimal_arm64
steps:
- name: Check if should skip (ARM64)
id: should_skip
run: |
SKIP="false"
# Skip ARM64 builds if requested
if [[ "${{ matrix.name }}" == "linux-arm64" && "${{ inputs.skip_arm64 }}" == "true" ]]; then
SKIP="true"
fi
echo "skip=$SKIP" >> $GITHUB_OUTPUT

- name: Checkout
if: steps.should_skip.outputs.skip != 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get and save the UID
if: steps.should_skip.outputs.skip != 'true'
run: |
echo "UID=$(id -u)" >> $GITHUB_ENV

- name: Set up Docker Buildx
if: steps.should_skip.outputs.skip != 'true'
uses: docker/setup-buildx-action@v3
id: buildx

- name: Setup Java and Maven
id: setup-java
if: steps.should_skip.outputs.skip != 'true'
uses: ./.github/actions/setup-java-maven
with:
java_version: ${{ inputs.java_version }}

- name: Maven cache dance
if: steps.should_skip.outputs.skip != 'true'
uses: ./.github/actions/maven-cache-dance
with:
builder: ${{ steps.buildx.outputs.name }}
dockerfile: 'Dockerfile'
cache-hit: '${{ steps.setup-java.outputs.cache-hit }}'

- name: Resolve Docker tag (publish amd64)
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_publish_amd64'
id: resolve_tag_1
run: |
echo "tag=${{ inputs.tags_publish_amd64 }}" >> $GITHUB_OUTPUT

Check failure on line 158 in .github/workflows/build-docker-images.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change this workflow to not use user-controlled data directly in a run block.

See more on https://sonarcloud.io/project/issues?id=GIScience_openrouteservice&issues=AZrgyYFrL86Qldq5IRYX&open=AZrgyYFrL86Qldq5IRYX&pullRequest=2188
- name: Resolve Docker tag (publish arm64)
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_publish_arm64'
id: resolve_tag_2
run: |
echo "tag=${{ inputs.tags_publish_arm64 }}" >> $GITHUB_OUTPUT

Check failure on line 163 in .github/workflows/build-docker-images.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change this workflow to not use user-controlled data directly in a run block.

See more on https://sonarcloud.io/project/issues?id=GIScience_openrouteservice&issues=AZrgXhtTTRkL6bH_PuWz&open=AZrgXhtTTRkL6bH_PuWz&pullRequest=2188
- name: Resolve Docker tag (minimal amd64)
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_minimal_amd64'
id: resolve_tag_3
run: |
echo "tag=${{ inputs.tags_minimal_amd64 }}" >> $GITHUB_OUTPUT

Check failure on line 168 in .github/workflows/build-docker-images.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change this workflow to not use user-controlled data directly in a run block.

See more on https://sonarcloud.io/project/issues?id=GIScience_openrouteservice&issues=AZrgyYFrL86Qldq5IRYY&open=AZrgyYFrL86Qldq5IRYY&pullRequest=2188
- name: Resolve Docker tag (minimal arm64)
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_minimal_arm64'
id: resolve_tag_4
run: |
echo "tag=${{ inputs.tags_minimal_arm64 }}" >> $GITHUB_OUTPUT

Check failure on line 173 in .github/workflows/build-docker-images.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change this workflow to not use user-controlled data directly in a run block.

See more on https://sonarcloud.io/project/issues?id=GIScience_openrouteservice&issues=AZrgyYFrL86Qldq5IRYZ&open=AZrgyYFrL86Qldq5IRYZ&pullRequest=2188

- name: Determine Docker output
if: steps.should_skip.outputs.skip != 'true'
id: output
run: |
if [ "${{ inputs.push }}" == "true" ]; then
echo "output=type=image,push=true" >> $GITHUB_OUTPUT
else
echo "output=type=docker,dest=${{ runner.temp }}/image-${{ matrix.name }}-${{ matrix.image_stage }}.tar" >> $GITHUB_OUTPUT
fi

- name: Build ${{ matrix.image_stage }} image stage for ${{ matrix.name }}
if: steps.should_skip.outputs.skip != 'true'
uses: docker/build-push-action@v6
with:
context: .
build-args: MAVEN_OPTS=-Dmaven.repo.local=/root/.m2/repository
target: ${{ matrix.image_stage }}
push: ${{ inputs.push }}
load: false
tags: ${{ steps.resolve_tag_1.outputs.tag || steps.resolve_tag_2.outputs.tag || steps.resolve_tag_3.outputs.tag || steps.resolve_tag_4.outputs.tag || 'local/openrouteservice:test' }}
platforms: "${{ matrix.platform }}"
cache-from: type=${{ inputs.cache_from_type }}
cache-to: type=${{ inputs.cache_from_type }},mode=max
outputs: ${{ steps.output.outputs.output }}

- name: Upload image artifact
if: steps.should_skip.outputs.skip != 'true' && inputs.push != true
uses: actions/upload-artifact@v4
with:
name: image-${{ matrix.name }}-${{ matrix.image_stage }}-${{ needs.prepare_environment.outputs.dockerfile_hash }}-artifact
path: ${{ runner.temp }}/image-${{ matrix.name }}-${{ matrix.image_stage }}.tar
retention-days: 1
if-no-files-found: error
compression-level: 0
overwrite: true
Loading
Loading