chore(pf5): upgrade Topology View to Patternfly 5 #2420
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 (PR) | |
concurrency: | |
group: ci-${{ github.run_id }} | |
cancel-in-progress: true | |
on: | |
issue_comment: | |
types: | |
- created | |
env: | |
OPENSUSE_UNOFFICIAL_LIBCONTAINERS_KEY_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/Release.key" | |
OPENSUSE_UNOFFICIAL_LIBCONTAINERS_SOURCE_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04" | |
jobs: | |
check-before-build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
if: 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.issue.labels.*.name, 'needs-triage') }} | |
run: exit 1 | |
- name: Show warning if permission is denied | |
if: | | |
!(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') | |
&& (!contains(github.event.issue.labels.*.name, 'safe-to-test') || github.event.issue.user.name != github.event.comment.user.name) | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: |- | |
You do not have permission to run the /build_test command. Please ask @cryostatio/reviewers | |
to resolve the issue. | |
- name: Fail if command permission is denied | |
if: | | |
!(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') | |
&& (!contains(github.event.issue.labels.*.name, 'safe-to-test') || github.event.issue.user.name != github.event.comment.user.name) | |
run: exit 1 | |
- name: React to comment | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
const {owner, repo} = context.issue | |
github.reactions.createForIssueComment({ | |
owner, | |
repo, | |
comment_id: context.payload.comment.id, | |
content: "+1", | |
}); | |
checkout-branch: | |
runs-on: ubuntu-latest | |
needs: [check-before-build] | |
permissions: | |
pull-requests: read | |
outputs: | |
PR_head_sha: ${{ fromJSON(steps.comment-branch.outputs.result).head_sha }} | |
PR_num: ${{ fromJSON(steps.comment-branch.outputs.result).num }} | |
steps: | |
- uses: actions/github-script@v4 | |
id: comment-branch | |
with: | |
script: | | |
const result = await github.pulls.get ({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
}) | |
return { num: result.data.number, head_sha: result.data.head.sha } | |
build-image-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
pull-requests: write | |
needs: [checkout-branch] | |
env: | |
PR_num: ${{ needs.checkout-branch.outputs.PR_num }} | |
head_sha: ${{ needs.checkout-branch.outputs.PR_head_sha }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: cryostatio/cryostat | |
submodules: true | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: maven | |
- name: Install podman v4 | |
run: | | |
echo "deb $OPENSUSE_UNOFFICIAL_LIBCONTAINERS_SOURCE_URL/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list | |
curl -fsSL $OPENSUSE_UNOFFICIAL_LIBCONTAINERS_KEY_URL | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null | |
sudo apt -y purge podman | |
sudo apt update && sudo apt -y install podman | |
- name: Emulate docker with podman | |
run: | | |
mkdir -p $HOME/.bin | |
cat <(echo '#!/usr/bin/env bash') <(echo 'exec podman "$@"') > $HOME/.bin/docker | |
chmod +x $HOME/.bin/docker | |
echo "PATH=$HOME/.bin:$PATH" >> "$GITHUB_ENV" | |
- name: Start Podman API | |
run: systemctl --user enable --now podman.socket | |
- name: Set DOCKER_HOST environment variable | |
run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV" | |
- name: Build Cryostat application image | |
id: build-cryostat-image | |
run: | | |
git submodule init | |
git submodule update --remote | |
pushd src/main/webui | |
git fetch origin pull/${{ env.PR_num }}/head:pr-${{ env.PR_num }} | |
git checkout pr-${{ env.PR_num }} | |
popd | |
mvn -B -U \ | |
-Dmaven.test.skip=true \ | |
-Dquarkus.container-image.registry=ghcr.io \ | |
-Dquarkus.container-image.group=${{ github.repository_owner }} \ | |
-Dquarkus.container-image.name=cryostat-web \ | |
-Dquarkus.container-image.tag=pr-${{ env.PR_num }}-${{ env.head_sha }} \ | |
clean package | |
podman images | |
- name: Push PR test image to ghcr.io | |
id: push-to-ghcr | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
registry: ghcr.io/${{ github.repository_owner }} | |
image: cryostat-web | |
tags: pr-${{ env.PR_num }}-${{ env.head_sha }} | |
username: ${{ github.event.comment.user.login }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- 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 }} bash smoketest.bash # then open http://localhost:8080 | |
``` | |