Skip to content

Commit

Permalink
ci(container): fixup multiarch build, refactor (cryostatio#437)
Browse files Browse the repository at this point in the history
* ci(multiarch): install qemu

* ci(container): refactor
  • Loading branch information
andrewazores authored Jul 15, 2024
1 parent 8878d38 commit 207f1c6
Showing 1 changed file with 8 additions and 27 deletions.
35 changes: 8 additions & 27 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@ env:
CI_IMG: quay.io/cryostat/cryostat-agent-init

jobs:
build-agent:
build-container:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'cryostatio' }}
outputs:
image-version: ${{ steps.get-agent-version.outputs.agent-version }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- id: get-agent-version
- name: Install qemu
run: |
echo "agent-version=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> $GITHUB_OUTPUT
sudo apt-get update
sudo apt-get install -y qemu-user-static
- uses: actions/setup-java@v4
with:
java-version: '11'
Expand All @@ -43,36 +42,18 @@ jobs:
path: ~/.m2
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}
- run: mvn -B -U clean install

build-container:
needs: [build-agent]
runs-on: ubuntu-latest
env:
agent-version: ${{ needs.build-agent.outputs.image-version }}
name: Build container image
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- id: get-agent-version
run: |
echo "agent-version=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> $GITHUB_OUTPUT
- name: Get date tag
run: echo "DATE_TAG=$(date -uI)" >> "$GITHUB_ENV"
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}
- run: mvn -B -U clean install
- name: Build container images and manifest
id: buildah-build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.CI_IMG }}
archs: amd64, arm64
tags: ${{ env.agent-version }} ${{env.DATE_TAG}} latest
tags: ${{ steps.get-agent-version.outputs.agent-version }} ${{env.DATE_TAG}} latest
containerfiles: |
src/main/container/Dockerfile
- name: Push to quay.io
Expand Down

0 comments on commit 207f1c6

Please sign in to comment.