-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: bootstrap improvements. (#4711)
* `l1-contracts` cli cache bootstrappable. * `noir-contracts` cli cache bootstrappable. * `bootstrap.sh` will always attempt to pull from cli cache if the user has docker and aws-credentials. * `bootstrap.sh full` will skip trying to use the cache. * `avm-transpiler` builds on focal for better compatability. * New script `remove_old_images` removes all docker images for a repo, older than the current content hash. Prevents local disk usage explosion. Called both after bootstrapping from cache, and as part of `bootstrap_docker.sh`. * Reduced `retry` from 10s to 5s. Can be disabled with `RETRY_DISABLED=1` env var.
- Loading branch information
1 parent
cc8ccdb
commit 1375233
Showing
23 changed files
with
147 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1 | ||
|
||
cd "$(dirname "$0")" | ||
source ../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null | ||
|
||
echo -e "\033[1mRetrieving avm-transpiler from remote cache...\033[0m" | ||
extract_repo avm-transpiler \ | ||
/usr/src/avm-transpiler/target/release/avm-transpiler ./target/release/ | ||
|
||
remove_old_images avm-transpiler |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1 | ||
|
||
cd "$(dirname "$0")" | ||
source ../../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null | ||
|
||
echo -e "\033[1mRetrieving bb.wasm from remote cache...\033[0m" | ||
extract_repo barretenberg-wasm-linux-clang \ | ||
/usr/src/barretenberg/cpp/build-wasm/bin ./cpp/build-wasm \ | ||
/usr/src/barretenberg/cpp/build-wasm-threads/bin ./cpp/build-wasm-threads | ||
|
||
remove_old_images barretenberg-wasm-linux-clang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1 | ||
|
||
cd "$(dirname "$0")" | ||
source ../../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null | ||
|
||
echo -e "\033[1mRetrieving bb.js from remote cache...\033[0m" | ||
extract_repo bb.js /usr/src/barretenberg/ts/dest . | ||
# Annoyingly we still need to install modules, so they can be found as part of module resolution when portalled. | ||
yarn install | ||
|
||
remove_old_images bb.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
# Removes all cache-* docker images for the given repository that are not the current content hash. | ||
[ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace | ||
set -eu | ||
|
||
REPOSITORY=$1 | ||
shift | ||
|
||
IMAGE_COMMIT_URI=$(calculate_image_uri $REPOSITORY) | ||
for IMAGE in $(docker images --format "{{.ID}}" $ECR_URL/$REPOSITORY --filter "before=$IMAGE_COMMIT_URI"); do | ||
echo "Removing $IMAGE..." | ||
docker rmi --force $IMAGE | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
if [ -n "${RETRY_DISABLED:-}" ]; then | ||
"$@" && exit || exit 1 | ||
fi | ||
|
||
ATTEMPTS=3 | ||
# Retries up to 3 times with 10 second intervals | ||
# Retries up to 3 times with 5 second intervals | ||
for i in $(seq 1 $ATTEMPTS); do | ||
"$@" && exit || sleep 10 | ||
"$@" && exit | ||
[ "$i" != "$ATTEMPTS" ] && sleep 5 | ||
done | ||
|
||
>&2 echo "$@ failed after $ATTEMPTS attempts" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1 | ||
|
||
cd "$(dirname "$0")" | ||
source ../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null | ||
|
||
echo -e "\033[1mRetrieving contracts from remote cache...\033[0m" | ||
extract_repo l1-contracts /usr/src/l1-contracts/out . | ||
|
||
remove_old_images l1-contracts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir as noir | ||
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/avm-transpiler as transpiler | ||
FROM ubuntu:lunar | ||
|
||
FROM ubuntu:lunar AS builder | ||
# Copy in nargo | ||
COPY --from=noir /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo | ||
# Copy in transpiler | ||
COPY --from=transpiler /usr/src/avm-transpiler/target/release/avm-transpiler /usr/src/avm-transpiler/target/release/avm-transpiler | ||
|
||
WORKDIR /usr/src/noir-projects | ||
# Copy in noir projects | ||
WORKDIR /usr/src/noir-projects | ||
COPY . . | ||
# Build | ||
WORKDIR /usr/src/noir-projects/noir-contracts | ||
RUN ./scripts/compile.sh && ./scripts/transpile.sh && ../../noir/target/release/nargo test --silence-warnings | ||
|
||
WORKDIR /usr/src/noir-projects/noir-protocol-circuits | ||
RUN cd src && ../../../noir/target/release/nargo compile --silence-warnings && ../../../noir/target/release/nargo test --silence-warnings | ||
|
||
WORKDIR /usr/src/noir-projects/aztec-nr | ||
RUN ../../noir/target/release/nargo compile --silence-warnings && ../../noir/target/release/nargo test --silence-warnings | ||
|
||
FROM scratch | ||
COPY --from=builder /usr/src/noir-projects /usr/src/noir-projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1 | ||
|
||
cd "$(dirname "$0")" | ||
source ../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null | ||
|
||
echo -e "\033[1mRetrieving noir projects from remote cache...\033[0m" | ||
extract_repo noir-projects \ | ||
/usr/src/noir-projects/noir-contracts/target ./noir-contracts \ | ||
/usr/src/noir-projects/noir-protocol-circuits/src/target ./noir-protocol-circuits/src | ||
|
||
remove_old_images noir-projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters