From 674729eebde04f4dedb1dde12665d4b30b00f0ed Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 Dec 2024 18:43:43 -0600 Subject: [PATCH 01/21] feat: add docker build for amd64 / arm64, runs e2e tests against docker node, publishes to ghcr --- .github/workflows/build-push-docker.yml | 14 ++++- .github/workflows/e2e-docker.yml | 84 +++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/e2e-docker.yml diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 928b7a2b..0224599e 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -14,6 +14,9 @@ jobs: build-push-image: name: Build and push Docker image runs-on: [matterlabs-ci-runner] + strategy: + matrix: + platform: [linux/amd64, linux/arm64] steps: - uses: actions/checkout@v4 @@ -39,6 +42,13 @@ jobs: - name: Login to GAR run: | gcloud auth configure-docker us-docker.pkg.dev -q + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -46,16 +56,18 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - # For now, we're only pushing to the internal registry - name: Build and push Docker image id: docker_build uses: docker/build-push-action@v6 with: context: . push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} + platforms: ${{ matrix.platform }} tags: | us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-test-node:${{ steps.docker_tag.outputs.tag }} us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-test-node:latest + ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ steps.docker_tag.outputs.tag }} + ghcr.io/${{ github.repository_owner }}/anvil-zksync:latest - name: Print image digest to summary run: | diff --git a/.github/workflows/e2e-docker.yml b/.github/workflows/e2e-docker.yml new file mode 100644 index 00000000..cc038bb3 --- /dev/null +++ b/.github/workflows/e2e-docker.yml @@ -0,0 +1,84 @@ +name: Running e2e tests against Docker image + +on: + workflow_call: + push: + branches: + - main + pull_request: + +jobs: + test-docker-image: + name: Test Docker Image + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image locally + id: docker_build + uses: docker/build-push-action@v6 + with: + context: . + push: false + load: true + tags: test-anvil-zksync:latest + + - name: Start Docker container + run: | + echo "Starting Docker container with test-anvil-zksync image..." + docker run --rm -d -p 8011:8011 -v $PWD/logs:/logs --name test_anvil_zksync test-anvil-zksync:latest + + - name: Wait for the node to be ready + run: | + echo "Waiting for the node to be ready..." + MAX_RETRIES=10 + COUNTER=0 + URL="http://localhost:8011" + DATA='{"jsonrpc": "2.0", "id": "1", "method": "eth_chainId", "params": []}' + + while [ $COUNTER -lt $MAX_RETRIES ]; do + RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "content-type: application/json" -d "$DATA" $URL || true) + if [ "$RESPONSE" -eq 200 ]; then + echo "Node is running!" + break + else + echo "Node not ready, retrying in 1 second..." + COUNTER=$((COUNTER + 1)) + sleep 1 + fi + done + + if [ $COUNTER -eq $MAX_RETRIES ]; then + echo "Failed to contact node after $MAX_RETRIES attempts. Are you sure the node is running at $URL ?" + docker stop test_anvil_zksync + exit 1 + fi + + - name: Install dependencies for e2e tests + working-directory: ./e2e-tests + run: | + echo "Installing e2e test dependencies..." + yarn install --frozen-lockfile + + - name: Compile contracts and run e2e tests + working-directory: ./e2e-tests + run: | + echo "Compiling contracts and running e2e tests..." + yarn hardhat compile + export ANVIL_LOG_PATH=/logs/anvil-zksync.log + yarn test + + - name: Stop Docker container + if: always() + run: | + echo "Stopping Docker container..." + docker stop test_anvil_zksync + + - name: Print test result summary + run: | + echo "Tests completed successfully!" From 849ff799b3157adb544c5c1473db9ff49ad7d01a Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 Dec 2024 18:57:12 -0600 Subject: [PATCH 02/21] fix: log file access --- .github/workflows/e2e-docker.yml | 4 ++-- e2e-tests/test/anvil-apis.test.ts | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-docker.yml b/.github/workflows/e2e-docker.yml index cc038bb3..78e0eb2e 100644 --- a/.github/workflows/e2e-docker.yml +++ b/.github/workflows/e2e-docker.yml @@ -1,4 +1,4 @@ -name: Running e2e tests against Docker image +name: Run e2e tests against Docker node on: workflow_call: @@ -9,7 +9,7 @@ on: jobs: test-docker-image: - name: Test Docker Image + name: e2e tests on Docker node runs-on: ubuntu-latest steps: diff --git a/e2e-tests/test/anvil-apis.test.ts b/e2e-tests/test/anvil-apis.test.ts index 6cf04e9e..33ad3828 100644 --- a/e2e-tests/test/anvil-apis.test.ts +++ b/e2e-tests/test/anvil-apis.test.ts @@ -6,6 +6,7 @@ import { ethers } from "hardhat"; import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import * as hre from "hardhat"; import * as fs from "node:fs"; +import * as path from "node:path"; const provider = getTestProvider(); @@ -90,19 +91,30 @@ describe("anvil_setBlockTimestampInterval & anvil_removeBlockTimestampInterval", describe("anvil_setLoggingEnabled", function () { it("Should disable and enable logging", async function () { + + const logFilePath = process.env.ANVIL_LOG_PATH || path.resolve("../anvil-zksync.log"); + // Arrange const wallet = new Wallet(RichAccounts[0].PrivateKey, provider); const userWallet = Wallet.createRandom().connect(provider); // Act await provider.send("anvil_setLoggingEnabled", [false]); - const logSizeBefore = fs.statSync("../anvil-zksync.log").size; + + let logSizeBefore = 0; + if (fs.existsSync(logFilePath)) { + logSizeBefore = fs.statSync(logFilePath).size; + } await wallet.sendTransaction({ to: userWallet.address, value: ethers.parseEther("0.1"), }); - const logSizeAfter = fs.statSync("../anvil-zksync.log").size; + + let logSizeAfter = 0; + if (fs.existsSync(logFilePath)) { + logSizeAfter = fs.statSync(logFilePath).size; + } // Reset await provider.send("anvil_setLoggingEnabled", [true]); From 268176ceaab352890dd07de420c985e69e1972c2 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 Dec 2024 19:00:04 -0600 Subject: [PATCH 03/21] chore: run prettier --- e2e-tests/test/anvil-apis.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e-tests/test/anvil-apis.test.ts b/e2e-tests/test/anvil-apis.test.ts index 33ad3828..26dd52fb 100644 --- a/e2e-tests/test/anvil-apis.test.ts +++ b/e2e-tests/test/anvil-apis.test.ts @@ -91,7 +91,6 @@ describe("anvil_setBlockTimestampInterval & anvil_removeBlockTimestampInterval", describe("anvil_setLoggingEnabled", function () { it("Should disable and enable logging", async function () { - const logFilePath = process.env.ANVIL_LOG_PATH || path.resolve("../anvil-zksync.log"); // Arrange From a9b9ad4e0611f126c703996e1a06ac25047595c4 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 Dec 2024 19:53:12 -0600 Subject: [PATCH 04/21] feat: add cache layer to docker builds --- .github/workflows/build-push-docker.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 0224599e..8dbe24ab 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -56,6 +56,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Cache Docker Layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: buildx-cache-${{ github.sha }} + restore-keys: | + buildx-cache- + - name: Build and push Docker image id: docker_build uses: docker/build-push-action@v6 @@ -63,6 +71,8 @@ jobs: context: . push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} platforms: ${{ matrix.platform }} + cache-from: type=gha + cache-to: type=gha,mode=max tags: | us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-test-node:${{ steps.docker_tag.outputs.tag }} us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-test-node:latest From 2e1baf2caa27d547561add32ab6499897ccf2cd8 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 Dec 2024 22:03:25 -0600 Subject: [PATCH 05/21] chore: test --- .github/workflows/build-push-docker.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 8dbe24ab..a3f999a1 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -3,6 +3,7 @@ on: push: branches: - main + - db/multi-platform-docker # just to test tags: - "*" @@ -74,8 +75,8 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max tags: | - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-test-node:${{ steps.docker_tag.outputs.tag }} - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-test-node:latest + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ steps.docker_tag.outputs.tag }} + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ steps.docker_tag.outputs.tag }} ghcr.io/${{ github.repository_owner }}/anvil-zksync:latest From e875734bff13d6bfc76f2430e819678e51b2137b Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 Dec 2024 22:07:43 -0600 Subject: [PATCH 06/21] chore: testing --- .github/workflows/build-push-docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index a3f999a1..6decb49e 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -31,6 +31,8 @@ jobs: ts=$(date +%s%N | cut -b1-13) if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then echo "tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref }}" == refs/heads/db/multi-platform-docker ]]; then + echo "tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT elif [[ "${{ github.ref }}" == refs/tags/* ]]; then echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT elif [[ "${{ github.event_name }}" == "pull_request" ]]; then From 79fcc705b8574c7e3f93e0cfb4315002ed39ab19 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 Dec 2024 22:22:48 -0600 Subject: [PATCH 07/21] chore: remove testing branch --- .github/workflows/build-push-docker.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 6decb49e..8a339362 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -3,7 +3,6 @@ on: push: branches: - main - - db/multi-platform-docker # just to test tags: - "*" @@ -31,8 +30,6 @@ jobs: ts=$(date +%s%N | cut -b1-13) if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then echo "tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT - elif [[ "${{ github.ref }}" == refs/heads/db/multi-platform-docker ]]; then - echo "tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT elif [[ "${{ github.ref }}" == refs/tags/* ]]; then echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT elif [[ "${{ github.event_name }}" == "pull_request" ]]; then From 05e247e75a9f937098e81b49ff064dcb5e85d02d Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 06:24:58 -0600 Subject: [PATCH 08/21] chore: remove uneeded if --- e2e-tests/test/anvil-apis.test.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/e2e-tests/test/anvil-apis.test.ts b/e2e-tests/test/anvil-apis.test.ts index 26dd52fb..07af0d7a 100644 --- a/e2e-tests/test/anvil-apis.test.ts +++ b/e2e-tests/test/anvil-apis.test.ts @@ -100,20 +100,13 @@ describe("anvil_setLoggingEnabled", function () { // Act await provider.send("anvil_setLoggingEnabled", [false]); - let logSizeBefore = 0; - if (fs.existsSync(logFilePath)) { - logSizeBefore = fs.statSync(logFilePath).size; - } + const logSizeBefore = fs.statSync(logFilePath).size; await wallet.sendTransaction({ to: userWallet.address, value: ethers.parseEther("0.1"), }); - - let logSizeAfter = 0; - if (fs.existsSync(logFilePath)) { - logSizeAfter = fs.statSync(logFilePath).size; - } + const logSizeAfter = fs.statSync(logFilePath).size; // Reset await provider.send("anvil_setLoggingEnabled", [true]); From b731c97f764ab70b0836a6e8bb1e9842ac759fe4 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 11:37:14 -0600 Subject: [PATCH 09/21] debug --- .github/workflows/build-push-docker.yml | 95 ++++++++++++++++--------- .github/workflows/e2e-docker.yml | 3 +- e2e-tests/test/anvil-apis.test.ts | 3 + 3 files changed, 67 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 8a339362..03503729 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -3,6 +3,7 @@ on: push: branches: - main + - db/multi-platform-docker tags: - "*" @@ -11,38 +12,81 @@ concurrency: cancel-in-progress: true jobs: - build-push-image: - name: Build and push Docker image - runs-on: [matterlabs-ci-runner] - strategy: - matrix: - platform: [linux/amd64, linux/arm64] + set-tags: + name: Set Docker Tags + runs-on: ubuntu-latest + outputs: + base_tag: ${{ steps.set_tag.outputs.base_tag }} steps: - uses: actions/checkout@v4 - - name: Set git SHA + - name: Set Git SHA id: git_sha run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - name: Set Docker tag - id: docker_tag + - name: Determine Base Tag + id: set_tag run: | ts=$(date +%s%N | cut -b1-13) if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then - echo "tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT + echo "base_tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref }}" == "refs/heads/db/multi-platform-docker" ]]; then + echo "base_tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT elif [[ "${{ github.ref }}" == refs/tags/* ]]; then - echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT + echo "base_tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT elif [[ "${{ github.event_name }}" == "pull_request" ]]; then - echo "tag=none" >> $GITHUB_OUTPUT + echo "base_tag=none" >> $GITHUB_OUTPUT else - echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}, only refs/heads/, refs/tags/ and pull_request are supported." + echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}. Only refs/heads/main, refs/tags/*, and pull_request are supported." exit 1 fi + # 2. Build and Push Docker Images for Each Architecture + build-push-image: + name: Build and Push Docker Image for ${{ matrix.arch }} + runs-on: [matterlabs-ci-runner-high-performance] + needs: set-tags + strategy: + matrix: + include: + - platform: linux/amd64 + arch: amd64 + - platform: linux/arm64 + arch: arm64 + steps: + - uses: actions/checkout@v4 + + - name: Set Base Docker Tag + run: echo "BASE_TAG=${{ needs.set-tags.outputs.base_tag }}" >> $GITHUB_ENV + + - name: Set Repository Owner + run: echo "REPO_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV + + - name: Set Full Docker Tags + id: full_tags + run: | + base_tag="${{ env.BASE_TAG }}" + arch="${{ matrix.arch }}" + repo_owner="${{ env.REPO_OWNER }}" + if [[ "$base_tag" == "none" ]]; then + echo "tags=none" >> $GITHUB_OUTPUT + exit 0 + fi + + full_tags="us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch} + ghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch} + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag} + + ghcr.io/${repo_owner}/anvil-zksync:${base_tag} + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest + ghcr.io/${repo_owner}/anvil-zksync:latest" + + echo "tags=${full_tags}" >> $GITHUB_OUTPUT + - name: Login to GAR run: | gcloud auth configure-docker us-docker.pkg.dev -q - + - name: Login to GHCR uses: docker/login-action@v3 with: @@ -50,35 +94,20 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Cache Docker Layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: buildx-cache-${{ github.sha }} - restore-keys: | - buildx-cache- - - name: Build and push Docker image id: docker_build uses: docker/build-push-action@v6 with: context: . - push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} + push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/db/multi-platform-docker' || startsWith(github.ref, 'refs/tags/')) }} platforms: ${{ matrix.platform }} cache-from: type=gha cache-to: type=gha,mode=max - tags: | - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ steps.docker_tag.outputs.tag }} - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest - ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ steps.docker_tag.outputs.tag }} - ghcr.io/${{ github.repository_owner }}/anvil-zksync:latest + tags: ${{ steps.full_tags.outputs.tags }} - name: Print image digest to summary run: | - echo "Image tag: ${{ steps.docker_tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY + echo "Image tags: ${{ steps.full_tags.outputs.tags }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/e2e-docker.yml b/.github/workflows/e2e-docker.yml index 78e0eb2e..68b8a4b9 100644 --- a/.github/workflows/e2e-docker.yml +++ b/.github/workflows/e2e-docker.yml @@ -67,10 +67,11 @@ jobs: - name: Compile contracts and run e2e tests working-directory: ./e2e-tests + env: + ANVIL_LOG_PATH: "${{ github.workspace }}/logs/anvil-zksync.log" run: | echo "Compiling contracts and running e2e tests..." yarn hardhat compile - export ANVIL_LOG_PATH=/logs/anvil-zksync.log yarn test - name: Stop Docker container diff --git a/e2e-tests/test/anvil-apis.test.ts b/e2e-tests/test/anvil-apis.test.ts index 07af0d7a..58ddcca5 100644 --- a/e2e-tests/test/anvil-apis.test.ts +++ b/e2e-tests/test/anvil-apis.test.ts @@ -93,6 +93,9 @@ describe("anvil_setLoggingEnabled", function () { it("Should disable and enable logging", async function () { const logFilePath = process.env.ANVIL_LOG_PATH || path.resolve("../anvil-zksync.log"); + console.log(`ANVIL_LOG_PATH: ${process.env.ANVIL_LOG_PATH}`); + console.log(`Using logFilePath: ${logFilePath}`); + // Arrange const wallet = new Wallet(RichAccounts[0].PrivateKey, provider); const userWallet = Wallet.createRandom().connect(provider); From 5adf5899e66233c60bfb4afa28e6247d0b22f243 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 11:40:14 -0600 Subject: [PATCH 10/21] debug --- .github/workflows/build-push-docker.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 03503729..fc94eee0 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -72,15 +72,12 @@ jobs: echo "tags=none" >> $GITHUB_OUTPUT exit 0 fi - full_tags="us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch} ghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch} us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag} - ghcr.io/${repo_owner}/anvil-zksync:${base_tag} us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest ghcr.io/${repo_owner}/anvil-zksync:latest" - echo "tags=${full_tags}" >> $GITHUB_OUTPUT - name: Login to GAR From 51f6fa1047a076d567f2698549baabba1940b528 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 11:46:54 -0600 Subject: [PATCH 11/21] debug --- .github/workflows/build-push-docker.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index fc94eee0..757c47da 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -38,10 +38,9 @@ jobs: echo "base_tag=none" >> $GITHUB_OUTPUT else echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}. Only refs/heads/main, refs/tags/*, and pull_request are supported." - exit 1 + echo "base_tag=none" >> $GITHUB_OUTPUT fi - # 2. Build and Push Docker Images for Each Architecture build-push-image: name: Build and Push Docker Image for ${{ matrix.arch }} runs-on: [matterlabs-ci-runner-high-performance] @@ -72,24 +71,18 @@ jobs: echo "tags=none" >> $GITHUB_OUTPUT exit 0 fi - full_tags="us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch} - ghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch} - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag} - ghcr.io/${repo_owner}/anvil-zksync:${base_tag} - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest - ghcr.io/${repo_owner}/anvil-zksync:latest" - echo "tags=${full_tags}" >> $GITHUB_OUTPUT + echo -e "tags=us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch}\nghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch}\nus-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}\nghcr.io/${repo_owner}/anvil-zksync:${base_tag}\nus-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest\nghcr.io/${repo_owner}/anvil-zksync:latest" >> $GITHUB_OUTPUT - - name: Login to GAR + - name: Login to Internal Registry run: | - gcloud auth configure-docker us-docker.pkg.dev -q + echo ${{ secrets.GCP_SA_KEY }} | docker login us-docker.pkg.dev -u _json_key --password-stdin - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.GH_DOCKER }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 From 31dba62844599abc0a871726f44210bdfee2976f Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 11:53:53 -0600 Subject: [PATCH 12/21] debug --- .github/workflows/build-push-docker.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 757c47da..cd1e40ac 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -71,7 +71,9 @@ jobs: echo "tags=none" >> $GITHUB_OUTPUT exit 0 fi - echo -e "tags=us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch}\nghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch}\nus-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}\nghcr.io/${repo_owner}/anvil-zksync:${base_tag}\nus-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest\nghcr.io/${repo_owner}/anvil-zksync:latest" >> $GITHUB_OUTPUT + full_tags="ghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch}" + full_tags="$full_tags us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch}" + echo "tags=${full_tags}" >> $GITHUB_OUTPUT - name: Login to Internal Registry run: | From ceb01f0681b2a3f9ac234a863ff1a8969fac41d9 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 11:55:14 -0600 Subject: [PATCH 13/21] debug --- .github/workflows/build-push-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index cd1e40ac..b5c86775 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -43,7 +43,7 @@ jobs: build-push-image: name: Build and Push Docker Image for ${{ matrix.arch }} - runs-on: [matterlabs-ci-runner-high-performance] + runs-on: [matterlabs-ci-runner] needs: set-tags strategy: matrix: From bbbf6bf6dd027cdccd4ba8e0ac3d1709230022ab Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 11:57:10 -0600 Subject: [PATCH 14/21] debug --- .github/workflows/build-push-docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index b5c86775..2cf3f0f0 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -43,7 +43,7 @@ jobs: build-push-image: name: Build and Push Docker Image for ${{ matrix.arch }} - runs-on: [matterlabs-ci-runner] + runs-on: [matterlabs-ci-runner-high-performance] needs: set-tags strategy: matrix: @@ -75,9 +75,9 @@ jobs: full_tags="$full_tags us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch}" echo "tags=${full_tags}" >> $GITHUB_OUTPUT - - name: Login to Internal Registry + - name: Login to GAR run: | - echo ${{ secrets.GCP_SA_KEY }} | docker login us-docker.pkg.dev -u _json_key --password-stdin + gcloud auth configure-docker us-docker.pkg.dev -q - name: Login to GHCR uses: docker/login-action@v3 From 69d945c3171b20d937d995658cc365dc917f941e Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 11:58:29 -0600 Subject: [PATCH 15/21] debug --- .github/workflows/build-push-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 2cf3f0f0..c54abfe2 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -84,7 +84,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GH_DOCKER }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 From 82a1f71a0a9a20cb8aeba36bc81b80d67ec0771d Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 12:01:55 -0600 Subject: [PATCH 16/21] debug --- .github/workflows/build-push-docker.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index c54abfe2..d52acad9 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -39,7 +39,6 @@ jobs: else echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}. Only refs/heads/main, refs/tags/*, and pull_request are supported." echo "base_tag=none" >> $GITHUB_OUTPUT - fi build-push-image: name: Build and Push Docker Image for ${{ matrix.arch }} @@ -71,9 +70,9 @@ jobs: echo "tags=none" >> $GITHUB_OUTPUT exit 0 fi - full_tags="ghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch}" - full_tags="$full_tags us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch}" - echo "tags=${full_tags}" >> $GITHUB_OUTPUT + echo "ghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch}" >> tags.txt + echo "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch}" >> tags.txt + echo "tags=$(cat tags.txt | tr '\n' ',')" >> $GITHUB_OUTPUT - name: Login to GAR run: | @@ -98,8 +97,11 @@ jobs: platforms: ${{ matrix.platform }} cache-from: type=gha cache-to: type=gha,mode=max - tags: ${{ steps.full_tags.outputs.tags }} + tags: | + ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }} + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }} - name: Print image digest to summary run: | - echo "Image tags: ${{ steps.full_tags.outputs.tags }}" >> $GITHUB_STEP_SUMMARY + echo "Image tags: ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY + echo "Image tags: us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY From b2a0b547c850146504d125573939a7a4e27e1f37 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 12:03:39 -0600 Subject: [PATCH 17/21] debug --- .github/workflows/build-push-docker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index d52acad9..42c42d45 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -38,7 +38,8 @@ jobs: echo "base_tag=none" >> $GITHUB_OUTPUT else echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}. Only refs/heads/main, refs/tags/*, and pull_request are supported." - echo "base_tag=none" >> $GITHUB_OUTPUT + exit 1 + fi build-push-image: name: Build and Push Docker Image for ${{ matrix.arch }} From 6ceb9f9baec88462e981264abdac6a3120bde089 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 12:42:39 -0600 Subject: [PATCH 18/21] test manifest --- .github/workflows/build-push-docker.yml | 42 +++++++++++++++++++++++++ e2e-tests/test/anvil-apis.test.ts | 14 ++++++--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 42c42d45..3208c9ee 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -106,3 +106,45 @@ jobs: run: | echo "Image tags: ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY echo "Image tags: us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY + + create-latest-tag: + name: Create and Push Docker Manifest with "latest" Tag + runs-on: [matterlabs-ci-runner] + needs: + - build-push-image + - set-tags + if: needs.set-tags.outputs.base_tag != 'none' + steps: + - name: Login to GAR + run: | + gcloud auth configure-docker us-docker.pkg.dev -q + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set Repository Owner + run: echo "REPO_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV + + - name: Set Up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create and Push Docker Manifest + run: | + # Create a multi-platform manifest with the "latest" tag + docker buildx imagetools create \ + ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-amd64 \ + ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-arm64 \ + --tag ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:latest + + docker buildx imagetools create \ + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-amd64 \ + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-arm64 \ + --tag us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest + + - name: Print Manifest Tags to Summary + run: | + echo "Manifest tags: latest" >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/e2e-tests/test/anvil-apis.test.ts b/e2e-tests/test/anvil-apis.test.ts index 58ddcca5..26dd52fb 100644 --- a/e2e-tests/test/anvil-apis.test.ts +++ b/e2e-tests/test/anvil-apis.test.ts @@ -93,9 +93,6 @@ describe("anvil_setLoggingEnabled", function () { it("Should disable and enable logging", async function () { const logFilePath = process.env.ANVIL_LOG_PATH || path.resolve("../anvil-zksync.log"); - console.log(`ANVIL_LOG_PATH: ${process.env.ANVIL_LOG_PATH}`); - console.log(`Using logFilePath: ${logFilePath}`); - // Arrange const wallet = new Wallet(RichAccounts[0].PrivateKey, provider); const userWallet = Wallet.createRandom().connect(provider); @@ -103,13 +100,20 @@ describe("anvil_setLoggingEnabled", function () { // Act await provider.send("anvil_setLoggingEnabled", [false]); - const logSizeBefore = fs.statSync(logFilePath).size; + let logSizeBefore = 0; + if (fs.existsSync(logFilePath)) { + logSizeBefore = fs.statSync(logFilePath).size; + } await wallet.sendTransaction({ to: userWallet.address, value: ethers.parseEther("0.1"), }); - const logSizeAfter = fs.statSync(logFilePath).size; + + let logSizeAfter = 0; + if (fs.existsSync(logFilePath)) { + logSizeAfter = fs.statSync(logFilePath).size; + } // Reset await provider.send("anvil_setLoggingEnabled", [true]); From 4e1eb5d70301a61b32970118aaf2c5ebe49b8d85 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 12:43:13 -0600 Subject: [PATCH 19/21] testing manifest --- .github/workflows/build-push-docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 3208c9ee..716d5745 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -134,7 +134,6 @@ jobs: - name: Create and Push Docker Manifest run: | - # Create a multi-platform manifest with the "latest" tag docker buildx imagetools create \ ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-amd64 \ ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-arm64 \ From 5b9ac733378c0ca1b68c3e0e55585dbc2d831147 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 12:58:18 -0600 Subject: [PATCH 20/21] debug --- .github/workflows/build-push-docker.yml | 85 +++---------------------- 1 file changed, 10 insertions(+), 75 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 716d5745..287cc6a6 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -7,6 +7,9 @@ on: tags: - "*" +env: + PLATFORMS: 'linux/amd64,linux/arm64' + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -42,39 +45,12 @@ jobs: fi build-push-image: - name: Build and Push Docker Image for ${{ matrix.arch }} - runs-on: [matterlabs-ci-runner-high-performance] + name: Build and Push Docker Image + runs-on: matterlabs-ci-runner-high-performance needs: set-tags - strategy: - matrix: - include: - - platform: linux/amd64 - arch: amd64 - - platform: linux/arm64 - arch: arm64 steps: - uses: actions/checkout@v4 - - name: Set Base Docker Tag - run: echo "BASE_TAG=${{ needs.set-tags.outputs.base_tag }}" >> $GITHUB_ENV - - - name: Set Repository Owner - run: echo "REPO_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV - - - name: Set Full Docker Tags - id: full_tags - run: | - base_tag="${{ env.BASE_TAG }}" - arch="${{ matrix.arch }}" - repo_owner="${{ env.REPO_OWNER }}" - if [[ "$base_tag" == "none" ]]; then - echo "tags=none" >> $GITHUB_OUTPUT - exit 0 - fi - echo "ghcr.io/${repo_owner}/anvil-zksync:${base_tag}-${arch}" >> tags.txt - echo "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${base_tag}-${arch}" >> tags.txt - echo "tags=$(cat tags.txt | tr '\n' ',')" >> $GITHUB_OUTPUT - - name: Login to GAR run: | gcloud auth configure-docker us-docker.pkg.dev -q @@ -95,55 +71,14 @@ jobs: with: context: . push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/db/multi-platform-docker' || startsWith(github.ref, 'refs/tags/')) }} - platforms: ${{ matrix.platform }} + platforms: ${{ env.PLATFORMS }} cache-from: type=gha cache-to: type=gha,mode=max tags: | - ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }} - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }} + ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }} + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ needs.set-tags.outputs.base_tag }} - name: Print image digest to summary run: | - echo "Image tags: ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY - echo "Image tags: us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ env.BASE_TAG }}-${{ matrix.arch }}" >> $GITHUB_STEP_SUMMARY - - create-latest-tag: - name: Create and Push Docker Manifest with "latest" Tag - runs-on: [matterlabs-ci-runner] - needs: - - build-push-image - - set-tags - if: needs.set-tags.outputs.base_tag != 'none' - steps: - - name: Login to GAR - run: | - gcloud auth configure-docker us-docker.pkg.dev -q - - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set Repository Owner - run: echo "REPO_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV - - - name: Set Up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Create and Push Docker Manifest - run: | - docker buildx imagetools create \ - ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-amd64 \ - ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-arm64 \ - --tag ghcr.io/${{ env.REPO_OWNER }}/anvil-zksync:latest - - docker buildx imagetools create \ - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-amd64 \ - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}-arm64 \ - --tag us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:latest - - - name: Print Manifest Tags to Summary - run: | - echo "Manifest tags: latest" >> $GITHUB_STEP_SUMMARY \ No newline at end of file + echo "Image tags: ghcr.io/${{ github.repository_owner }}/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}" >> $GITHUB_STEP_SUMMARY + echo "Image tags: us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/anvil-zksync:${{ needs.set-tags.outputs.base_tag }}" >> $GITHUB_STEP_SUMMARY \ No newline at end of file From 76874e5fd368fec491e0c0901683ece2b5624f42 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 19 Dec 2024 13:32:39 -0600 Subject: [PATCH 21/21] chore: remove PR test --- .github/workflows/build-push-docker.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 287cc6a6..e16dc783 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -3,7 +3,6 @@ on: push: branches: - main - - db/multi-platform-docker tags: - "*" @@ -33,8 +32,6 @@ jobs: ts=$(date +%s%N | cut -b1-13) if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then echo "base_tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT - elif [[ "${{ github.ref }}" == "refs/heads/db/multi-platform-docker" ]]; then - echo "base_tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT elif [[ "${{ github.ref }}" == refs/tags/* ]]; then echo "base_tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT elif [[ "${{ github.event_name }}" == "pull_request" ]]; then @@ -70,7 +67,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/db/multi-platform-docker' || startsWith(github.ref, 'refs/tags/')) }} + push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} platforms: ${{ env.PLATFORMS }} cache-from: type=gha cache-to: type=gha,mode=max