Skip to content

Commit

Permalink
chore(ci): set correct image version in aztec image docker releases (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 authored Jan 22, 2025
1 parent c047a12 commit 197db95
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 33 deletions.
69 changes: 37 additions & 32 deletions .github/workflows/publish-aztec-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
runs-on: ubuntu-latest
outputs:
username: ${{ steps.compute_username.outputs.username }}
version: ${{ steps.set_version.outputs.version }}
dist_tag: ${{ steps.set_version.outputs.dist_tag }}
steps:
- name: Compute Username
id: compute_username
Expand All @@ -58,6 +60,25 @@ jobs:
echo "username=master-${GIT_HASH_MODULO_8}"
echo "username=master-${GIT_HASH_MODULO_8}" >> $GITHUB_OUTPUT
fi
- name: Set version and tags
id: set_version
run: |
if [[ "${{ github.ref_name }}" =~ ^release/ ]]; then
echo "dist_tag=devnet" >> $GITHUB_OUTPUT
TAG="${{ github.ref_name }}"
VERSION="${TAG#release/}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${DEPLOY_TAG#aztec-packages-v}-devnet
fi
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "dist_tag=latest" >> $GITHUB_OUTPUT
TAG=${{ env.DEPLOY_TAG }}
VERSION=${TAG#aztec-packages-v}
else
echo "dist_tag=$(echo "${{ github.ref_name }}" | sed 's/\//-/g')" >> $GITHUB_OUTPUT
VERSION=""
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag is valid
id: check_tag
if: github.event_name == 'workflow_dispatch'
Expand Down Expand Up @@ -101,10 +122,13 @@ jobs:
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"
- name: Build & Push Aztec and End-to-End x86_64
timeout-minutes: 40
env:
VERSION: ${{ needs.configure.outputs.version }}
run: |
./bootstrap.sh image-aztec
./bootstrap.sh image-aztec --version $VERSION
docker tag aztecprotocol/aztec:${{ env.GIT_COMMIT }} aztecprotocol/aztec:${{ env.GIT_COMMIT }}-x86_64
docker push aztecprotocol/aztec:${{ env.GIT_COMMIT }}-x86_64
build-aztec-arm:
needs: [configure, setup-arm]
runs-on: ${{ needs.configure.outputs.username }}-arm
Expand All @@ -118,11 +142,14 @@ jobs:
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"
- name: Build & Push Aztec arm64
timeout-minutes: 80
env:
VERSION: ${{ needs.configure.outputs.version }}
run: |
sudo shutdown -P 80
./bootstrap.sh image-aztec --check-arch
./bootstrap.sh image-aztec --check-arch --version $VERSION
docker tag aztecprotocol/aztec:${{ env.GIT_COMMIT }} aztecprotocol/aztec:${{ env.GIT_COMMIT }}-arm64
docker push aztecprotocol/aztec:${{ env.GIT_COMMIT }}-arm64
build-nargo-x86:
needs: [configure, build-aztec-x86]
runs-on: ${{ needs.configure.outputs.username }}-x86
Expand Down Expand Up @@ -202,20 +229,10 @@ jobs:
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"
- name: Publish aztec manifests
if: ${{ env.SHOULD_PUBLISH_DOCKER_IMAGES == 'true' }}
env:
VERSION: ${{ needs.configure.outputs.version }}
DIST_TAG: ${{ needs.configure.outputs.dist_tag }}
run: |
if [[ "${{ github.ref_name }}" =~ ^release/ ]]; then
TAG="${{ github.ref_name }}"
VERSION="${TAG#release/}"
DIST_TAG=devnet
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
TAG=${{ env.DEPLOY_TAG }}
VERSION=${TAG#aztec-packages-v}
DIST_TAG=latest
else
VERSION=""
DIST_TAG=$(echo "${{ github.ref_name }}" | sed 's/\//-/g')
fi
docker pull aztecprotocol/aztec:${{ env.GIT_COMMIT }}-x86_64
docker pull aztecprotocol/aztec:${{ env.GIT_COMMIT }}-arm64
docker pull aztecprotocol/aztec-nargo:${{ env.GIT_COMMIT }}-x86_64
Expand Down Expand Up @@ -271,29 +288,17 @@ jobs:
concurrency_key: publish-npm
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"

- name: Set tags and versions
id: version_step
run: |
if [[ "${{ github.ref_name }}" =~ ^release/ ]]; then
DIST_TAG=devnet
TAG=${{ env.DEPLOY_TAG }}
VERSION=${TAG#aztec-packages-v}-devnet
else
DIST_TAG=latest
TAG=${{ env.DEPLOY_TAG }}
VERSION=${TAG#aztec-packages-v}
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "DIST_TAG=$DIST_TAG" >> $GITHUB_OUTPUT
- name: Publish bb.js NPM package
env:
VERSION: ${{ needs.configure.outputs.version }}
DIST_TAG: ${{ needs.configure.outputs.dist_tag }}
run: |
earthly-ci \
--no-output \
--secret NPM_TOKEN=${{ env.NPM_TOKEN }} \
./barretenberg/ts+publish-npm \
--DIST_TAG=${{ steps.version_step.outputs.DIST_TAG }} \
--VERSION=${{ steps.version_step.outputs.VERSION }} \
--DIST_TAG=$DIST_TAG \
--VERSION=$VERSION \
--DRY_RUN=${{ (github.event.inputs.publish == 'false') && '1' || '0' }}
- name: Publish yarn-project NPM packages
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile.aztec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ ENV BB_BINARY_PATH=/usr/src/barretenberg/cpp/build/bin/bb
ENV ACVM_WORKING_DIRECTORY=/usr/src/acvm
ENV ACVM_BINARY_PATH=/usr/src/noir/noir-repo/target/release/acvm
RUN mkdir -p $BB_WORKING_DIRECTORY $ACVM_WORKING_DIRECTORY /usr/src/yarn-project/world-state/build

COPY /usr/src /usr/src

# Set the version returned in getNodeVersion to current version
# aztec-base assumed to have jq installed
ARG VERSION=0.1.0
RUN if [ -n "$VERSION" ]; then \
echo "Setting version to $VERSION"; \
cat /usr/src/yarn-project/aztec-node/package.json | jq --arg version "$VERSION" '.version = $version' > /usr/src/yarn-project/aztec-node/package.tmp.json; \
mv /usr/src/yarn-project/aztec-node/package.tmp.json /usr/src/yarn-project/aztec-node/package.json; \
fi

ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/aztec/dest/bin/index.js"]
ARG PORT=8080
ENV PORT=$PORT
Expand Down
10 changes: 9 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,18 @@ case "$cmd" in
"image-aztec")
image=aztecprotocol/aztec:$(git rev-parse HEAD)
check_arch=false
version="0.1.0"

# Check for --check-arch flag in args
for arg in "$@"; do
if [ "$arg" = "--check-arch" ]; then
check_arch=true
break
fi
if [ "$arg" = "--version" ]; then
version=$2
shift 2
fi
done

docker pull $image &>/dev/null || true
Expand All @@ -224,6 +229,8 @@ case "$cmd" in
else
echo "Image $image already exists and has been downloaded with correct architecture." && exit
fi
elif [ -n "$version" ]; then
echo "Image $image already exists and has been downloaded. Setting version to $version."
else
echo "Image $image already exists and has been downloaded." && exit
fi
Expand All @@ -237,7 +244,8 @@ case "$cmd" in
echo "docker image build:"
docker pull aztecprotocol/aztec-base:v1.0-$(arch)
docker tag aztecprotocol/aztec-base:v1.0-$(arch) aztecprotocol/aztec-base:latest
docker build -f Dockerfile.aztec -t $image $TMP
docker build -f Dockerfile.aztec -t $image $TMP --build-arg VERSION=$version

if [ "${CI:-0}" = 1 ]; then
docker push $image
fi
Expand Down

0 comments on commit 197db95

Please sign in to comment.