From 3285a1630d6e663b9660365528c0daeafd1cb171 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 09:30:36 -0400 Subject: [PATCH 01/25] build(deps): bump ubi8/openjdk-17-runtime in /src/container (#1733) Bumps ubi8/openjdk-17-runtime from 1.17-1.1696520331 to 1.17-2. --- updated-dependencies: - dependency-name: ubi8/openjdk-17-runtime dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/container/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 3a650bea1c268cd438589c69bc28ac77680186b5 Mon Sep 17 00:00:00 2001 From: Cryostat CI Date: Fri, 20 Oct 2023 13:48:19 +0000 Subject: [PATCH 02/25] build(web-client): update submodule to 9ec90e1 --- web-client | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-client b/web-client index ba88f71036..9ec90e1d06 160000 --- a/web-client +++ b/web-client @@ -1 +1 @@ -Subproject commit ba88f7103606a377c56a03696f441c06bdcc4672 +Subproject commit 9ec90e1d06a5fa2c1aa08b099f547cbdd7221fa5 From 5602cf9fe9673bb42226668dc816d09150cc9263 Mon Sep 17 00:00:00 2001 From: Cryostat CI Date: Fri, 20 Oct 2023 14:10:32 +0000 Subject: [PATCH 03/25] build(web-client): update submodule to 1f32dea --- web-client | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-client b/web-client index 9ec90e1d06..1f32deabfa 160000 --- a/web-client +++ b/web-client @@ -1 +1 @@ -Subproject commit 9ec90e1d06a5fa2c1aa08b099f547cbdd7221fa5 +Subproject commit 1f32deabfa5f5bd769c88a087dd8e34e691d1da3 From 13101c34219fee6cb00dfd9bd7addc9af54a7785 Mon Sep 17 00:00:00 2001 From: Cryostat CI Date: Mon, 23 Oct 2023 19:17:45 +0000 Subject: [PATCH 04/25] build(web-client): update submodule to 316e9c7 --- web-client | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-client b/web-client index 1f32deabfa..316e9c7cb8 160000 --- a/web-client +++ b/web-client @@ -1 +1 @@ -Subproject commit 1f32deabfa5f5bd769c88a087dd8e34e691d1da3 +Subproject commit 316e9c7cb8c27b125a23a80b95e3e0fd25faa9c1 From 89a64d7556513e6cff8fee89be2945e2987b1d98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 10:04:06 -0400 Subject: [PATCH 05/25] build(deps): bump org.apache.maven.plugins:maven-surefire-plugin (#1740) Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.1.2 to 3.2.1. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.1.2...surefire-3.2.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5c93e74235..76d287e8d5 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 From fd2b69a3f4f893a79f3626cee845ae5c9d81b9a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 10:09:10 -0400 Subject: [PATCH 06/25] build(deps): bump org.owasp:dependency-check-maven from 8.4.0 to 8.4.2 (#1737) Bumps [org.owasp:dependency-check-maven](https://github.com/jeremylong/DependencyCheck) from 8.4.0 to 8.4.2. - [Release notes](https://github.com/jeremylong/DependencyCheck/releases) - [Changelog](https://github.com/jeremylong/DependencyCheck/blob/main/CHANGELOG.md) - [Commits](https://github.com/jeremylong/DependencyCheck/compare/v8.4.0...v8.4.2) --- updated-dependencies: - dependency-name: org.owasp:dependency-check-maven dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76d287e8d5..7c55fb830c 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ 3.1.0 3.4.0 4.3 - 8.4.0 + 8.4.2 3.4.0 From a42fe3f245843c10657ed62e4ff8f2dbbb398da3 Mon Sep 17 00:00:00 2001 From: Cryostat CI Date: Tue, 24 Oct 2023 20:29:28 +0000 Subject: [PATCH 07/25] build(web-client): update submodule to a011a5d --- web-client | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-client b/web-client index 316e9c7cb8..a011a5dee6 160000 --- a/web-client +++ b/web-client @@ -1 +1 @@ -Subproject commit 316e9c7cb8c27b125a23a80b95e3e0fd25faa9c1 +Subproject commit a011a5dee63c7a95c3367daa595f8710fcee6690 From 6a3b4f44264a509ac645cd97dd94be1ade3ed20d Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 31 Aug 2023 12:43:43 -0400 Subject: [PATCH 08/25] added new workflow file for removing label part --- .../workflows/pr-remove-request-review.yml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/pr-remove-request-review.yml diff --git a/.github/workflows/pr-remove-request-review.yml b/.github/workflows/pr-remove-request-review.yml new file mode 100644 index 0000000000..22c6936ddc --- /dev/null +++ b/.github/workflows/pr-remove-request-review.yml @@ -0,0 +1,25 @@ +name: Remove Review Label + +on: + pull_request_review: + types: [edited, dismissed] + +jobs: + remove-review-label: + runs-on: ubuntu-latest + permissions: + pull-requests: write + + if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'review-requested') + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Remove label + run: | + pr_number=${{ github.event.pull_request.number }} + echo "Removing 'review-requested' label from the PR" + gh pr edit $pr_number --remove-label "review-requested" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fbd9731a9452d29e10d30cca143ef926eda3c13c Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 1 Sep 2023 11:53:16 -0400 Subject: [PATCH 09/25] apply fixes --- .github/workflows/pr-remove-request-review.yml | 2 +- .github/workflows/pr-request-review.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-remove-request-review.yml b/.github/workflows/pr-remove-request-review.yml index 22c6936ddc..cac197fd47 100644 --- a/.github/workflows/pr-remove-request-review.yml +++ b/.github/workflows/pr-remove-request-review.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write - if: github.repository_owner == 'cryostatio' && contains(github.event.pull_request.labels.*.name, 'review-requested') + if: contains(github.event.pull_request.labels.*.name, 'review-requested') steps: - name: Checkout code diff --git a/.github/workflows/pr-request-review.yml b/.github/workflows/pr-request-review.yml index 79e561feb5..049e65f901 100644 --- a/.github/workflows/pr-request-review.yml +++ b/.github/workflows/pr-request-review.yml @@ -12,7 +12,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} permissions: pull-requests: write - if: github.repository_owner == 'cryostatio' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/request_review') + if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/request_review') steps: - run: | # Adding label 'review-requested' to the PR. Mergify will add reviewers. From ef8546cc0218e330b1a1d5af750fc314abbbeb73 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 1 Sep 2023 13:40:45 -0400 Subject: [PATCH 10/25] test25 --- .github/workflows/pr-remove-request-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-remove-request-review.yml b/.github/workflows/pr-remove-request-review.yml index cac197fd47..a6dc25db3c 100644 --- a/.github/workflows/pr-remove-request-review.yml +++ b/.github/workflows/pr-remove-request-review.yml @@ -2,7 +2,7 @@ name: Remove Review Label on: pull_request_review: - types: [edited, dismissed] + types: [submitted, edited, dismissed] jobs: remove-review-label: From 4178f172135fa1ad9e3e09a146dac0be7d9c679c Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Wed, 20 Sep 2023 13:27:52 -0400 Subject: [PATCH 11/25] update --- .../workflows/pr-remove-request-review.yml | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/workflows/pr-remove-request-review.yml diff --git a/.github/workflows/pr-remove-request-review.yml b/.github/workflows/pr-remove-request-review.yml deleted file mode 100644 index a6dc25db3c..0000000000 --- a/.github/workflows/pr-remove-request-review.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Remove Review Label - -on: - pull_request_review: - types: [submitted, edited, dismissed] - -jobs: - remove-review-label: - runs-on: ubuntu-latest - permissions: - pull-requests: write - - if: contains(github.event.pull_request.labels.*.name, 'review-requested') - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Remove label - run: | - pr_number=${{ github.event.pull_request.number }} - echo "Removing 'review-requested' label from the PR" - gh pr edit $pr_number --remove-label "review-requested" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 916477bcbe18a16112712bbcae34c1cdf26671db Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 22 Sep 2023 13:30:50 -0400 Subject: [PATCH 12/25] build_test command enhancements --- .github/workflows/pr-ci.yml | 73 +++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index d32dc2a23a..e6d3fcebcd 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.repository_owner == 'cryostatio' && 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 }} @@ -73,9 +73,42 @@ jobs: with: checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} + + start-comment: + runs-on: ubuntu-latest + steps: + - name: Capture Date and Time + id: date-time + run: echo "::set-output name=date-time::$(date +'%Y-%m-%d %H:%M:%S')" + - name: Start Comment + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + Workflow started at ${{steps.date-time.outputs.date-time}}. build-and-test: needs: [code-analysis, checkout-branch] + strategy: + matrix: + arch: [amd64, arm64] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: build-test + uses: ./.github/workflows/ci-build-image.yml + with: + 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' }} + - name: Set BUILD_TEST_EXECUTED flag + id: set-build-test-executed + run: echo "BUILD_TEST_EXECUTED=true" >> $GITHUB_ENV + + retest-integration: + needs: [code-analysis, checkout-branch, build-and-test] + if: startsWith(github.event.comment.body, '/retest') && env.BUILD_TEST_EXECUTED == 'true' strategy: matrix: arch: [amd64, arm64] @@ -85,6 +118,30 @@ jobs: checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} skip-itests: ${{ matrix.arch != 'amd64' }} + + check-test-results: + runs-on: ubuntu-latest + needs: [build-and-test] + steps: + - name: Check Test Results + id: check-results + run: | + if [ ... ]; then + echo "Tests passed." + echo "::set-output name=test-status::success" + else + echo "Tests failed." + echo "::set-output name=test-status::failure" + continue-on-error: true + - name: Capture Date and Time + id: date-time + run: echo "::set-output name=date-time::$(date +'%Y-%m-%d %H:%M:%S')" + - name: Comment on PR + if: ${{ always() }} + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + Tests status: ${{ steps.check-results.outputs.test-status }} at ${{ steps.date-time.outputs.date-time }}. push-to-ghcr: runs-on: ubuntu-latest @@ -92,7 +149,7 @@ jobs: strategy: matrix: arch: [amd64, arm64] - outputs: + outputs: amd64_image: ${{ steps.amd64_image.outputs.image }} arm64_image: ${{ steps.arm64_image.outputs.image }} env: @@ -138,7 +195,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,7 +207,7 @@ jobs: To run smoketest: ``` - # amd64 + # amd64 CRYOSTAT_IMAGE=${{ env.amd64_image }} sh smoketest.sh # or arm64 From afd3c17ecbe782756fe7e3b34677699639bc519e Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Mon, 25 Sep 2023 17:48:39 -0400 Subject: [PATCH 13/25] resolved issues --- .github/workflows/ci-build-image.yml | 3 +++ .github/workflows/pr-ci.yml | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index 09c18f24d5..360f4e8d47 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -14,6 +14,9 @@ on: required: false type: boolean default: false + run-tests-only: + type: boolean + default: false outputs: image-version: description: the Cryostat application version that will be built diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index e6d3fcebcd..a903803834 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -76,6 +76,8 @@ jobs: start-comment: runs-on: ubuntu-latest + needs: [check-before-build] + if: ${{ needs.check-before-build.output.result == 'success' }} steps: - name: Capture Date and Time id: date-time @@ -85,9 +87,11 @@ jobs: with: message: | Workflow started at ${{steps.date-time.outputs.date-time}}. + Workflow run [Link](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}). + build-and-test: - needs: [code-analysis, checkout-branch] + needs: [checkout-branch] strategy: matrix: arch: [amd64, arm64] @@ -102,6 +106,7 @@ jobs: checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} skip-itests: ${{ matrix.arch != 'amd64' }} + run-tests-only: true - name: Set BUILD_TEST_EXECUTED flag id: set-build-test-executed run: echo "BUILD_TEST_EXECUTED=true" >> $GITHUB_ENV @@ -118,6 +123,7 @@ jobs: checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} skip-itests: ${{ matrix.arch != 'amd64' }} + run-tests-only: true check-test-results: runs-on: ubuntu-latest @@ -126,7 +132,7 @@ jobs: - name: Check Test Results id: check-results run: | - if [ ... ]; then + if [$? -eq 0]; then echo "Tests passed." echo "::set-output name=test-status::success" else From 6f6a9a81247e17f7a729790b00beb98dd1f50276 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 10 Oct 2023 15:58:45 -0400 Subject: [PATCH 14/25] added separate itest --- .github/workflows/ci-build-image.yml | 57 +++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index 360f4e8d47..c24cea936c 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -15,6 +15,7 @@ on: type: boolean default: false run-tests-only: + required: false type: boolean default: false outputs: @@ -22,10 +23,6 @@ on: description: the Cryostat application version that will be built value: ${{ jobs.get-pom-properties.outputs.image-version }} -permissions: - contents: read - packages: read - jobs: get-pom-properties: runs-on: ubuntu-latest @@ -45,6 +42,7 @@ jobs: build-image: runs-on: ubuntu-latest + if: ${{ !inputs.run-tests-only }} needs: [get-pom-properties] steps: - name: Install qemu @@ -74,6 +72,7 @@ jobs: step: restore - run: git submodule init - run: git submodule update + if: ${{ !inputs.run-tests-only }} - run: mvn -B -U -Dbuild.arch=${{ inputs.build-arch }} clean package env: GITHUB_TOKEN_REF: ${{ secrets.GITHUB_TOKEN }} @@ -90,7 +89,7 @@ jobs: integration-tests: runs-on: ubuntu-latest needs: [build-image] - if: ${{ ! inputs.skip-itests }} + if: ${{ !inputs.skip-itests && !inputs.run-tests-only }} steps: - name: Install xpath run: | @@ -132,3 +131,51 @@ jobs: - uses: skjolber/maven-cache-github-action@v1 with: step: save + + retest-integration-test: + runs-on: ubuntu-latest + if: ${{ inputs.run-tests-only && !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' + - name: Download Cryostat Image Artifact + 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 with the loaded image + 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 + From e1e531ca3e8c32cc51aa4fe260497cc2991f463d Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 10 Oct 2023 16:40:25 -0400 Subject: [PATCH 15/25] added separate itest for /retest --- .github/workflows/pr-ci.yml | 116 ++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 53 deletions(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index a903803834..8ce38a4a69 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -12,7 +12,7 @@ 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') || startsWith(github.event.comment.body, '/retest')) + if: github.event.issue.pull_request && (startsWith(github.event.comment.body, '/build_test') || startsWith(github.event.comment.body, '/retest')) permissions: pull-requests: write steps: @@ -73,47 +73,23 @@ jobs: with: checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} - - start-comment: - runs-on: ubuntu-latest - needs: [check-before-build] - if: ${{ needs.check-before-build.output.result == 'success' }} - steps: - - name: Capture Date and Time - id: date-time - run: echo "::set-output name=date-time::$(date +'%Y-%m-%d %H:%M:%S')" - - name: Start Comment - uses: thollander/actions-comment-pull-request@v2 - with: - message: | - Workflow started at ${{steps.date-time.outputs.date-time}}. - Workflow run [Link](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}). - build-and-test: - needs: [checkout-branch] + needs: [code-analysis, checkout-branch] + if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') strategy: matrix: arch: [amd64, arm64] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: build-test - uses: ./.github/workflows/ci-build-image.yml - with: - 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' }} - run-tests-only: true - - name: Set BUILD_TEST_EXECUTED flag - id: set-build-test-executed - run: echo "BUILD_TEST_EXECUTED=true" >> $GITHUB_ENV + uses: ./.github/workflows/ci-build-image.yml + with: + 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' }} retest-integration: - needs: [code-analysis, checkout-branch, build-and-test] - if: startsWith(github.event.comment.body, '/retest') && env.BUILD_TEST_EXECUTED == 'true' + needs: [checkout-branch] + if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/retest') strategy: matrix: arch: [amd64, arm64] @@ -124,33 +100,66 @@ jobs: checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} skip-itests: ${{ matrix.arch != 'amd64' }} run-tests-only: true - + + start-comment: + runs-on: ubuntu-latest + needs: [check-before-build] + if: ${{ needs.check-before-build.result == 'success' }} + 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 + }); + check-test-results: + if: ${{ needs.build-and-test.result == 'success' || needs.retest-integration.result == 'success' }} runs-on: ubuntu-latest - needs: [build-and-test] + needs: [build-and-test, retest-integration] steps: - name: Check Test Results id: check-results run: | - if [$? -eq 0]; then - echo "Tests passed." - echo "::set-output name=test-status::success" - else - echo "Tests failed." - echo "::set-output name=test-status::failure" - continue-on-error: true - - name: Capture Date and Time - id: date-time - run: echo "::set-output name=date-time::$(date +'%Y-%m-%d %H:%M:%S')" - - name: Comment on PR - if: ${{ always() }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: | - Tests status: ${{ steps.check-results.outputs.test-status }} at ${{ steps.date-time.outputs.date-time }}. + echo "All tests passed." + echo "::set-output name=test-status::success" + - name: Check Test Results Failure + if: failure() + id: check-results-failure + run: | + echo "At least one test has failed." + echo "::set-output name=test-status::failure" + continue-on-error: true + + leave-test-status-comment: + if: ${{ needs.check-test-results.result == 'success' }} + runs-on: ubuntu-latest + needs: [check-test-results] + steps: + - name: Leave Test Status Comment + uses: actions/github-script@v6 + with: + script: | + const testStatus = "${{ needs.check-test-results.test-status }}"; + const currentTime = new Date().toLocaleString('en-US', { timeZone: 'America/Toronto' }); + const commentBody = `Tests status: ${testStatus} at ${currentTime}.`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }); push-to-ghcr: runs-on: ubuntu-latest + if: startsWith(github.event.comment.body, '/build_test') needs: [build-and-test, checkout-branch] strategy: matrix: @@ -191,6 +200,7 @@ jobs: comment-image: runs-on: ubuntu-latest + if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') needs: [push-to-ghcr] env: amd64_image: ${{ needs.push-to-ghcr.outputs.amd64_image }} From 502372b30978e211b25fba5cd9b0107f1150e120 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 10 Oct 2023 16:47:37 -0400 Subject: [PATCH 16/25] returned pr-request-review.yml to its original state --- .github/workflows/pr-request-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-request-review.yml b/.github/workflows/pr-request-review.yml index 049e65f901..79e561feb5 100644 --- a/.github/workflows/pr-request-review.yml +++ b/.github/workflows/pr-request-review.yml @@ -12,7 +12,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} permissions: pull-requests: write - if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/request_review') + if: github.repository_owner == 'cryostatio' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/request_review') steps: - run: | # Adding label 'review-requested' to the PR. Mergify will add reviewers. From 8fdf8de8ba4a1132284ca9460d5ddd7bab49da21 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 10 Oct 2023 16:55:51 -0400 Subject: [PATCH 17/25] added owner --- .github/workflows/pr-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 8ce38a4a69..3b611acae0 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -12,7 +12,7 @@ on: jobs: check-before-build: runs-on: ubuntu-latest - if: github.event.issue.pull_request && (startsWith(github.event.comment.body, '/build_test') || startsWith(github.event.comment.body, '/retest')) + if: github.repository_owner == 'cryostatio' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '/build_test') || startsWith(github.event.comment.body, '/retest')) permissions: pull-requests: write steps: From 2bf2f1cc26c98920754810b905c9c635aeb9d457 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Wed, 11 Oct 2023 11:23:44 -0400 Subject: [PATCH 18/25] edited workflow to load image that was built --- .github/workflows/ci-build-image.yml | 4 ---- .github/workflows/pr-ci.yml | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index c24cea936c..70a2a0d563 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -72,7 +72,6 @@ jobs: step: restore - run: git submodule init - run: git submodule update - if: ${{ !inputs.run-tests-only }} - run: mvn -B -U -Dbuild.arch=${{ inputs.build-arch }} clean package env: GITHUB_TOKEN_REF: ${{ secrets.GITHUB_TOKEN }} @@ -112,9 +111,6 @@ jobs: 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 diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 3b611acae0..2c695b26e4 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -121,7 +121,7 @@ jobs: }); check-test-results: - if: ${{ needs.build-and-test.result == 'success' || needs.retest-integration.result == 'success' }} + if: ${{ success(needs.build-and-test) || success(needs.retest-integration) }} runs-on: ubuntu-latest needs: [build-and-test, retest-integration] steps: @@ -139,7 +139,6 @@ jobs: continue-on-error: true leave-test-status-comment: - if: ${{ needs.check-test-results.result == 'success' }} runs-on: ubuntu-latest needs: [check-test-results] steps: @@ -147,9 +146,9 @@ jobs: uses: actions/github-script@v6 with: script: | - const testStatus = "${{ needs.check-test-results.test-status }}"; const currentTime = new Date().toLocaleString('en-US', { timeZone: 'America/Toronto' }); - const commentBody = `Tests status: ${testStatus} at ${currentTime}.`; + const testStatus = "${{ needs.check-test-results.outputs.test-status }}"; + const commentBody = `Tests status: ${test-status } ${currentTime}.`; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, From 7e4cf64b01b00aefd1c5f732a9f6f62bdd85074b Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Wed, 11 Oct 2023 13:04:29 -0400 Subject: [PATCH 19/25] testing --- .github/workflows/ci-build-image.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index 70a2a0d563..c5f81bdf78 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -23,6 +23,10 @@ on: description: the Cryostat application version that will be built value: ${{ jobs.get-pom-properties.outputs.image-version }} +permissions: + contents: read + packages: read + jobs: get-pom-properties: runs-on: ubuntu-latest @@ -111,6 +115,10 @@ jobs: with: java-version: '17' distribution: 'temurin' + - name: Download Cryostat Image Artifact + 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 @@ -130,7 +138,7 @@ jobs: retest-integration-test: runs-on: ubuntu-latest - if: ${{ inputs.run-tests-only && !inputs.skip-itests }} + if: ${{ inputs.run-tests-only && !inputs.skip-itests}} steps: - name: Install xpath run: | @@ -153,10 +161,6 @@ jobs: with: java-version: '17' distribution: 'temurin' - - name: Download Cryostat Image Artifact - 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 From c5d58eedbb9ace12df8401e718b1f243404d9961 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 13 Oct 2023 17:01:41 -0400 Subject: [PATCH 20/25] added test pass and retest job --- .github/workflows/ci-build-image.yml | 73 ++++++++++++++-------------- .github/workflows/pr-ci.yml | 54 ++++++++++---------- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index c5f81bdf78..f47b9867b6 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -18,6 +18,12 @@ on: required: false type: boolean default: false + pr-number: + required: false + type: string + sha-value: + required: false + type: string outputs: image-version: description: the Cryostat application version that will be built @@ -136,46 +142,39 @@ jobs: with: step: save - retest-integration-test: + retest-integration-tests: runs-on: ubuntu-latest - if: ${{ inputs.run-tests-only && !inputs.skip-itests}} + if: ${{ !inputs.skip-itests && inputs.run-tests-only }} 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 }} + - 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: ${{ github.repository_owner }}/cryostat ref: ${{ inputs.checkout-ref }} submodules: true fetch-depth: 0 - - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - 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 with the loaded image - 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: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - 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: 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 + diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 2c695b26e4..427f7c8b54 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -87,19 +87,19 @@ jobs: checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} skip-itests: ${{ matrix.arch != 'amd64' }} +# Add a new step to use /retest retest-integration: - needs: [checkout-branch] - if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/retest') + needs: [code-analysis, checkout-branch] + if: contains(github.event.comment.body, '/retest') strategy: matrix: arch: [amd64, arm64] uses: ./.github/workflows/ci-build-image.yml with: 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' }} run-tests-only: true + pr-number: ${{ github.event.issue.number }} + sha-value: ${{ needs.checkout-branch.outputs.PR_head_sha }} start-comment: runs-on: ubuntu-latest @@ -120,35 +120,37 @@ jobs: body: commentBody }); - check-test-results: - if: ${{ success(needs.build-and-test) || success(needs.retest-integration) }} + build-and-test-pass: runs-on: ubuntu-latest - needs: [build-and-test, retest-integration] + needs: [build-and-test] + if: ${{ needs.build-and-test.result == 'success' }} steps: - - name: Check Test Results - id: check-results - run: | - echo "All tests passed." - echo "::set-output name=test-status::success" - - name: Check Test Results Failure - if: failure() - id: check-results-failure - run: | - echo "At least one test has failed." - echo "::set-output name=test-status::failure" - continue-on-error: true + - name: Leave Actions Run Comment + uses: actions/github-script@v6 + if: always() + with: + script: | + const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`; + const commentBody = `build-and-test: 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 + }); - leave-test-status-comment: + retest-integration-pass: runs-on: ubuntu-latest - needs: [check-test-results] + needs: [retest-integration] + if: ${{ needs.retest-integration.result == 'success' }} steps: - - name: Leave Test Status Comment + - name: Leave Actions Run Comment uses: actions/github-script@v6 + if: always() with: script: | - const currentTime = new Date().toLocaleString('en-US', { timeZone: 'America/Toronto' }); - const testStatus = "${{ needs.check-test-results.outputs.test-status }}"; - const commentBody = `Tests status: ${test-status } ${currentTime}.`; + 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, From 975ddd58701a572e5d463db820935fd91a71eee3 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 13 Oct 2023 18:31:34 -0400 Subject: [PATCH 21/25] added extra conditions on retest intergration --- .github/workflows/ci-build-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index f47b9867b6..97d0b27b2d 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -144,7 +144,7 @@ jobs: retest-integration-tests: runs-on: ubuntu-latest - if: ${{ !inputs.skip-itests && inputs.run-tests-only }} + if: ${{ !inputs.skip-itests && inputs.run-tests-only && inputs.pr-number != '' && inputs.sha-value != '' }} steps: - name: Install xpath run: | From 04f49f31591430eeac2ffc39312f6bd94645c26d Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Mon, 16 Oct 2023 10:54:36 -0400 Subject: [PATCH 22/25] removed unnecessary step:always() --- .github/workflows/pr-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 427f7c8b54..d5759295d5 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -127,7 +127,6 @@ jobs: steps: - name: Leave Actions Run Comment uses: actions/github-script@v6 - if: always() with: script: | const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`; @@ -146,7 +145,6 @@ jobs: steps: - name: Leave Actions Run Comment uses: actions/github-script@v6 - if: always() with: script: | const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`; From 58fb6da3d19d2c9c7d801d8b6eb59596746eb6cf Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 24 Oct 2023 15:25:45 -0400 Subject: [PATCH 23/25] separated workflows build and itest --- .github/workflows/ci-build-image.yml | 104 ++------------------ .github/workflows/integrated-test.yml | 79 +++++++++++++++ .github/workflows/pr-ci.yml | 136 +++++++++++++------------- 3 files changed, 157 insertions(+), 162 deletions(-) create mode 100644 .github/workflows/integrated-test.yml diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index 97d0b27b2d..f73fec7f87 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,20 +12,10 @@ on: build-arch: required: true type: string - skip-itests: - required: false - type: boolean - default: false run-tests-only: required: false type: boolean default: false - pr-number: - required: false - type: string - sha-value: - required: false - type: string outputs: image-version: description: the Cryostat application version that will be built @@ -52,6 +44,10 @@ jobs: build-image: runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + permissions: + pull-requests: write if: ${{ !inputs.run-tests-only }} needs: [get-pom-properties] steps: @@ -75,8 +71,8 @@ jobs: - name: maven-settings uses: s4u/maven-settings-action@v2 with: - servers: '[{"id": "github", "username": "dummy", "password": "${env.GITHUB_TOKEN_REF}"}]' - githubServer: false + servers: '[{"id": "github", "username": "dummy", "password": "${env.GITHUB_TOKEN}"}]' + githubServer: true - uses: skjolber/maven-cache-github-action@v1 with: step: restore @@ -94,87 +90,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 && !inputs.run-tests-only }} - 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' - - name: Download Cryostat Image Artifact - 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 - - retest-integration-tests: - runs-on: ubuntu-latest - if: ${{ !inputs.skip-itests && inputs.run-tests-only && inputs.pr-number != '' && inputs.sha-value != '' }} - 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: ${{ github.repository_owner }}/cryostat - ref: ${{ inputs.checkout-ref }} - submodules: true - fetch-depth: 0 - - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - 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: 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 - - diff --git a/.github/workflows/integrated-test.yml b/.github/workflows/integrated-test.yml new file mode 100644 index 0000000000..79d4e49723 --- /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: ${{ github.repository_owner }}/cryostat + 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 d5759295d5..bde6fe9450 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -69,42 +69,15 @@ 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] - if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') - strategy: - matrix: - arch: [amd64, arm64] - uses: ./.github/workflows/ci-build-image.yml - with: - 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' }} - -# Add a new step to use /retest - retest-integration: - needs: [code-analysis, checkout-branch] - if: contains(github.event.comment.body, '/retest') - strategy: - matrix: - arch: [amd64, arm64] - uses: ./.github/workflows/ci-build-image.yml - with: - build-arch: ${{ matrix.arch }} - run-tests-only: true - pr-number: ${{ github.event.issue.number }} - sha-value: ${{ needs.checkout-branch.outputs.PR_head_sha }} start-comment: runs-on: ubuntu-latest needs: [check-before-build] - if: ${{ needs.check-before-build.result == 'success' }} steps: - name: Leave Actions Run Comment uses: actions/github-script@v6 @@ -120,46 +93,21 @@ jobs: body: commentBody }); - build-and-test-pass: - runs-on: ubuntu-latest - needs: [build-and-test] - if: ${{ needs.build-and-test.result == 'success' }} - 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 = `build-and-test: 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 - }); - - retest-integration-pass: - runs-on: ubuntu-latest - needs: [retest-integration] - if: ${{ needs.retest-integration.result == 'success' }} - 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 - }); + build-image: + needs: [checkout-branch] + if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') + strategy: + matrix: + arch: [amd64, arm64] + uses: ./.github/workflows/ci-build-image.yml + with: + build-arch: ${{ matrix.arch }} + checkout-repo: ${{ needs.checkout-branch.outputs.PR_repo }} + checkout-ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} push-to-ghcr: runs-on: ubuntu-latest - if: startsWith(github.event.comment.body, '/build_test') - needs: [build-and-test, checkout-branch] + needs: [checkout-branch, build-image] strategy: matrix: arch: [amd64, arm64] @@ -199,7 +147,6 @@ jobs: comment-image: runs-on: ubuntu-latest - if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') needs: [push-to-ghcr] env: amd64_image: ${{ needs.push-to-ghcr.outputs.amd64_image }} @@ -228,3 +175,60 @@ jobs: # 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 }} + + 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 }} + + 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 + }); From ef22644a2397656ed8bab65b866b5837d4354e2c Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 24 Oct 2023 18:04:50 -0400 Subject: [PATCH 24/25] resolved issues --- .github/workflows/ci-build-image.yml | 15 ++++++--------- .github/workflows/integrated-test.yml | 2 +- .github/workflows/pr-ci.yml | 2 ++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index f73fec7f87..3edfe81a6e 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -12,10 +12,6 @@ on: build-arch: required: true type: string - run-tests-only: - required: false - type: boolean - default: false outputs: image-version: description: the Cryostat application version that will be built @@ -44,11 +40,8 @@ jobs: build-image: runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} permissions: pull-requests: write - if: ${{ !inputs.run-tests-only }} needs: [get-pom-properties] steps: - name: Install qemu @@ -58,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 }} @@ -71,8 +63,13 @@ jobs: - name: maven-settings uses: s4u/maven-settings-action@v2 with: - servers: '[{"id": "github", "username": "dummy", "password": "${env.GITHUB_TOKEN}"}]' 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 diff --git a/.github/workflows/integrated-test.yml b/.github/workflows/integrated-test.yml index 79d4e49723..73ee420886 100644 --- a/.github/workflows/integrated-test.yml +++ b/.github/workflows/integrated-test.yml @@ -45,7 +45,7 @@ jobs: sudo apt-get install -y qemu-user-static - uses: actions/checkout@v4 with: - repository: ${{ github.repository_owner }}/cryostat + repository: ${{ inputs.checkout-repo }} ref: ${{ inputs.checkout-ref }} submodules: true fetch-depth: 0 diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index bde6fe9450..55995e865e 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -186,6 +186,7 @@ jobs: 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] @@ -198,6 +199,7 @@ jobs: 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 From ff2e21d1cf1de5779d1533afebd8274e86d80255 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 24 Oct 2023 18:10:28 -0400 Subject: [PATCH 25/25] testing13 --- .github/workflows/pr-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 55995e865e..aa840152ca 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -12,7 +12,7 @@ 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') || startsWith(github.event.comment.body, '/retest')) + if: github.event.issue.pull_request && (startsWith(github.event.comment.body, '/build_test') || startsWith(github.event.comment.body, '/retest')) permissions: pull-requests: write steps: