-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(oci): push PR test images to ghcr (#1133)
* ci(mergify): auto-apply safe-to-test label for PRs from reviewers * only run integration tests when safe-to-test label is applied * add CI job to push test image to ghcr.io * fail steps if tests not allowed to run * trigger on more PR event types * fixup! fail steps if tests not allowed to run * tag downloaded artifact with PR before pushing to ghcr * use pull_request_target event for privileged context * only run these actions on PR, not push * update test image message * correcet event names * split PR and push workflows, set concurrency levels * remove redundant curly brace syntax * pr-ci uses reusable * use 'sibling' reusables in same subdirectory/at same ref * correct reusable dependencies * remove unnecessary event type checking * use event repo owner instead of hardcoded * fixup! remove unnecessary event type checking * rename reuse jobs * slim check deps * fixup! rename reuse jobs * move label check into top-level workflow * add owner check to top-level workflows * use action output for registry link in comment * fixup! fixup! rename reuse jobs * update readme CI badge
- Loading branch information
1 parent
62a7f9a
commit 71b1810
Showing
5 changed files
with
130 additions
and
71 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: CI build and push (PR) | ||
|
||
concurrency: | ||
group: pr-${{ github.event.number }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- labeled | ||
- unlabeled | ||
- edited | ||
branches: | ||
- main | ||
- v[0-9]+ | ||
- v[0-9]+.[0-9]+ | ||
- cryostat-v[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/ci-jobs.yml | ||
if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'safe-to-test') | ||
|
||
push-to-ghcr: | ||
runs-on: ubuntu-latest | ||
needs: [build-and-test] | ||
steps: | ||
- name: Fail if safe-to-test label not applied | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'safe-to-test') }} | ||
run: exit 1 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: cryostat | ||
if: github.repository_owner == 'cryostatio' | ||
- name: Load cryostat image | ||
run: podman load -i cryostat.tar | ||
if: github.repository_owner == 'cryostatio' | ||
- name: Tag cryostat image | ||
run: podman tag cryostat ghcr.io/${{ github.repository_owner }}/cryostat:pr-${{ github.event.number }} | ||
if: github.repository_owner == 'cryostatio' | ||
- 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 }} | ||
registry: ghcr.io/${{ github.repository_owner }} | ||
username: ${{ github.event.pull_request.user.login }} | ||
password: ${{ secrets.CI_GHCR_TEST_SECRET }} | ||
if: github.repository_owner == 'cryostatio' | ||
- name: Comment test image link | ||
uses: thollander/actions-comment-pull-request@v1 | ||
with: | ||
message: |- | ||
Test image available: | ||
``` | ||
$ CRYOSTAT_IMAGE=${{ steps.push-to-ghcr.outputs.registry-path }} sh smoketest.sh | ||
``` | ||
if: github.repository_owner == 'cryostatio' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: CI build and push | ||
|
||
concurrency: | ||
group: pr-${{ github.event.number }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- v[0-9]+ | ||
- v[0-9]+.[0-9]+ | ||
- cryostat-v[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/ci-jobs.yml | ||
if: github.repository_owner == 'cryostatio' | ||
push-to-quay: | ||
runs-on: ubuntu-latest | ||
needs: [build-and-test] | ||
env: | ||
CRYOSTAT_IMG: quay.io/cryostat/cryostat | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: cryostat | ||
if: github.repository_owner == 'cryostatio' | ||
- name: Load cryostat image | ||
run: podman load -i cryostat.tar | ||
if: github.repository_owner == 'cryostatio' | ||
- name: Tag images | ||
id: tag-image | ||
env: | ||
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }} | ||
run: | | ||
podman tag $CRYOSTAT_IMG $CRYOSTAT_IMG:$IMAGE_VERSION | ||
if [ "$GITHUB_REF" == "refs/heads/main" ]; then | ||
podman tag \ | ||
${{ env.CRYOSTAT_IMG }}:$IMAGE_VERSION \ | ||
${{ env.CRYOSTAT_IMG }}:latest | ||
echo "::set-output name=tags::$IMAGE_VERSION latest" | ||
else | ||
echo "::set-output name=tags::$IMAGE_VERSION" | ||
fi | ||
if: github.repository_owner == 'cryostatio' | ||
- name: Push to quay.io | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: cryostat | ||
tags: ${{ steps.tag-image.outputs.tags }} | ||
registry: quay.io/cryostat | ||
username: cryostat+bot | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
if: github.repository_owner == 'cryostatio' | ||
- name: Print image URL | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" | ||
if: github.repository_owner == 'cryostatio' |
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
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