Skip to content
Merged
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
67 changes: 53 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
name: build${{ matrix.arch == 'arm64' && ' (arm64)' || '' }}
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7

Expand All @@ -40,7 +49,16 @@ jobs:
# shards inside one launcher process, so the fork boundary and the summary/report
# plumbing are invisible to it; this job is where they break loudly.
coordinated-profile:
runs-on: ubuntu-latest
name: coordinated-profile${{ matrix.arch == 'arm64' && ' (arm64)' || '' }}
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7

Expand Down Expand Up @@ -104,10 +122,24 @@ jobs:
# registry needs -- no PAT. The smoke test boots the actual image: /healthz must answer
# with a secret set, and an unset COORDINATOR_SECRETS must be a refused start.
container-image:
runs-on: ubuntu-latest
name: container-image${{ matrix.arch == 'arm64' && ' (arm64)' || '' }}
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/checkout@v7

Expand All @@ -120,11 +152,20 @@ jobs:
25
cache: maven

- name: Build the coordinator app jar
run: mvn -B -ntp -DskipTests package

- name: Build the image
run: docker build -t shard4j-coordinator-ci shard4j-coordinator
run: mvn -B -ntp -DskipTests package jib:dockerBuild -Djib.to.image=shard4j-coordinator-ci

- name: Check every platform is in the image index
if: matrix.arch == 'amd64'
run: |
mvn -B -ntp -DskipTests package jib:build -Djib.to.image=localhost:5000/shard4j-coordinator:ci \
-Djib.allowInsecureRegistries=true
platforms=$(docker buildx imagetools inspect localhost:5000/shard4j-coordinator:ci \
--format '{{range .Manifest.Manifests}}{{.Platform.OS}}/{{.Platform.Architecture}} {{end}}')
echo "platforms: $platforms"
for p in linux/amd64 linux/arm64 linux/ppc64le linux/s390x; do
case " $platforms " in *" $p "*) ;; *) echo "missing $p" >&2; exit 1 ;; esac
done

- name: Smoke test the image
run: |
Expand Down Expand Up @@ -162,18 +203,16 @@ jobs:
fi

- name: Push to GHCR
if: github.event_name == 'push'
if: github.event_name == 'push' && matrix.arch == 'amd64'
run: |
echo '${{ secrets.GITHUB_TOKEN }}' | docker login ghcr.io -u '${{ github.actor }}' --password-stdin
IMAGE=ghcr.io/${{ github.repository }}
VERSION=$(mvn -B -q help:evaluate -Dexpression=project.version -DforceStdout)
docker tag shard4j-coordinator-ci "$IMAGE:$VERSION"
docker push "$IMAGE:$VERSION"
tags=()
if [ '${{ github.ref }}' = 'refs/heads/main' ]; then
docker tag shard4j-coordinator-ci "$IMAGE:sha-${GITHUB_SHA::12}"
docker push "$IMAGE:sha-${GITHUB_SHA::12}"
tags=(-Djib.to.tags="sha-${GITHUB_SHA::12}")
fi
if [ '${{ github.ref_type }}' = 'tag' ]; then
docker tag shard4j-coordinator-ci "$IMAGE:latest"
docker push "$IMAGE:latest"
tags=(-Djib.to.tags=latest)
fi
mvn -B -ntp -DskipTests package jib:build -Djib.to.image="$IMAGE:$VERSION" "${tags[@]}"
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
<central-publishing-maven-plugin.version>0.11.0</central-publishing-maven-plugin.version>
<jib-maven-plugin.version>3.5.2</jib-maven-plugin.version>
<jib-ownership-extension-maven.version>0.1.0</jib-ownership-extension-maven.version>
<jib.skip>true</jib.skip>
<gpg.keyname>D82FF933653EB8EC483709C77E738F7E2A355AAE</gpg.keyname>

<rewrite-maven-plugin.version>6.46.1</rewrite-maven-plugin.version>
Expand Down Expand Up @@ -213,6 +216,11 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down
23 changes: 0 additions & 23 deletions shard4j-coordinator/Dockerfile

This file was deleted.

76 changes: 76 additions & 0 deletions shard4j-coordinator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
classpath, so it is free to sit on the current LTS. -->
<maven.compiler.release>${coordinator.compiler.release}</maven.compiler.release>
<rewrite.java.recipe>${coordinator.rewrite.java.recipe}</rewrite.java.recipe>
<jib.skip>false</jib.skip>
</properties>

<dependencies>
Expand Down Expand Up @@ -134,6 +135,81 @@
</executions>
</plugin>

<!-- Not bound to a phase: the everyday build stays offline. Jib assembles layers
instead of running RUN steps, so every platform the base image publishes is
a manifest entry, not an emulated build. -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-ownership-extension-maven</artifactId>
<version>${jib-ownership-extension-maven.version}</version>
</dependency>
</dependencies>
<configuration>
<from>
<image>eclipse-temurin:25-jre</image>
<platforms>
<platform>
<architecture>amd64</architecture>
<os>linux</os>
</platform>
<platform>
<architecture>arm64</architecture>
<os>linux</os>
</platform>
<platform>
<architecture>ppc64le</architecture>
<os>linux</os>
</platform>
<platform>
<architecture>s390x</architecture>
<os>linux</os>
</platform>
</platforms>
</from>
<to>
<image>shard4j-coordinator</image>
</to>
<extraDirectories>
<paths>
<path>
<from>src/main/jib</from>
<excludes>data/.keep</excludes>
</path>
</paths>
</extraDirectories>
<pluginExtensions>
<pluginExtension>
<implementation>com.google.cloud.tools.jib.maven.extension.ownership.JibOwnershipExtension</implementation>
<configuration implementation="com.google.cloud.tools.jib.maven.extension.ownership.Configuration">
<rules>
<rule>
<glob>/data</glob>
<ownership>10001:10001</ownership>
</rule>
</rules>
</configuration>
</pluginExtension>
</pluginExtensions>
<container>
<mainClass>com.marvinformatics.shard4j.coordinator.CoordinatorApplication</mainClass>
<user>10001:10001</user>
<ports>
<port>8080</port>
</ports>
<environment>
<COORDINATOR_DATA_DIR>/data</COORDINATOR_DATA_DIR>
</environment>
<volumes>
<volume>/data</volume>
</volumes>
</container>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
Expand Down
Empty file.
Loading