From e43bf373803ef7a69ba3aa2f93e2800553ac464c Mon Sep 17 00:00:00 2001 From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com> Date: Fri, 27 Oct 2023 23:30:02 +0200 Subject: [PATCH] Stop caching uberjar for E2E tests (#35079) * Stop caching the uberjar for E2E tests * Bring back SHA1 in an uberjar name * Adjust the download uberjar action * Fix uberjar name for percy --- .../actions/e2e-download-uberjar/action.yml | 15 +---- .../prepare-uberjar-artifact/action.yml | 9 ++- .github/workflows/e2e-tests.yml | 57 ++++++++----------- .github/workflows/uberjar.yml | 8 ++- 4 files changed, 39 insertions(+), 50 deletions(-) diff --git a/.github/actions/e2e-download-uberjar/action.yml b/.github/actions/e2e-download-uberjar/action.yml index c2ec019067f..bc5fb1614ec 100644 --- a/.github/actions/e2e-download-uberjar/action.yml +++ b/.github/actions/e2e-download-uberjar/action.yml @@ -1,24 +1,14 @@ -name: Download uberjar for E2E tests -description: Download either a freshly built artifact or the one built in one of the previous commits. +name: Find and download uberjar for E2E tests +description: Download previously built artifact from one of the previous commits. inputs: edition: description: Metabase edition. required: true - was-built: - description: Was the artifact built during the current workflof run? - required: true runs: using: "composite" steps: - - uses: actions/download-artifact@v3 - if: ${{ inputs.was-built == 'true' }} - name: Retrieve uberjar artifact for ${{ inputs.edition }} - with: - name: metabase-${{ inputs.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar - - name: Download previously stored uberjar - if: ${{ inputs.was-built == 'false' }} uses: actions/github-script@v6 with: script: | # js @@ -76,7 +66,6 @@ runs: fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/mb.zip`, Buffer.from(download.data)); - name: Unzip Metabase artifact containing an uberjar - if: ${{ inputs.was-built == 'false' }} run: unzip mb.zip shell: bash diff --git a/.github/actions/prepare-uberjar-artifact/action.yml b/.github/actions/prepare-uberjar-artifact/action.yml index 2058807707f..e498a31f54f 100644 --- a/.github/actions/prepare-uberjar-artifact/action.yml +++ b/.github/actions/prepare-uberjar-artifact/action.yml @@ -1,4 +1,11 @@ name: Prepare Uberjar Artifact +description: Prepare and upload Metabase JAR as a GitHub artifact. + +inputs: + name: + required: true + description: Artifact name + runs: using: "composite" steps: @@ -11,7 +18,7 @@ runs: - name: Upload JARs as artifact uses: actions/upload-artifact@v3 with: - name: metabase-${{ matrix.edition }}-uberjar + name: ${{ inputs.name }} path: | ./target/uberjar/metabase.jar ./COMMIT-ID diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 20ca013f7ff..e0435cf2d8b 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -18,7 +18,6 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: 3 outputs: - e2e_specs: ${{ steps.changes.outputs.e2e_specs }} e2e_all: ${{ steps.changes.outputs.e2e_all }} steps: - uses: actions/checkout@v3 @@ -67,26 +66,15 @@ jobs: - name: Build uberjar with ./bin/build.sh run: ./bin/build.sh - - name: Mark with the commit hash - run: echo ${{ github.sha }} > COMMIT-ID - shell: bash - - name: Calculate SHA256 checksum - run: sha256sum ./target/uberjar/metabase.jar > SHA256.sum - shell: bash - - name: Upload JARs as artifact - uses: actions/upload-artifact@v3 + - name: Prepare uberjar artifact + uses: ./.github/actions/prepare-uberjar-artifact with: name: metabase-${{ matrix.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar - path: | - ./target/uberjar/metabase.jar - ./COMMIT-ID - ./SHA256.sum e2e-tests: - needs: [build, files-changed, e2e-matrix-builder] + needs: [build, e2e-matrix-builder] if: | - !cancelled() && - (needs.files-changed.outputs.e2e_specs == 'true' || needs.build.result == 'success') + !cancelled() && needs.build.result == 'success' runs-on: ${{ matrix.runner }} timeout-minutes: 90 name: e2e-tests-${{ matrix.name }}-${{ matrix.edition }} @@ -111,9 +99,6 @@ jobs: steps: - uses: actions/checkout@v3 - with: - # Important in case we need to download uberjar from previous commits! - fetch-depth: ${{ needs.build.result == 'success' && '' || 20 }} - name: Prepare Docker containers uses: ./.github/actions/e2e-prepare-containers @@ -126,14 +111,19 @@ jobs: mysql: ${{ matrix.name != 'mongo'}} mongo: ${{ matrix.name == 'mongo'}} - - name: Download Metabase ${{ matrix.edition }} uberjar - uses: ./.github/actions/e2e-download-uberjar + - name: Retrieve uberjar artifact for ${{ matrix.edition }} + uses: actions/download-artifact@v3 with: - edition: ${{ matrix.edition }} - was-built: ${{ needs.build.result == 'success' }} + name: metabase-${{ matrix.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar + + - name: Get the version info + run: | + jar xf target/uberjar/metabase.jar version.properties + mv version.properties resources/ - name: Prepare front-end environment uses: ./.github/actions/prepare-frontend + - name: Prepare JDK ${{ matrix.java-version }} uses: actions/setup-java@v3 with: @@ -211,15 +201,10 @@ jobs: timeout-minutes: 60 needs: [build] if: | - !cancelled() && - (needs.files-changed.outputs.e2e_specs == 'true' || needs.build.result == 'success') && - github.event_name != 'schedule' + !cancelled() && needs.build.result == 'success' name: percy-visual-regression-tests steps: - uses: actions/checkout@v3 - with: - # Important in case we need to download uberjar from previous commits! - fetch-depth: ${{ needs.build.result == 'success' && '' || 20 }} - name: Prepare Docker containers uses: ./.github/actions/e2e-prepare-containers @@ -228,19 +213,25 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} maildev: true - - name: Download Metabase enterprise uberjar - uses: ./.github/actions/e2e-download-uberjar + - name: Retrieve uberjar artifact for ${{ matrix.edition }} + uses: actions/download-artifact@v3 with: - edition: 'ee' - was-built: ${{ needs.build.result == 'success' }} + name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar + + - name: Get the version info + run: | + jar xf target/uberjar/metabase.jar version.properties + mv version.properties resources/ - name: Prepare front-end environment uses: ./.github/actions/prepare-frontend + - name: Prepare JDK 11 uses: actions/setup-java@v3 with: java-version: 11 distribution: 'temurin' + - name: Prepare Cypress environment id: cypress-prep uses: ./.github/actions/prepare-cypress diff --git a/.github/workflows/uberjar.yml b/.github/workflows/uberjar.yml index 3223fa711c0..be9fb2560e8 100644 --- a/.github/workflows/uberjar.yml +++ b/.github/workflows/uberjar.yml @@ -45,6 +45,8 @@ jobs: run: ./bin/build.sh - name: Prepare uberjar artifact uses: ./.github/actions/prepare-uberjar-artifact + with: + name: metabase-${{ matrix.edition }}-${{ github.sha }}-uberjar check_jar_health: runs-on: ubuntu-22.04 @@ -66,7 +68,7 @@ jobs: - uses: actions/download-artifact@v3 name: Retrieve uberjar artifact with: - name: metabase-${{ matrix.edition }}-uberjar + name: metabase-${{ matrix.edition }}-${{ github.sha }}-uberjar - name: Launch uberjar run: java -jar ./target/uberjar/metabase.jar & - name: Wait for Metabase to start @@ -98,7 +100,7 @@ jobs: - name: Download uploaded artifacts to insert into container uses: actions/download-artifact@v3 with: - name: metabase-${{ matrix.edition }}-uberjar + name: metabase-${{ matrix.edition }}-${{ github.sha }}-uberjar path: bin/docker/ - name: Move the ${{ matrix.edition }} uberjar to the context dir run: mv bin/docker/target/uberjar/metabase.jar bin/docker/. @@ -216,7 +218,7 @@ jobs: - name: Download uploaded artifacts to insert into container uses: actions/download-artifact@v3 with: - name: metabase-${{ matrix.edition }}-uberjar + name: metabase-${{ matrix.edition }}-${{ github.sha }}-uberjar path: bin/docker/ - name: Move the ${{ matrix.edition }} uberjar to the context dir run: mv bin/docker/target/uberjar/metabase.jar bin/docker/. -- GitLab