Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: publish cli image to dockerhub #7274

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: CI
on:
push:
branches: [master]
pull_request: {}
pull_request:
branches-ignore: [devnet]
workflow_dispatch:
inputs: {}

Expand Down
31 changes: 24 additions & 7 deletions .github/workflows/devnet-deploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ jobs:
run: |
earthly-ci --no-output --push ./yarn-project+export-aztec-arch --DIST_TAG=${{ env.DEPLOY_TAG }}

- name: Check if L1 contracts need deployment
id: check_changes_build
uses: actions/github-script@v7
with:
script: |
const { execSync } = require('child_process');
const changedFiles = execSync('git diff --name-only ${{ github.event.before }} ${{ github.sha }}').toString().split('\n');
const fileChanged = changedFiles.includes('l1-contracts/REDEPLOY');
return fileChanged

- name: "Build & Push cli image"
if: steps.check_changes_build.outputs.result == 'true'
timeout-minutes: 40
# Run the build steps for each image with version and arch, push to dockerhub
run: |
earthly-ci --no-output --push ./yarn-project+export-cli --DIST_TAG=${{ env.DEPLOY_TAG }}

terraform_deploy:
runs-on: ubuntu-latest
needs: build
Expand All @@ -67,26 +84,26 @@ jobs:
aws-region: us-west-2

- name: Check if L1 contracts need deployment
id: check_changes
id: check_changes_release
uses: actions/github-script@v7
with:
script: |
const { execSync } = require('child_process');
const changedFiles = execSync('git diff --name-only ${{ github.event.before }} ${{ github.sha }}').toString().split('\n');
const fileChanged = changedFiles.includes('l1-contracts/REDEPLOY');
return fileChanged

- name: Deploy L1 Contracts
if: steps.check_changes.outputs.result == 'true'
if: steps.check_changes_release.outputs.result == 'true'
run: |
earthly-ci --no-output ./yarn-project/cli+deploy-l1-contracts \
--PRIVATE_KEY=${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} \
--RPC_URL=https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ secrets.FORK_API_KEY }} \
docker pull aztecprotocol/cli:${{ env.DEPLOY_TAG }}
docker run -ti --rm aztecprotocol/cli:${{ env.DEPLOY_TAG }} \
deploy-l1-contracts -p ${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} \
-u https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ secrets.FORK_API_KEY }} \
| tee ${{ env.FILE_PATH }}
./.github/gstscripts/extract_l1_addresses.sh ${{ env.FILE_PATH }}

- name: Apply l1-contracts Terraform
if: steps.check_changes.outputs.result == 'true'
if: steps.check_changes_release.outputs.result == 'true'
working-directory: ./l1-contracts/terraform
run: |
terraform init -input=false -backend-config="key=${{ env.DEPLOY_TAG }}/l1-contracts"
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/REDEPLOY
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Append value to force redeploy
2
1
43 changes: 37 additions & 6 deletions yarn-project/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,43 @@ aztec-faucet:
ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/aztec-faucet/dest/bin/index.js"]
LET port=8080

export-aztec-faucet:
FROM +aztec-faucet
ARG DIST_TAG="latest"
ARG ARCH
SAVE IMAGE --push aztecprotocol/aztec-faucet:${DIST_TAG}${ARCH:+-$ARCH}

cli-build:
FROM +build
RUN yarn workspaces focus @aztec/cli --production && yarn cache clean
RUN rm -rf \
../noir-projects \
../l1-contracts \
../barretenberg/ts/src \
../barretenberg/ts/dest/node-cjs \
../barretenberg/ts/dest/browser \
aztec.js/dest/main.js \
end-to-end \
**/src \
**/artifacts
SAVE ARTIFACT /usr/src /usr/src

cli:
FROM ubuntu:noble
RUN apt update && apt install nodejs curl -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY +cli-build/usr/src /usr/src

RUN mkdir /cache && chmod 777 /cache
ENV XDG_CACHE_HOME /cache
VOLUME "/cache"
ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/cli/dest/bin/index.js"]

export-cli:
FROM +cli
ARG DIST_TAG="latest"
ARG ARCH
SAVE IMAGE --push aztecprotocol/cli:${DIST_TAG}${ARCH:+-$ARCH}

# We care about creating a slimmed down e2e image because we have to serialize it from earthly to docker for running.
end-to-end-prod:
FROM +build
Expand Down Expand Up @@ -252,12 +289,6 @@ export-aztec-arch:
ARG ARCH
SAVE IMAGE --push aztecprotocol/aztec:${DIST_TAG}${ARCH:+-$ARCH}

export-aztec-faucet:
FROM +aztec-faucet
ARG DIST_TAG="latest"
ARG ARCH
SAVE IMAGE --push aztecprotocol/aztec-faucet:${DIST_TAG}${ARCH:+-$ARCH}

export-end-to-end:
ARG EARTHLY_GIT_HASH
FROM +end-to-end
Expand Down
4 changes: 3 additions & 1 deletion yarn-project/cli/Earthfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
VERSION 0.8


aztec-cli:
export-aztec-cli:
FROM ../+build
ARG DIST_TAG="latest"
RUN yarn workspaces focus @aztec/cli --production && yarn cache clean

RUN mkdir /cache && chmod 777 /cache
ENV XDG_CACHE_HOME /cache
VOLUME "/cache"
ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/cli/dest/bin/index.js"]
SAVE IMAGE aztecprotocol/cli:${DIST_TAG}

deploy-l1-contracts:
FROM +aztec-cli
Expand Down