@@ -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+
558570ensure_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
879892cmd_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
918930cmd_test_debug () {
931+ ensure_ci_artifacts
919932 cmd_sh " tmux new ./tools/test.sh --pdb $@ "
920933}
921934
0 commit comments