From 152ca0e5009b46f5a40ffbad15317ab433f12328 Mon Sep 17 00:00:00 2001 From: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com> Date: Thu, 18 Apr 2024 00:41:32 +0300 Subject: [PATCH] Fix formatting of pre-release.yml (#41497) --- .github/workflows/pre-release.yml | 260 +++++++++++++++--------------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index ec4d26c2aa1..7a4a537d10f 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -5,11 +5,11 @@ on: workflow_dispatch: inputs: version: - description: 'Metabase version (e.g. v0.46.3)' + description: "Metabase version (e.g. v0.46.3)" type: string required: true commit: - description: 'A full-length commit SHA-1 hash' + description: "A full-length commit SHA-1 hash" required: true jobs: @@ -91,21 +91,21 @@ jobs: edition: [oss, ee] java-version: [11, 17] steps: - - name: Prepare JRE (Java Run-time Environment) - uses: actions/setup-java@v4 - with: - java-package: jre - java-version: ${{ matrix.java-version }} - distribution: 'temurin' - - run: java -version - - uses: actions/download-artifact@v4 - name: Retrieve uberjar artifact - with: - name: metabase-${{ matrix.edition }}-uberjar - - name: Launch uberjar (and keep it running) - run: java -jar ./metabase.jar & - - name: Wait for Metabase to start - run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done + - name: Prepare JRE (Java Run-time Environment) + uses: actions/setup-java@v4 + with: + java-package: jre + java-version: ${{ matrix.java-version }} + distribution: "temurin" + - run: java -version + - uses: actions/download-artifact@v4 + name: Retrieve uberjar artifact + with: + name: metabase-${{ matrix.edition }}-uberjar + - name: Launch uberjar (and keep it running) + run: java -jar ./metabase.jar & + - name: Wait for Metabase to start + run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done run-sanity-check: runs-on: ubuntu-22.04 @@ -132,43 +132,43 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} steps: - - name: Check out the code - uses: actions/checkout@v4 - with: - ref: ${{ needs.release-artifact.outputs.commit }} - - name: Prepare front-end environment - uses: ./.github/actions/prepare-frontend - - name: Prepare JDK 11 - uses: actions/setup-java@v4 - with: - java-version: 11 - distribution: "temurin" - - name: Prepare Cypress environment - uses: ./.github/actions/prepare-cypress - - name: Run Snowplow micro - uses: ./.github/actions/run-snowplow-micro - - uses: actions/download-artifact@v4 - name: Retrieve uberjar artifact for ${{ matrix.edition }} - with: - name: metabase-${{ matrix.edition }}-uberjar - - name: Get the version info - run: | - jar xf metabase.jar version.properties - mv version.properties resources/ - - name: Run a few important Cypress tests as sanity check - run: | - mkdir -p ./target/uberjar && cp metabase.jar ./target/uberjar/metabase.jar - yarn test-cypress-run --folder onboarding + - name: Check out the code + uses: actions/checkout@v4 + with: + ref: ${{ needs.release-artifact.outputs.commit }} + - name: Prepare front-end environment + uses: ./.github/actions/prepare-frontend + - name: Prepare JDK 11 + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: "temurin" + - name: Prepare Cypress environment + uses: ./.github/actions/prepare-cypress + - name: Run Snowplow micro + uses: ./.github/actions/run-snowplow-micro + - uses: actions/download-artifact@v4 + name: Retrieve uberjar artifact for ${{ matrix.edition }} + with: + name: metabase-${{ matrix.edition }}-uberjar + - name: Get the version info + run: | + jar xf metabase.jar version.properties + mv version.properties resources/ + - name: Run a few important Cypress tests as sanity check + run: | + mkdir -p ./target/uberjar && cp metabase.jar ./target/uberjar/metabase.jar + yarn test-cypress-run --folder onboarding - - name: Upload Cypress Artifacts upon failure - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-failed-tests-recording - path: | - ./cypress - ./logs/test.log - if-no-files-found: ignore + - name: Upload Cypress Artifacts upon failure + uses: actions/upload-artifact@v4 + if: failure() + with: + name: cypress-failed-tests-recording + path: | + ./cypress + ./logs/test.log + if-no-files-found: ignore containerize: needs: [release-artifact, run-sanity-check] @@ -185,71 +185,71 @@ jobs: outputs: image_tag: ${{ steps.target.outputs.image_tag }} steps: - - name: Get the version - run: | - if [[ "${{ matrix.edition }}" == "ee" ]]; then - echo "VERSION=${{ needs.release-artifact.outputs.ee_version }}" >> $GITHUB_ENV - else - echo "VERSION=${{ needs.release-artifact.outputs.oss_version }}" >> $GITHUB_ENV - fi - - name: Check out the code - uses: actions/checkout@v4 - with: - ref: ${{ needs.release-artifact.outputs.commit }} - - uses: actions/download-artifact@v4 - name: Retrieve uberjar artifact - with: - name: metabase-${{ matrix.edition }}-uberjar - - name: Move the Uberjar to the context dir - run: mv metabase.jar bin/docker/. - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - with: - driver-opts: network=host - - name: Build ${{ matrix.edition }} container - uses: docker/build-push-action@v3 - with: - context: bin/docker/. - platforms: linux/amd64 - network: host - tags: localhost:5000/local-metabase:${{ env.VERSION }} - no-cache: true - push: true + - name: Get the version + run: | + if [[ "${{ matrix.edition }}" == "ee" ]]; then + echo "VERSION=${{ needs.release-artifact.outputs.ee_version }}" >> $GITHUB_ENV + else + echo "VERSION=${{ needs.release-artifact.outputs.oss_version }}" >> $GITHUB_ENV + fi + - name: Check out the code + uses: actions/checkout@v4 + with: + ref: ${{ needs.release-artifact.outputs.commit }} + - uses: actions/download-artifact@v4 + name: Retrieve uberjar artifact + with: + name: metabase-${{ matrix.edition }}-uberjar + - name: Move the Uberjar to the context dir + run: mv metabase.jar bin/docker/. + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + with: + driver-opts: network=host + - name: Build ${{ matrix.edition }} container + uses: docker/build-push-action@v3 + with: + context: bin/docker/. + platforms: linux/amd64 + network: host + tags: localhost:5000/local-metabase:${{ env.VERSION }} + no-cache: true + push: true - - name: Launch container - run: docker run --rm -dp 3000:3000 localhost:5000/local-metabase:${{ env.VERSION }} - timeout-minutes: 5 - - name: Wait for Metabase to start - run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done - timeout-minutes: 3 + - name: Launch container + run: docker run --rm -dp 3000:3000 localhost:5000/local-metabase:${{ env.VERSION }} + timeout-minutes: 5 + - name: Wait for Metabase to start + run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done + timeout-minutes: 3 - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }} - password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }} - - name: Retag and push container image to ${{ vars.DOCKERHUB_OWNER }} staging Docker Hub repo - id: target - run: | - # SHA-1 truncated to 7 digits should be enough - SHORT_HASH=${COMMIT:0:7} + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }} + password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }} + - name: Retag and push container image to ${{ vars.DOCKERHUB_OWNER }} staging Docker Hub repo + id: target + run: | + # SHA-1 truncated to 7 digits should be enough + SHORT_HASH=${COMMIT:0:7} - IMAGE_TAG=$VERSION-$SHORT_HASH - CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG + IMAGE_TAG=$VERSION-$SHORT_HASH + CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG - echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT + echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT - echo "Retag local image for staging" - docker tag localhost:5000/local-metabase:$VERSION $CONTAINER_IMAGE + echo "Retag local image for staging" + docker tag localhost:5000/local-metabase:$VERSION $CONTAINER_IMAGE - echo "Pushing container image $CONTAINER_IMAGE ..." - docker push $CONTAINER_IMAGE + echo "Pushing container image $CONTAINER_IMAGE ..." + docker push $CONTAINER_IMAGE - echo "Finished!" - shell: bash - env: - COMMIT: ${{ needs.release-artifact.outputs.commit }} + echo "Finished!" + shell: bash + env: + COMMIT: ${{ needs.release-artifact.outputs.commit }} verify-docker-pull: runs-on: ubuntu-22.04 @@ -261,22 +261,22 @@ jobs: env: IMAGE_TAG: ${{ needs.containerize.outputs.image_tag }} steps: - - name: Login to Docker Hub # authenticated, to avoid being rate-throttled - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }} - password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }} - - name: Pull the container image - run: | - CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG - echo "Pulling container image $CONTAINER_IMAGE ..." - docker pull $CONTAINER_IMAGE - echo "Successful!" - - name: Launch container - run: | - CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG - docker run --rm -dp 3000:3000 $CONTAINER_IMAGE - timeout-minutes: 5 - - name: Wait for Metabase to start - run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done - timeout-minutes: 3 + - name: Login to Docker Hub # authenticated, to avoid being rate-throttled + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }} + password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }} + - name: Pull the container image + run: | + CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG + echo "Pulling container image $CONTAINER_IMAGE ..." + docker pull $CONTAINER_IMAGE + echo "Successful!" + - name: Launch container + run: | + CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG + docker run --rm -dp 3000:3000 $CONTAINER_IMAGE + timeout-minutes: 5 + - name: Wait for Metabase to start + run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done + timeout-minutes: 3 -- GitLab