diff --git a/.github/workflow-scripts/verify_deployment.sh b/.github/workflow-scripts/verify_deployment.sh index b2a2682b3e..be70f828b4 100644 --- a/.github/workflow-scripts/verify_deployment.sh +++ b/.github/workflow-scripts/verify_deployment.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -ux + URL=$1 EXPECTED_VERSION=$2 MAX_ATTEMPTS=30 diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 7c87540485..23e086a6a4 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -21,6 +21,8 @@ permissions: jobs: build_docker_image: runs-on: ubuntu-latest + outputs: + DOCKER_IMAGE_TAG: ${{ steps.set_tag.outputs.DOCKER_IMAGE_TAG }} steps: - name: Checkout @@ -29,8 +31,15 @@ jobs: fetch-depth: 0 - name: Define image tag + id: set_tag run: | - echo "DOCKER_IMAGE_TAG=$(git describe --tags)" >> $GITHUB_ENV + export DOCKER_IMAGE_TAG=$(git describe --tags) + + # This one is to be able to use the image tag in the next steps in this job + echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_ENV + + # This one is to be able to use the image tag in the next jobs + echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_OUTPUT - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 @@ -61,7 +70,8 @@ jobs: uses: actions/checkout@v4 - name: Verify Deployment Version (Dev) - run: bash .github/workflow-scripts/verify_deployment.sh ${{ secrets.DEV_SEPOLIA_URL }} ${{ env.DOCKER_IMAGE_TAG }} + run: | + bash .github/workflow-scripts/verify_deployment.sh ${{ secrets.DEV_SEPOLIA_URL }} ${{ needs.build_docker_image.outputs.DOCKER_IMAGE_TAG }} dev-starknet-rs-tests: needs: [validate_dev] @@ -91,7 +101,11 @@ jobs: - name: Promote to Staging run: | - jf rt dpr juno/${{ env.DOCKER_IMAGE_TAG }} ${{ env.REPO_DEV }} ${{ env.REPO_STAGING }} + jf rt dpr juno/${{ needs.build_docker_image.outputs.DOCKER_IMAGE_TAG }} ${{ env.REPO_DEV }} ${{ env.REPO_STAGING }} + + - name: Verify Deployment Version (Staging) + run: | + bash .github/workflow-scripts/verify_deployment.sh ${{ secrets.STAGING_SEPOLIA_URL }} ${{ needs.build_docker_image.outputs.DOCKER_IMAGE_TAG }} staging-starknet-rs-tests: needs: [promote_to_staging] @@ -121,7 +135,11 @@ jobs: - name: Promote to Production run: | - jf rt dpr juno/${{ env.DOCKER_IMAGE_TAG }} ${{ env.REPO_STAGING }} ${{ env.REPO_PROD }} + jf rt dpr juno/${{ needs.build_docker_image.outputs.DOCKER_IMAGE_TAG }} ${{ env.REPO_STAGING }} ${{ env.REPO_PROD }} + + - name: Verify Deployment Version (Production) + run: | + bash .github/workflow-scripts/verify_deployment.sh ${{ secrets.PROD_SEPOLIA_URL }} ${{ needs.build_docker_image.outputs.DOCKER_IMAGE_TAG }} prod-starknet-rs-tests: needs: [promote_to_production]