Skip to content

Commit 39b2264

Browse files
authored
Merge branch 'main' into fix-4547
2 parents 358a213 + 4b9df90 commit 39b2264

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tools/devtool

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ cmd_help() {
418418
echo " Builds the rootfs and guest kernel artifacts we use for our CI."
419419
echo " Run './tools/devtool build_ci_artifacts help' for more details about the available commands."
420420
echo ""
421+
echo " download_ci_artifacts [--force]"
422+
echo " Downloads the CI artifacts used for testing from our S3 bucket. If --force is passed, purges any existing"
423+
echo " artifacts first. Useful for refreshing local artifacts after an update, or if something got messed up."
424+
echo ""
421425

422426
cat <<EOF
423427
test_debug [-- [<pytest args>]]
@@ -555,14 +559,23 @@ cmd_distclean() {
555559
fi
556560
}
557561

562+
cmd_download_ci_artifacts() {
563+
if [ "$1" = "--force" ]; then
564+
rm -rf $FC_BUILD_DIR/img
565+
fi
566+
567+
ensure_ci_artifacts
568+
}
569+
558570
ensure_ci_artifacts() {
559571
if ! command -v aws >/dev/null; then
560572
die "AWS CLI not installed, which is required for downloading artifacts for integration tests."
561573
fi
562574

563575
# Fetch all the artifacts so they are local
564576
say "Fetching CI artifacts from S3"
565-
S3_URL=s3://spec.ccfc.min/firecracker-ci/v1.11/$(uname -m)
577+
FC_VERSION=$(cmd_sh "cd src/firecracker/src; cargo pkgid | cut -d# -f2 | cut -d. -f1-2")
578+
S3_URL=s3://spec.ccfc.min/firecracker-ci/v$FC_VERSION/$(uname -m)
566579
ARTIFACTS=$MICROVM_IMAGES_DIR/$(uname -m)
567580
if [ ! -d "$ARTIFACTS" ]; then
568581
mkdir -pv $ARTIFACTS
@@ -878,7 +891,6 @@ cmd_shell() {
878891

879892
cmd_sh() {
880893
ensure_build_dir
881-
ensure_ci_artifacts
882894
run_devctr \
883895
--privileged \
884896
--ulimit nofile=4096:4096 \
@@ -916,6 +928,7 @@ cmd_sandbox_native() {
916928
}
917929

918930
cmd_test_debug() {
931+
ensure_ci_artifacts
919932
cmd_sh "tmux new ./tools/test.sh --pdb $@"
920933
}
921934

0 commit comments

Comments
 (0)