-
Notifications
You must be signed in to change notification settings - Fork 271
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: bootstrap improvements. #4711
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1e38125
Build nargo against Ubuntu 20 for better compatability
charlielye 31cf1a9
retry a docker create thing.
charlielye 60a38d3
bootstrap scripts try to use cache by default. l1-contracts will atte…
charlielye 3af0393
Merge branch 'master' into cl/more_build_cache
charlielye 42d1dea
Merge branch 'master' into cl/more_build_cache
charlielye 97822b1
Remove old cache images.
charlielye f4d59db
Better retry.
charlielye 6ac2000
Early out if can't use cache.
charlielye bd3a1bd
fix unbound
charlielye c52fec8
Remove codegen sol file.
charlielye ad2659c
Merge branch 'master' into cl/more_build_cache
charlielye 332e1a3
fix
charlielye e40e51d
avm-transpiler to target ubuntu 20
charlielye 6ece897
fix
charlielye 2465a8d
fix
charlielye 0b0efad
remove old cache images when doing bootstrap_docker.sh
charlielye 5c56c48
Allow skipping use of cache with NO_CACHE
charlielye e8b55f4
Add ./bootstrap.sh full command.
charlielye 4e7f7cb
Make noir-projects cli cache friendly.
charlielye 40216be
fix
charlielye 7c308e3
fix
charlielye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ if [ -n "$CMD" ]; then | |
git clean -ffdx | ||
|
||
exit 0 | ||
elif [ "$CMD" = "full" ]; then | ||
export NO_CACHE=1 | ||
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be only supported at top level. For subprojects you have to use NO_CACHE=1 to prevent use of cache. Would it make sense to have one or the other for all files? |
||
else | ||
echo "Unknown command: $CMD" | ||
exit 1 | ||
|
@@ -61,19 +63,11 @@ PROJECTS=( | |
|
||
# Build projects locally | ||
for P in "${PROJECTS[@]}"; do | ||
if [ -n "${BOOTSTRAP_USE_REMOTE_CACHE:-}" ] && [ -f "$P/bootstrap_cache.sh" ]; then | ||
echo "**************************************" | ||
echo -e "\033[1mBootstrapping $P from remote cache...\033[0m" | ||
echo "**************************************" | ||
echo | ||
$P/bootstrap_cache.sh | ||
else | ||
echo "**************************************" | ||
echo -e "\033[1mBootstrapping $P...\033[0m" | ||
echo "**************************************" | ||
echo | ||
$P/bootstrap.sh | ||
fi | ||
echo "**************************************" | ||
echo -e "\033[1mBootstrapping $P...\033[0m" | ||
echo "**************************************" | ||
echo | ||
(cd $P && ./bootstrap.sh) | ||
echo | ||
echo | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: would it make sense to add an echo on failure along the lines of: "If you want to use the cache install docker and set up your AWS credentials"?