diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index 09c18f24d5..3edfe81a6e 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -1,3 +1,5 @@ +name: build cryostat image + on: workflow_call: inputs: @@ -10,10 +12,6 @@ on: build-arch: required: true type: string - skip-itests: - required: false - type: boolean - default: false outputs: image-version: description: the Cryostat application version that will be built @@ -42,6 +40,8 @@ jobs: build-image: runs-on: ubuntu-latest + permissions: + pull-requests: write needs: [get-pom-properties] steps: - name: Install qemu @@ -51,7 +51,6 @@ jobs: sudo apt-get update sudo apt-get install -y qemu-user-static - uses: actions/checkout@v4 - if: always() with: repository: ${{ inputs.checkout-repo }} ref: ${{ inputs.checkout-ref }} @@ -64,8 +63,13 @@ jobs: - name: maven-settings uses: s4u/maven-settings-action@v2 with: - servers: '[{"id": "github", "username": "dummy", "password": "${env.GITHUB_TOKEN_REF}"}]' - githubServer: false + githubServer: true + - name: ghcr login + uses: redhat-actions/podman-login@v1 + with: + registry: ghcr.io/${{ github.repository_owner }} + username: ${{ github.event.comment.user.login }} + password: ${{ secrets.GITHUB_TOKEN }} - uses: skjolber/maven-cache-github-action@v1 with: step: restore @@ -83,49 +87,3 @@ jobs: - uses: skjolber/maven-cache-github-action@v1 with: step: save - - integration-tests: - runs-on: ubuntu-latest - needs: [build-image] - if: ${{ ! inputs.skip-itests }} - steps: - - name: Install xpath - run: | - sudo apt-get update - sudo apt-get install -y libxml-xpath-perl - - name: Install qemu - if: ${{ inputs.build-arch != 'amd64' }} - continue-on-error: true - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static - - uses: actions/checkout@v4 - if: always() - with: - repository: ${{ inputs.checkout-repo }} - ref: ${{ inputs.checkout-ref }} - submodules: true - fetch-depth: 0 - - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - uses: actions/download-artifact@v3 - with: - name: cryostat-${{ inputs.build-arch }} - - name: Load cryostat image - run: podman load -i cryostat-${{ inputs.build-arch }}.tar - - uses: skjolber/maven-cache-github-action@v1 - with: - step: restore - - name: Run integration tests - run: POD_NAME=cryostat-itests CONTAINER_NAME=cryostat-itest ITEST_IMG_VERSION=latest bash repeated-integration-tests.bash - - name: Print itest logs - if: failure() - run: ls -1dt target/cryostat-itest-*.log | head -n1 | xargs cat - - name: Print itest container logs - if: failure() - run: ls -1dt target/cryostat-*.server.log | head -n1 | xargs cat - - uses: skjolber/maven-cache-github-action@v1 - with: - step: save diff --git a/.github/workflows/integrated-test.yml b/.github/workflows/integrated-test.yml new file mode 100644 index 0000000000..73ee420886 --- /dev/null +++ b/.github/workflows/integrated-test.yml @@ -0,0 +1,79 @@ +name: Retest Integrated Tests + +on: + workflow_call: + inputs: + checkout-repo: + required: false + type: string + checkout-ref: + required: false + type: string + build-arch: + required: true + type: string + pr-number: + required: false + type: string + sha-value: + required: false + type: string + skip-itests: + required: false + type: boolean + default: false + +permissions: + contents: read + packages: read + + +jobs: + integration-tests: #test + runs-on: ubuntu-latest + if: ${{ !inputs.skip-itests }} + steps: + - name: Install xpath + run: | + sudo apt-get update + sudo apt-get install -y libxml-xpath-perl + - name: Install qemu + if: ${{ inputs.build-arch != 'amd64' }} + continue-on-error: true + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + - uses: actions/checkout@v4 + with: + repository: ${{ inputs.checkout-repo }} + ref: ${{ inputs.checkout-ref }} + submodules: true + fetch-depth: 0 + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: maven-settings + uses: s4u/maven-settings-action@v2 + with: + githubServer: true + - name: ghcr login + uses: redhat-actions/podman-login@v1 + with: + registry: ghcr.io/${{ github.repository_owner }} + username: ${{ github.event.comment.user.login }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Pull cryostat image + run: podman pull ghcr.io/${{ github.repository_owner }}/cryostat:pr-${{ inputs.pr-number }}-${{ inputs.sha-value }}-linux-${{ inputs.build-arch }} + - name: retag image as quay + run: podman tag ghcr.io/${{ github.repository_owner }}/cryostat:pr-${{ inputs.pr-number }}-${{ inputs.sha-value }}-linux-${{ inputs.build-arch}} quay.io/cryostat/cryostat + - name: Run integration tests + run: POD_NAME=cryostat-itests CONTAINER_NAME=cryostat-itest ITEST_IMG_VERSION=latest bash repeated-integration-tests.bash + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Print itest logs + if: failure() + run: ls -1dt target/cryostat-itest-*.log | head -n1 | xargs cat + - name: Print itest container logs + if: failure() + run: ls -1dt target/cryostat-*.server.log | head -n1 | xargs catyea diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index d32dc2a23a..aa840152ca 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -12,11 +12,11 @@ on: jobs: check-before-build: runs-on: ubuntu-latest - if: github.repository_owner == 'cryostatio' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') + if: github.event.issue.pull_request && (startsWith(github.event.comment.body, '/build_test') || startsWith(github.event.comment.body, '/retest')) permissions: pull-requests: write steps: - - name: Fail if needs-triage label applied + - 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 @@ -43,12 +43,12 @@ jobs: repo, comment_id: context.payload.comment.id, content: "+1", - }); + }); - checkout-branch: + checkout-branch: runs-on: ubuntu-latest needs: [check-before-build] - outputs: + outputs: PR_head_ref: ${{ fromJSON(steps.comment-branch.outputs.result).ref }} PR_head_sha: ${{ fromJSON(steps.comment-branch.outputs.result).sha }} PR_num: ${{ fromJSON(steps.comment-branch.outputs.result).num }} @@ -69,13 +69,33 @@ jobs: code-analysis: needs: [checkout-branch] + if: startsWith(github.event.comment.body, '/build_test') uses: ./.github/workflows/ci-code-analysis.yml with: checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} - - build-and-test: - needs: [code-analysis, checkout-branch] + + start-comment: + runs-on: ubuntu-latest + needs: [check-before-build] + steps: + - name: Leave Actions Run Comment + uses: actions/github-script@v6 + with: + script: | + const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`; + const currentTime = new Date().toLocaleString('en-US', { timeZone: 'America/Toronto' }); + const commentBody = `Workflow started at ${currentTime}. [View Actions Run](${runURL}).`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }); + + build-image: + needs: [checkout-branch] + if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') strategy: matrix: arch: [amd64, arm64] @@ -84,15 +104,14 @@ jobs: build-arch: ${{ matrix.arch }} checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} - skip-itests: ${{ matrix.arch != 'amd64' }} push-to-ghcr: runs-on: ubuntu-latest - needs: [build-and-test, checkout-branch] + needs: [checkout-branch, build-image] strategy: matrix: arch: [amd64, arm64] - outputs: + outputs: amd64_image: ${{ steps.amd64_image.outputs.image }} arm64_image: ${{ steps.arm64_image.outputs.image }} env: @@ -138,7 +157,7 @@ jobs: - name: Create markdown table id: md-table uses: petems/csv-to-md-table-action@v3.0.0 - with: + with: csvinput: | ARCH, IMAGE amd64, ${{ env.amd64_image }} @@ -150,9 +169,68 @@ jobs: To run smoketest: ``` - # amd64 + # amd64 CRYOSTAT_IMAGE=${{ env.amd64_image }} sh smoketest.sh # or arm64 CRYOSTAT_IMAGE=${{ env.arm64_image }} sh smoketest.sh ``` + + integration-test: + needs: [checkout-branch, push-to-ghcr] + strategy: + matrix: + arch: [amd64, arm64] + uses: ./.github/workflows/integrated-test.yml + with: + build-arch: ${{ matrix.arch }} + pr-number: ${{ github.event.issue.number }} + sha-value: ${{ needs.checkout-branch.outputs.PR_head_sha }} + skip-itests: ${{ matrix.arch == 'arm64' }} + + retest-integration: + needs: [checkout-branch] + if: contains(github.event.comment.body, '/retest') + strategy: + matrix: + arch: [amd64, arm64] + uses: ./.github/workflows/integrated-test.yml + with: + build-arch: ${{ matrix.arch }} + pr-number: ${{ github.event.issue.number }} + sha-value: ${{ needs.checkout-branch.outputs.PR_head_sha }} + skip-itests: ${{ matrix.arch == 'arm64' }} + + integration-test-pass: + runs-on: ubuntu-latest + needs: [integration-test] + steps: + - name: Leave Actions Run Comment + uses: actions/github-script@v6 + with: + script: | + const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`; + const commentBody = both build and itest completed successfully ✅. \n[View Actions Run](${runURL}).`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }); + + retest-integration-pass: + runs-on: ubuntu-latest + needs: [retest-integration] + steps: + - name: Leave Actions Run Comment + uses: actions/github-script@v6 + with: + script: | + const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`; + const commentBody = `retest Integration: All tests pass ✅. \n[View Actions Run](${runURL}).`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }); diff --git a/pom.xml b/pom.xml index 5c93e74235..7c55fb830c 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 1.0.27 3.11.0 - 3.1.2 + 3.2.1 ${org.apache.maven.plugins.surefire.version} 3.12.1 3.4.5 @@ -78,7 +78,7 @@ 3.1.0 3.4.0 4.3 - 8.4.0 + 8.4.2 3.4.0 diff --git a/src/container/Dockerfile b/src/container/Dockerfile index e81325b476..b47c0942f0 100644 --- a/src/container/Dockerfile +++ b/src/container/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.17-1.1696520331 +FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.17-2 USER root diff --git a/web-client b/web-client index ba88f71036..a011a5dee6 160000 --- a/web-client +++ b/web-client @@ -1 +1 @@ -Subproject commit ba88f7103606a377c56a03696f441c06bdcc4672 +Subproject commit a011a5dee63c7a95c3367daa595f8710fcee6690