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

ci(multiarch): build multiarch JVM mode OCI manifest on push #204

Merged
merged 1 commit into from
Aug 22, 2023
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
11 changes: 3 additions & 8 deletions .github/workflows/pr-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
cache: 'maven'
- run: mvn -B -U clean verify
55 changes: 24 additions & 31 deletions .github/workflows/push-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ on:
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+

env:
CI_USER: cryostat+bot
CI_REGISTRY: quay.io/cryostat
CI_IMG: quay.io/cryostat/jfr-datasource

jobs:
get-pom-properties:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- id: query-pom
name: Get properties from POM
# Query POM for image version and save as output parameter
Expand All @@ -29,46 +34,34 @@ jobs:
runs-on: ubuntu-latest
needs: [get-pom-properties]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: mvn -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.0-java17 clean verify
- run: podman build -f src/main/docker/Dockerfile.native -t "quay.io/cryostat/$IMAGE_NAME:$IMAGE_VERSION" .
distribution: 'temurin'
cache: 'maven'
- name: Build application
run: mvn -B -U clean verify
- name: Build container images and manifest
id: buildah-build
uses: redhat-actions/buildah-build@v2
env:
IMAGE_NAME: ${{ needs.get-pom-properties.outputs.image-name }}
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }}
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }}
- name: Tag images
id: tag-image
env:
IMAGE_NAME: ${{ needs.get-pom-properties.outputs.image-name }}
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }}
run: |
if [ "$GITHUB_REF" == "refs/heads/main" ]; then
podman tag \
quay.io/cryostat/$IMAGE_NAME:$IMAGE_VERSION \
quay.io/cryostat/$IMAGE_NAME:latest
echo "::set-output name=tags::$IMAGE_VERSION latest"
else
echo "::set-output name=tags::$IMAGE_VERSION"
fi
with:
image: ${{ env.CI_IMG }}
archs: amd64, arm64
tags: ${{ env.IMAGE_VERSION }} ${{ github.ref == 'refs/heads/main' && 'latest' || '' }}
containerfiles: |
./src/main/docker/Dockerfile.jvm
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }}
- name: Push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ needs.get-pom-properties.outputs.image-name }}
tags: ${{ steps.tag-image.outputs.tags }}
registry: quay.io/cryostat
username: cryostat+bot
tags: ${{ steps.buildah-build.outputs.tags }}
registry: ${{ env.CI_REGISTRY }}
username: ${{ env.CI_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }}
- name: Print image URL
Expand Down