From 95fc3174ade732985eeb971a47733a7095f09ec8 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 24 Oct 2023 10:21:43 -0400 Subject: [PATCH 1/2] testing7 --- .github/workflows/retest-integrated-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/retest-integrated-test.yml b/.github/workflows/retest-integrated-test.yml index 31bc0256b3..721736b8fb 100644 --- a/.github/workflows/retest-integrated-test.yml +++ b/.github/workflows/retest-integrated-test.yml @@ -25,7 +25,7 @@ permissions: jobs: - retest-integration-tests: #testing + retest-integration-tests: #test runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c2fe10c4c53f9ec52f2474b01c3d1404e66e56f4 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 24 Oct 2023 12:20:09 -0400 Subject: [PATCH 2/2] testing7 --- .github/workflows/ci-build-image.yml | 50 +------ ...ntegrated-test.yml => integrated-test.yml} | 11 +- .github/workflows/pr-ci.yml | 122 +++++++++--------- 3 files changed, 75 insertions(+), 108 deletions(-) rename .github/workflows/{retest-integrated-test.yml => integrated-test.yml} (86%) diff --git a/.github/workflows/ci-build-image.yml b/.github/workflows/ci-build-image.yml index 0405aed1ae..5d6f24cde9 100644 --- a/.github/workflows/ci-build-image.yml +++ b/.github/workflows/ci-build-image.yml @@ -94,49 +94,11 @@ jobs: 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 - + strategy: + matrix: + arch: [amd64, arm64] + uses: ./.github/workflows/integrated-test.yml + with: + build-arch: ${{ matrix.arch }} diff --git a/.github/workflows/retest-integrated-test.yml b/.github/workflows/integrated-test.yml similarity index 86% rename from .github/workflows/retest-integrated-test.yml rename to .github/workflows/integrated-test.yml index 721736b8fb..5b7f84876b 100644 --- a/.github/workflows/retest-integrated-test.yml +++ b/.github/workflows/integrated-test.yml @@ -27,8 +27,6 @@ permissions: jobs: retest-integration-tests: #test runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} permissions: pull-requests: write steps: @@ -55,12 +53,19 @@ 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 }} - 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Print itest logs if: failure() run: ls -1dt target/cryostat-itest-*.log | head -n1 | xargs cat diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 67bd18bffa..1dcd6639e1 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -73,32 +73,6 @@ jobs: 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: [checkout-branch] - if: contains(github.event.comment.body, '/retest') - strategy: - matrix: - arch: [amd64, arm64] - uses: ./.github/workflows/retest-integrated-test.yml - with: - build-arch: ${{ matrix.arch }} - pr-number: ${{ github.event.issue.number }} - sha-value: ${{ needs.checkout-branch.outputs.PR_head_sha }} start-comment: runs-on: ubuntu-latest @@ -118,44 +92,10 @@ jobs: body: commentBody }); - build-and-test-pass: - runs-on: ubuntu-latest - needs: [build-and-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 = `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] - 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 - }); - push-to-ghcr: runs-on: ubuntu-latest if: startsWith(github.event.comment.body, '/build_test') - needs: [build-and-test, checkout-branch] + needs: [checkout-branch] strategy: matrix: arch: [amd64, arm64] @@ -224,3 +164,63 @@ jobs: # or arm64 CRYOSTAT_IMAGE=${{ env.arm64_image }} sh smoketest.sh ``` + + 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: [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 }} + + build-and-test-pass: + runs-on: ubuntu-latest + needs: [build-and-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 = `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] + 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 + });