Skip to content

Commit

Permalink
push to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Oct 2, 2023
1 parent c6392bc commit 840fdb5
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 4 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
with:
step: restore
- run: mvn -B -U clean verify
- uses: actions/upload-artifact@v3
with:
name: cryostat-core
path: /home/runner/work/cryostat-core/cryostat-core/target/cryostat-core-2.24.0-SNAPSHOT.jar
- uses: skjolber/maven-cache-github-action@v1
with:
step: save
Expand All @@ -40,3 +44,71 @@ jobs:
with:
build-arch: ${{ matrix.arch }}
skip-itests: ${{ matrix.arch != 'amd64' }}

push-to-ghcr:
runs-on: ubuntu-latest
needs: [cryostat-test]
strategy:
matrix:
arch: [amd64, arm64]
outputs:
amd64_image: ${{ steps.amd64_image.outputs.image }}
arm64_image: ${{ steps.arm64_image.outputs.image }}
permissions:
packages: write
steps:
- uses: actions/download-artifact@v3
with:
name: cryostat-${{ matrix.arch }}
- name: Load cryostat image
run: podman load -i cryostat-${{ matrix.arch }}.tar
- name: Tag cryostat image
run: podman tag cryostat ghcr.io/${{ github.repository_owner }}/cryostat:pr-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}-linux-${{ matrix.arch }}
- name: Push PR test image to ghcr.io
id: push-to-ghcr
uses: redhat-actions/push-to-registry@v2
with:
image: cryostat
tags: pr-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}-linux-${{ matrix.arch }}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.event.comment.user.login }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store images as output amd64
if: ${{ matrix.arch == 'amd64' }}
id: amd64_image
run: echo "image=${{ steps.push-to-ghcr.outputs.registry-path }}" >> "$GITHUB_OUTPUT"
- name: Store images as output
if: ${{ matrix.arch == 'arm64' }}
id: arm64_image
run: echo "image=${{ steps.push-to-ghcr.outputs.registry-path }}" >> "$GITHUB_OUTPUT"

comment-image:
runs-on: ubuntu-latest
needs: [push-to-ghcr]
env:
amd64_image: ${{ needs.push-to-ghcr.outputs.amd64_image }}
arm64_image: ${{ needs.push-to-ghcr.outputs.arm64_image }}
permissions:
pull-requests: write
steps:
- name: Create markdown table
id: md-table
uses: petems/csv-to-md-table-action@v3.0.0
with:
csvinput: |
ARCH, IMAGE
amd64, ${{ env.amd64_image }}
arm64, ${{ env.arm64_image }}
- uses: thollander/actions-comment-pull-request@v2
with:
message: |-
${{ steps.md-table.outputs.markdown-table }}
To run smoketest:
```
# amd64
CRYOSTAT_IMAGE=${{ env.amd64_image }} sh smoketest.sh
# or arm64
CRYOSTAT_IMAGE=${{ env.arm64_image }} sh smoketest.sh
```
13 changes: 9 additions & 4 deletions .github/workflows/cryostat-IT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
repository: cryostatio/cryostat
repository: ${{ github.repository_owner }}/cryostat
ref: main
- uses: Mudlet/xmlstarlet-action@master
with:
args: ed -P -L -u '//_:properties[_:io.cryostat.core.version="2.23.0"]/_:io.cryostat.core.version' -v "2.24.0-SNAPSHOT" pom.xml
- id: query-pom
name: Get properties from POM
# Query POM for image version and save as output parameter
Expand All @@ -43,8 +46,7 @@ jobs:
- uses: actions/checkout@v4
if: always()
with:
repository: ${{ github.repository_owner }}
name: cryostat
repository: ${{ github.repository_owner }}/cryostat
ref: main
submodules: true
fetch-depth: 0
Expand All @@ -62,6 +64,9 @@ jobs:
step: restore
- run: git submodule init
- run: git submodule update
- uses: actions/download-artifact@v3
with:
name: cryostat-core
- run: mvn -B -U -Dbuild.arch=${{ inputs.build-arch }} clean package
env:
GITHUB_TOKEN_REF: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -87,7 +92,7 @@ jobs:
- uses: actions/checkout@v4
if: always()
with:
repository: cryostatio/cryostat
repository: ${{ github.repository_owner }}/cryostat
ref: main
submodules: true
fetch-depth: 0
Expand Down

0 comments on commit 840fdb5

Please sign in to comment.