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

Gh pr #15

Merged
merged 9 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
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
77 changes: 49 additions & 28 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
name: CI build and push (PR)

concurrency:
group: pr-${{ github.event.number }}
group: ci-${{ github.run_id }}
cancel-in-progress: true

on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
branches:
- main
- v[0-9]+
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+
issue_comment:
types: [created]

jobs:
code-analysis:
uses: ./.github/workflows/ci-code-analysis.yml
runs-on: ubuntu-latest
if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'safe-to-test') && github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test')
steps:
- name: React to comment
uses: actions/github-script@v4
with:
checkout-repo: ${{ github.event.pull_request.head.repo.full_name }}
checkout-ref: ${{ github.event.pull_request.head.ref }}
secrets: inherit
if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'safe-to-test')

script: |
const {owner, repo} = context.issue
github.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "+1",
});
- uses: tspascoal/get-user-teams-membership@v2
id: checkMember
with:
username: ${{ github.actor }}
team: 'cryostat/reviewers'
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Fail if not a Cryostat reviewer
if: ${{ steps.checkMember.outputs.isTeamMember == 'false' }}
run: exit 1
- uses: ./.github/workflows/ci-code-analysis.yml
with:
checkout-repo: ${{ github.event.pull_request.head.repo.full_name }}
checkout-ref: ${{ github.event.pull_request.head.ref }}
secrets: inherit

build-and-test:
strategy:
matrix:
Expand All @@ -38,15 +50,15 @@ jobs:
checkout-ref: ${{ github.event.pull_request.head.ref }}
skip-itests: ${{ matrix.arch != 'amd64' }}
secrets: inherit
if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'safe-to-test')
if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'safe-to-test') && github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') && steps.checkMember.outputs.isTeamMember == 'true'

push-to-ghcr:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
needs: [code-analysis, build-and-test]
if: always() && github.repository_owner == 'cryostatio'
if: always() && github.repository_owner == 'cryostatio' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test')
steps:
- name: Fail if needs-triage label applied
if: ${{ contains(github.event.pull_request.labels.*.name, 'needs-triage') }}
Expand All @@ -57,13 +69,10 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: cryostat-${{ matrix.arch }}
if: github.repository_owner == 'cryostatio'
- name: Load cryostat image
run: podman load -i cryostat-${{ matrix.arch }}.tar
if: github.repository_owner == 'cryostatio'
- 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 }}
if: github.repository_owner == 'cryostatio'
- name: Push PR test image to ghcr.io
id: push-to-ghcr
uses: redhat-actions/push-to-registry@v2
Expand All @@ -73,13 +82,25 @@ jobs:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.event.pull_request.user.login }}
password: ${{ secrets.GHCR_PR_TOKEN }}
if: github.repository_owner == 'cryostatio'
- name: store image amd64
id: amd64_image
outputs:
amd64_image: ${{ steps.push-to-ghcr.outputs.registry-path }}
if: matrix.arch == 'amd64'
- name: store image arm64
id: arm64_image
outputs:
amd64_image: ${{ steps.push-to-ghcr.outputs.registry-path }}
if: matrix.arch == 'arm64'
- name: Comment test image link
uses: thollander/actions-comment-pull-request@v1
with:
message: |-
Test image available:
arm64 test image available:
```
$ CRYOSTAT_IMAGE=${{ steps.amd64_image.outputs.amd64_image }} sh smoketest.sh
```
$ CRYOSTAT_IMAGE=${{ steps.push-to-ghcr.outputs.registry-path }} sh smoketest.sh
amd64 test image available:
```
if: github.repository_owner == 'cryostatio'
$ CRYOSTAT_IMAGE=${{ steps.arm64_image.outputs.arm64_image }} sh smoketest.sh
```
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,5 @@ but is also intended as an automation or extension point for external clients.
For details about this API see [HTTP_API.md](./docs/HTTP_API.md),
[GRAPHQL.md](./docs/GRAPHQL.md), and
[DISCOVERY_PLUGINS.md](./docs/DISCOVERY_PLUGINS.md).

**delete later**
Loading