From f08c111b9db5706b6ab46eb3d634928583da13a7 Mon Sep 17 00:00:00 2001 From: Cesar Alaestante Date: Wed, 8 Oct 2025 10:37:26 -0700 Subject: [PATCH 1/3] fix(ci): set protocol version env in docker buil step --- .github/workflows/sst-gigabugs-deploy.yml | 15 ++++++++++++++- .github/workflows/sst-sandbox-deploy.yml | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sst-gigabugs-deploy.yml b/.github/workflows/sst-gigabugs-deploy.yml index 63e4b2f7f2..d06bd46438 100644 --- a/.github/workflows/sst-gigabugs-deploy.yml +++ b/.github/workflows/sst-gigabugs-deploy.yml @@ -47,6 +47,19 @@ jobs: - name: Install dependencies run: | npm run build-ci + - name: Resolve Zero protocol versions + run: | + PROTOCOL_FILE=packages/zero/out/zero-protocol/src/protocol-version.js + ZERO_SYNC_PROTOCOL_VERSION=$(grep -E "export const PROTOCOL_VERSION" "$PROTOCOL_FILE" | sed -E "s/.*= ([0-9]+);/\1/") + ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=$(grep -E "export const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL" "$PROTOCOL_FILE" | sed -E "s/.*= ([0-9]+);/\1/") + if [ -z "$ZERO_SYNC_PROTOCOL_VERSION" ] || [ -z "$ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION" ]; then + echo "Could not extract protocol versions from $PROTOCOL_FILE" + exit 1 + fi + { + echo "ZERO_SYNC_PROTOCOL_VERSION=$ZERO_SYNC_PROTOCOL_VERSION" + echo "ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=$ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION" + } >> "$GITHUB_ENV" - name: Create package tarball run: | cd packages/zero @@ -67,7 +80,7 @@ jobs: cd packages/zero docker buildx create --use docker buildx inspect --bootstrap - docker buildx build --platform linux/amd64 --build-arg ZERO_VERSION=${{ env.ZERO_VERSION }} -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_IMAGE_ZERO_CACHE:${{ env.SHA }} -f ./Dockerfile --push . + docker buildx build --platform linux/amd64 --build-arg ZERO_VERSION=${{ env.ZERO_VERSION }} --build-arg ZERO_SYNC_PROTOCOL_VERSION=${{ env.ZERO_SYNC_PROTOCOL_VERSION }} --build-arg ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=${{ env.ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION }} -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_IMAGE_ZERO_CACHE:${{ env.SHA }} -f ./Dockerfile --push . - name: Deploy SST app env: ZERO_UPSTREAM_DB: ${{ secrets.GIGABUGS_ZERO_UPSTREAM_DB }} diff --git a/.github/workflows/sst-sandbox-deploy.yml b/.github/workflows/sst-sandbox-deploy.yml index 413331faa8..e677a5a2eb 100644 --- a/.github/workflows/sst-sandbox-deploy.yml +++ b/.github/workflows/sst-sandbox-deploy.yml @@ -47,6 +47,19 @@ jobs: - name: Install dependencies run: | npm run build-ci + - name: Resolve Zero protocol versions + run: | + PROTOCOL_FILE=packages/zero/out/zero-protocol/src/protocol-version.js + ZERO_SYNC_PROTOCOL_VERSION=$(grep -E "export const PROTOCOL_VERSION" "$PROTOCOL_FILE" | sed -E "s/.*= ([0-9]+);/\1/") + ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=$(grep -E "export const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL" "$PROTOCOL_FILE" | sed -E "s/.*= ([0-9]+);/\1/") + if [ -z "$ZERO_SYNC_PROTOCOL_VERSION" ] || [ -z "$ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION" ]; then + echo "Could not extract protocol versions from $PROTOCOL_FILE" + exit 1 + fi + { + echo "ZERO_SYNC_PROTOCOL_VERSION=$ZERO_SYNC_PROTOCOL_VERSION" + echo "ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=$ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION" + } >> "$GITHUB_ENV" - name: Get Git SHA id: git-sha run: echo "SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV @@ -62,7 +75,7 @@ jobs: cd packages/zero docker buildx create --use docker buildx inspect --bootstrap - docker buildx build --platform linux/amd64 --build-arg ZERO_VERSION=${{ env.ZERO_VERSION }} -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_IMAGE_ZERO_CACHE:${{ env.SHA }} -f ./Dockerfile --push . + docker buildx build --platform linux/amd64 --build-arg ZERO_VERSION=${{ env.ZERO_VERSION }} --build-arg ZERO_SYNC_PROTOCOL_VERSION=${{ env.ZERO_SYNC_PROTOCOL_VERSION }} --build-arg ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=${{ env.ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION }} -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_IMAGE_ZERO_CACHE:${{ env.SHA }} -f ./Dockerfile --push . - name: Deploy SST app env: ZERO_UPSTREAM_DB: ${{ secrets.SANDBOX_ZERO_UPSTREAM_DB }} From 75bec53cd30da9707ebaac69145fe79b61532bd8 Mon Sep 17 00:00:00 2001 From: Cesar Alaestante Date: Wed, 8 Oct 2025 10:42:51 -0700 Subject: [PATCH 2/3] test branch on sandbox --- .github/workflows/sst-sandbox-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sst-sandbox-deploy.yml b/.github/workflows/sst-sandbox-deploy.yml index e677a5a2eb..e1b3c676bf 100644 --- a/.github/workflows/sst-sandbox-deploy.yml +++ b/.github/workflows/sst-sandbox-deploy.yml @@ -2,7 +2,7 @@ name: Build and Deploy Sandbox Zero-Cache AWS SST on: push: - branches: [sandbox] + branches: [sandbox, cesara/ci_fix_protocol_version] env: # Setting an environment variable with the value of a configuration variable ECR_IMAGE_ZERO_CACHE: zero-zbugs-sandbox From b88e9a569cabec887fe912a0bc364979813feda6 Mon Sep 17 00:00:00 2001 From: Cesar Alaestante Date: Wed, 8 Oct 2025 10:48:19 -0700 Subject: [PATCH 3/3] tested against sandbox --- .github/workflows/sst-prod-deploy.yml | 15 ++++++++++++++- .github/workflows/sst-sandbox-deploy.yml | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sst-prod-deploy.yml b/.github/workflows/sst-prod-deploy.yml index 62dd89ea5e..f62b856c22 100644 --- a/.github/workflows/sst-prod-deploy.yml +++ b/.github/workflows/sst-prod-deploy.yml @@ -47,6 +47,19 @@ jobs: - name: Install dependencies run: | npm run build-ci + - name: Resolve Zero protocol versions + run: | + PROTOCOL_FILE=packages/zero/out/zero-protocol/src/protocol-version.js + ZERO_SYNC_PROTOCOL_VERSION=$(grep -E "export const PROTOCOL_VERSION" "$PROTOCOL_FILE" | sed -E "s/.*= ([0-9]+);/\1/") + ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=$(grep -E "export const MIN_SERVER_SUPPORTED_SYNC_PROTOCOL" "$PROTOCOL_FILE" | sed -E "s/.*= ([0-9]+);/\1/") + if [ -z "$ZERO_SYNC_PROTOCOL_VERSION" ] || [ -z "$ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION" ]; then + echo "Could not extract protocol versions from $PROTOCOL_FILE" + exit 1 + fi + { + echo "ZERO_SYNC_PROTOCOL_VERSION=$ZERO_SYNC_PROTOCOL_VERSION" + echo "ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=$ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION" + } >> "$GITHUB_ENV" - name: Get Git SHA id: git-sha run: echo "SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV @@ -62,7 +75,7 @@ jobs: cd packages/zero docker buildx create --use docker buildx inspect --bootstrap - docker buildx build --platform linux/amd64 --build-arg ZERO_VERSION=${{ env.ZERO_VERSION }} -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_IMAGE_ZERO_CACHE:${{ env.SHA }} -f ./Dockerfile --push . + docker buildx build --platform linux/amd64 --build-arg ZERO_VERSION=${{ env.ZERO_VERSION }} --build-arg ZERO_SYNC_PROTOCOL_VERSION=${{ env.ZERO_SYNC_PROTOCOL_VERSION }} --build-arg ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION=${{ env.ZERO_MIN_SUPPORTED_SYNC_PROTOCOL_VERSION }} -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_IMAGE_ZERO_CACHE:${{ env.SHA }} -f ./Dockerfile --push . - name: Deploy SST app env: ZERO_UPSTREAM_DB: ${{ secrets.PROD_ZERO_UPSTREAM_DB }} diff --git a/.github/workflows/sst-sandbox-deploy.yml b/.github/workflows/sst-sandbox-deploy.yml index e1b3c676bf..e677a5a2eb 100644 --- a/.github/workflows/sst-sandbox-deploy.yml +++ b/.github/workflows/sst-sandbox-deploy.yml @@ -2,7 +2,7 @@ name: Build and Deploy Sandbox Zero-Cache AWS SST on: push: - branches: [sandbox, cesara/ci_fix_protocol_version] + branches: [sandbox] env: # Setting an environment variable with the value of a configuration variable ECR_IMAGE_ZERO_CACHE: zero-zbugs-sandbox