build(deps): bump ubi8/openjdk-21-runtime from 1.20-2.1730773767 to 1… #554
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI build and push | |
concurrency: | |
group: ci-${{ github.run_id }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 1' # every Monday at midnight | |
push: | |
branches: | |
- main | |
- v[0-9]+ | |
- 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/cryostat | |
jobs: | |
get-pom-properties: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- id: query-pom | |
name: Get properties from POM | |
# Query POM image version and save as output parameter | |
run: | | |
IMAGE_VERSION="$(mvn -q -DforceStdout validate help:evaluate -Dexpression=quarkus.application.version)" | |
echo "::set-output name=image-version::$IMAGE_VERSION" | |
outputs: | |
image-version: ${{ steps.query-pom.outputs.image-version }} | |
build-and-test: | |
# runs-on: ubuntu-latest | |
runs-on: ubuntu-24.04 | |
needs: [get-pom-properties] | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
env: | |
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }} | |
frontend-cache-name: cache-yarn | |
name: Build and test | |
permissions: | |
packages: write | |
contents: read | |
if: ${{ github.repository_owner == 'cryostatio' }} | |
steps: | |
- name: Install podman 4 and qemu | |
run: | | |
sudo apt update | |
sudo apt -y satisfy "podman (>= 4.0), qemu-user-static" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: 'maven' | |
- run: git submodule init && git submodule update | |
- name: Cache yarn packages and frontend build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
./src/main/webui/.yarn/cache | |
./src/main/webui/.yarn/install-state.gz | |
./src/main/webui/node_modules | |
./src/main/webui/.build_cache | |
key: ${{ runner.os }}-build-${{ env.frontend-cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.frontend-cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Initialize web assets | |
run: | | |
pushd src/main/webui | |
yarn install && yarn yarn:frzinstall | |
popd | |
- name: Build ${{ matrix.arch }} container image | |
id: build-image | |
run: | | |
./mvnw -B -U \ | |
-Dquarkus.container-image.image=${{ env.CI_IMG }}:linux-${{ matrix.arch }} \ | |
-Dquarkus.docker.executable-name=docker \ | |
-Dquarkus.docker.buildx.platform=linux/${{ matrix.arch }} \ | |
-Dbuild.arch=${{ matrix.arch }} \ | |
clean verify | |
- name: Copy docker image to podman | |
run: podman pull docker-daemon:${{ env.CI_IMG }}:linux-${{ matrix.arch }} | |
- name: Save container image | |
run: podman save -o cryostat-${{ matrix.arch }}.tar --format oci-archive ${{ env.CI_IMG }}:linux-${{ matrix.arch }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cryostat-${{ matrix.arch }} | |
path: cryostat-${{ matrix.arch }}.tar | |
publish-manifest: | |
runs-on: ubuntu-latest | |
needs: [get-pom-properties, build-and-test] | |
steps: | |
- name: Download container tarballs | |
uses: actions/download-artifact@v4 | |
with: | |
path: containers | |
pattern: cryostat-* | |
merge-multiple: true | |
- name: Create manifest | |
run: podman manifest create ${{ env.CI_IMG }}:${{ needs.get-pom-properties.outputs.image-version }} | |
- name: Set manifest tags | |
id: manifest-tags | |
run: | | |
TAGS=(${{ needs.get-pom-properties.outputs.image-version }}) | |
if [ '${{ github.ref }}' == 'refs/heads/main' ]; then | |
podman tag ${{ env.CI_IMG }}:${{ needs.get-pom-properties.outputs.image-version }} ${{ env.CI_IMG }}:latest | |
TAGS+=(latest) | |
fi | |
echo "::set-output name=tags::${TAGS[@]}" | |
- name: Import container tarballs | |
run: | | |
find containers -type f -exec podman load -i {} \; | |
for tag in $(podman images --filter label=io.cryostat.component --format '{{ .Tag }}'); do | |
podman manifest add ${{ env.CI_IMG }}:${{ needs.get-pom-properties.outputs.image-version }} containers-storage:${{env.CI_IMG}}:${tag} | |
done | |
- name: Push to quay.io | |
if: github.repository_owner == 'cryostatio' | |
id: push-to-quay | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: cryostat | |
tags: ${{ steps.manifest-tags.outputs.tags }} | |
registry: ${{ env.CI_REGISTRY }} | |
username: ${{ env.CI_USER }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Print image URL | |
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |