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(ci): Push built CI images to Quay #545

Merged
merged 5 commits into from
Jul 7, 2021
Merged
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
45 changes: 37 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI build
name: CI build and push

on:
push:
Expand All @@ -7,41 +7,47 @@ on:
branches: [ main ]

jobs:
get-core-version:
get-pom-properties:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: query-pom
# Query POM for core version and save as output parameter
name: Get properties from POM
# Query POM for core and image version and save as output parameter
run: |
CORE_VERSION="$(mvn help:evaluate -Dexpression=io.cryostat.core.version -q -DforceStdout)"
echo "::set-output name=core-version::v$CORE_VERSION"
IMAGE_VERSION="$(mvn help:evaluate -Dexpression=cryostat.imageVersion -q -DforceStdout)"
echo "::set-output name=image-version::$IMAGE_VERSION"
outputs:
core-version: ${{ steps.query-pom.outputs.core-version }}
image-version: ${{ steps.query-pom.outputs.image-version }}

build-deps:
runs-on: ubuntu-latest
needs: [get-core-version]
needs: [get-pom-properties]
steps:
- uses: actions/checkout@v2
with:
repository: cryostatio/cryostat-core
ref: ${{ needs.get-core-version.outputs.core-version }}
ref: ${{ needs.get-pom-properties.outputs.core-version }}
- uses: skjolber/maven-cache-github-action@v1
with:
step: restore
- run: mvn -B -U -DskipTests=true clean install
- uses: actions/upload-artifact@v2
with:
name: container-jfr-core
name: cryostat-core
path: /home/runner/.m2/repository/io/cryostat/cryostat-core/
- uses: skjolber/maven-cache-github-action@v1
with:
step: save

build:
runs-on: ubuntu-latest
needs: [build-deps]
needs: [get-pom-properties, build-deps]
env:
CRYOSTAT_IMG: quay.io/cryostat/cryostat
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -55,11 +61,34 @@ jobs:
step: restore
- uses: actions/download-artifact@v2
with:
name: container-jfr-core
name: cryostat-core
path: /home/runner/.m2/repository/io/cryostat/cryostat-core/
- run: git submodule init
- run: git submodule update
- run: mvn -B -U clean verify
- name: Tag images
run: >
podman tag
${{ env.CRYOSTAT_IMG }}:${{ needs.get-pom-properties.outputs.image-version }}
${{ env.CRYOSTAT_IMG }}:${{ github.sha }}
${{ env.CRYOSTAT_IMG }}:latest
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }}
- uses: skjolber/maven-cache-github-action@v1
with:
step: save
- name: Push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: cryostat
tags: >
${{ needs.get-pom-properties.outputs.image-version }}
${{ github.sha }}
latest
registry: quay.io/cryostat
username: cryostat+bot
password: ${{ secrets.REGISTRY_PASSWORD }}
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }}
- name: Print image URL
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }}