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

chore: squash yp ypb + other build improvements. #4901

Merged
merged 38 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f103ab0
Login to ecr explicitly, faster bootstrap as we only do once.
charlielye Mar 2, 2024
88167c0
Combine ypb and yp dockerfiles. Build as multiarch using host machines.
charlielye Mar 2, 2024
dea3b2a
fix
charlielye Mar 2, 2024
a82f453
[ci rebuild yarn-project] [ci rebuild yarn-project-prod]
charlielye Mar 2, 2024
7bb293b
Combine yp and ypp
charlielye Mar 2, 2024
adfb6e0
add no-term [ci no-term yarn-project]
charlielye Mar 2, 2024
96dd1f0
bump to 64 cores
charlielye Mar 2, 2024
37d0d10
don't do unlimited parallelisation
charlielye Mar 3, 2024
296760c
FROM sub fix.
charlielye Mar 3, 2024
5b64345
Separate build and test.
charlielye Mar 3, 2024
7cf3c5a
wip
charlielye Mar 3, 2024
c3d271a
wip
charlielye Mar 3, 2024
c64df6b
wip
charlielye Mar 3, 2024
57f28f9
wip
charlielye Mar 3, 2024
d6d0b65
wip
charlielye Mar 4, 2024
daa3d58
wip
charlielye Mar 4, 2024
55f45c1
wip
charlielye Mar 4, 2024
6b24f96
wip
charlielye Mar 4, 2024
ef72e8b
wip
charlielye Mar 4, 2024
967afb8
wip
charlielye Mar 4, 2024
7a52747
rm ypb
charlielye Mar 4, 2024
fafe742
remove all dockerignore files. bootstrap_docker will generate.
charlielye Mar 4, 2024
3e33e83
fix
charlielye Mar 4, 2024
1b2fc01
wip
charlielye Mar 4, 2024
3cd5b38
wip
charlielye Mar 4, 2024
e311b5a
wip
charlielye Mar 4, 2024
124d2c3
wip
charlielye Mar 4, 2024
58a787c
wip
charlielye Mar 4, 2024
81c4ac6
Merge remote-tracking branch 'origin' into cl/squash-yp-ypb
charlielye Mar 4, 2024
f1ef393
Not sure why i was substituting. Lets see... [ci rebuild]
charlielye Mar 4, 2024
667ef02
Not sure why i was substituting. Lets see... [ci rebuild]
charlielye Mar 4, 2024
b899f1e
fix [ci rebuild cli] [ci rebuild aztec]
charlielye Mar 4, 2024
e3999c0
Merge remote-tracking branch 'origin' into cl/squash-yp-ypb
charlielye Mar 4, 2024
1b4882e
[ci rebuild]
charlielye Mar 4, 2024
b9e03ca
revert docs changes
charlielye Mar 4, 2024
fa1a262
Merge remote-tracking branch 'origin' into cl/squash-yp-ypb
charlielye Mar 4, 2024
45f4622
revert
charlielye Mar 4, 2024
572ec4a
Merge remote-tracking branch 'origin/master' into cl/squash-yp-ypb
charlielye Mar 4, 2024
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
111 changes: 45 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,77 +435,62 @@ jobs:
command: build noir-projects
aztec_manifest_key: noir-projects

boxes-files:
machine:
image: default
resource_class: medium
yarn-project-pre-join:
docker:
- image: cimg/base:2023.09
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Build"
command: build boxes-files
aztec_manifest_key: boxes-files
name: "Noop"
command: echo Noop

yarn-project-base:
machine:
image: default
resource_class: large
yarn-project-x86_64:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Build"
command: build yarn-project-base | add_timestamps
aztec_manifest_key: yarn-project-base
command: cond_spot_run_build yarn-project 64
aztec_manifest_key: yarn-project

yarn-project:
machine:
image: default
resource_class: large
yarn-project-arm64:
docker:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly in favour of just having project: and project-arm64:, but not a big deal

- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: Build
command: build yarn-project | add_timestamps
name: "Build"
command: cond_spot_run_build yarn-project 64 arm64
aztec_manifest_key: yarn-project

yarn-project-prod:
yarn-project-ecr-manifest:
machine:
image: default
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: Build
command: build yarn-project-prod | add_timestamps
aztec_manifest_key: yarn-project-prod

yarn-project-formatting:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
resource_class: medium
steps:
- *checkout
- *setup_env
- run:
name: Check Formatting
command: cond_spot_run_container yarn-project 8 formatting | add_timestamps
name: "Create ECR manifest"
command: create_ecr_manifest yarn-project x86_64,arm64
aztec_manifest_key: yarn-project

yarn-project-tests:
yarn-project-test:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: Test
command: cond_spot_run_container yarn-project 64 test | add_timestamps
aztec_manifest_key: yarn-project
name: "Build and test"
command: cond_spot_run_build yarn-project-test 64
aztec_manifest_key: yarn-project-test

aztec-package:
machine:
Expand Down Expand Up @@ -711,7 +696,6 @@ jobs:
command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_authwit.test.ts
aztec_manifest_key: end-to-end


e2e-blacklist-token-contract:
docker:
- image: aztecprotocol/alpine-build-image
Expand Down Expand Up @@ -986,7 +970,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose-browser.yml TEST=e2e_aztec_js_browser.test.ts
command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_aztec_js_browser.test.ts
aztec_manifest_key: end-to-end

e2e-card-game:
Expand Down Expand Up @@ -1140,9 +1124,6 @@ jobs:
steps:
- *checkout
- *setup_env
- run:
name: "Copy docs dockerignore"
command: cp docs/.dockerignore .
- run:
name: "Build docs"
command: |
Expand Down Expand Up @@ -1306,14 +1287,14 @@ defaults: &defaults
event: fail
branch_pattern: "master"

defaults_yarn_project: &defaults_yarn_project
defaults_yarn_project_pre_join: &defaults_yarn_project_pre_join
requires:
- yarn-project
- yarn-project-pre-join
<<: *defaults

defaults_yarn_project_prod: &defaults_yarn_project_prod
defaults_yarn_project: &defaults_yarn_project
requires:
- yarn-project-prod
- yarn-project-ecr-manifest
<<: *defaults

defaults_deploy: &defaults_deploy
Expand Down Expand Up @@ -1407,37 +1388,35 @@ workflows:

- yellow-paper: *defaults

- boxes-files: *defaults

- noir-projects:
requires:
- avm-transpiler
- noir-ecr-manifest
<<: *defaults

# Yarn Project
- yarn-project-base:
- yarn-project-pre-join:
requires:
- bb-js
- noir-packages
<<: *defaults
- yarn-project:
requires:
- yarn-project-base
- l1-contracts
- noir-projects
- boxes-files
<<: *defaults
- yarn-project-prod: *defaults_yarn_project
- yarn-project-formatting: *defaults_yarn_project
- yarn-project-tests: *defaults_yarn_project
- end-to-end: *defaults_yarn_project
- build-docs: *defaults_yarn_project
- end-to-end: *defaults_yarn_project_pre_join
- aztec-faucet: *defaults_yarn_project_pre_join
- build-docs: *defaults_yarn_project_pre_join
- yarn-project-test: *defaults_yarn_project_pre_join
- yarn-project-x86_64: *defaults_yarn_project_pre_join
- yarn-project-arm64: *defaults_yarn_project_pre_join
- yarn-project-ecr-manifest:
requires:
- yarn-project-x86_64
- yarn-project-arm64
<<: *defaults

# Artifacts
- aztec-package: *defaults_yarn_project_prod
- cli: *defaults_yarn_project_prod
- aztec-faucet: *defaults_yarn_project_prod
- aztec-package: *defaults_yarn_project
- cli: *defaults_yarn_project

# Boxes.
- boxes:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ cmake-build-debug

.graphite*
.DS_Store

**/*.dockerignore
7 changes: 0 additions & 7 deletions avm-transpiler/Dockerfile.dockerignore

This file was deleted.

11 changes: 0 additions & 11 deletions barretenberg/.dockerignore

This file was deleted.

3 changes: 0 additions & 3 deletions barretenberg/acir_tests/.dockerignore

This file was deleted.

27 changes: 0 additions & 27 deletions barretenberg/cpp/.dockerignore

This file was deleted.

8 changes: 1 addition & 7 deletions barretenberg/sol/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,14 @@ RUN apk update && apk add git curl build-base openmp-dev bash
COPY --from=0 /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/build/bin
COPY --from=0 /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
WORKDIR /usr/src/barretenberg/sol
RUN git init
COPY ./sol .

# Copy forge binary directly from foundry
COPY --from=ghcr.io/foundry-rs/foundry:latest /usr/local/bin/forge /usr/local/bin/forge

RUN forge install --no-commit \
https://github.com/foundry-rs/forge-std \
https://github.com/openzeppelin/openzeppelin-contracts \
https://github.com/Arachnid/solidity-stringutils

RUN cd ../cpp/srs_db && ./download_ignition.sh 3 && cd ../../sol

RUN ./scripts/init.sh

# TestBase is excluded as it is just boilerplate
# TestBase is excluded as it is just boilerplate
RUN forge test --no-match-contract TestBase
7 changes: 0 additions & 7 deletions barretenberg/ts/.dockerignore

This file was deleted.

9 changes: 0 additions & 9 deletions boxes/.dockerignore

This file was deleted.

3 changes: 2 additions & 1 deletion boxes/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Builds the boxes (they were copied into yarn-project-base so the cli can unbox).
# Produces a container that can be run to test a specific box. See docker-compose.yml.
FROM aztecprotocol/aztec AS aztec
FROM aztecprotocol/noir as noir
Expand All @@ -10,7 +9,9 @@ RUN apt update && apt install netcat-openbsd
COPY --from=aztec /usr/src /usr/src
COPY --from=noir /usr/src/noir/noir-repo/target/release/nargo /usr/src/noir/noir-repo/target/release/nargo
COPY --from=noir-projects /usr/src/noir-projects/aztec-nr /usr/src/noir-projects/aztec-nr
COPY --from=noir-projects /usr/src/noir-projects/noir-protocol-circuits/crates/types /usr/src/noir-projects/noir-protocol-circuits/crates/types
WORKDIR /usr/src/boxes
COPY . .
ENV AZTEC_NARGO=/usr/src/noir/noir-repo/target/release/nargo
ENV AZTEC_CLI=/usr/src/yarn-project/cli/aztec-cli-dest
RUN yarn && yarn build
Expand Down
4 changes: 0 additions & 4 deletions boxes/Dockerfile.files

This file was deleted.

28 changes: 5 additions & 23 deletions build-system/scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,6 @@ echo "Working directory: $PWD"
echo "Dockerfile: $DOCKERFILE"
echo "Build directory: $BUILD_DIR"

# Fetch images with retries
function fetch_image() {
echo "Pulling: $1"
if ! retry docker pull $1 > /dev/null 2>&1; then
echo "Image not found: $1"
return 1
fi
return 0
}

# Fetch images, but don't assume this will work
function try_fetch_image() {
echo "Pulling: $1"
if ! docker pull $1 > /dev/null 2>&1; then
echo "Image not found: $1"
return 1
fi
return 0
}

NOREPO=$(query_manifest noRepo $REPOSITORY)

# Login to ECR and ensure repository exists.
retry ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle
# Login to dockerhub.
Expand Down Expand Up @@ -91,6 +69,7 @@ if [ -d $ROOT_PATH/$PROJECT_DIR/terraform ]; then
fi

# For each dependency, substitute references to the dependency in dockerfile, with the relevent built image uri.
# This is necessary vs pulling and retagging the image, as that doesn't work with buildx.
# We have to perform a bit of probing to determine which actual image we want to use.
# When we used buildx to create a multiarch image, there will be no images with "-$ARCH" suffixes (normalise this?).
# Also we sometimes build an arm image from an x86 parent, so there won't always be an arm parent, and we fallback.
Expand All @@ -115,9 +94,12 @@ for PARENT_REPO in $(query_manifest dependencies $REPOSITORY); do
# Substitute references to parent repo, with the relevent built image uri.
DEPLOY_URI=aztecprotocol/$PARENT_REPO
PARENT_IMAGE_URI=$ECR_URL/$PARENT_REPO:$PARENT_IMAGE_TAG
awk '{if ($1 == "FROM" && $2 == "'$DEPLOY_URI'") $2 = "'$PARENT_IMAGE_URI'"; print $0}' $DOCKERFILE > _temp && mv _temp $DOCKERFILE
sed -i "s#^FROM \\(.*\\)${DEPLOY_URI}\\( \|$\\)#FROM \\1${PARENT_IMAGE_URI}\\2#" $DOCKERFILE
done

# Build a dockerignore file that only permits git files and untracked files.
create_dockerignore $REPOSITORY

COMMIT_TAG_VERSION=$(extract_tag_version $REPOSITORY false)
echo "Commit tag version: $COMMIT_TAG_VERSION"

Expand Down
Loading
Loading