@@ -142,7 +142,6 @@ DEFAULT_ARTIFACTS_S3_BUCKET=s3://spec.ccfc.min/firecracker-ci
142142# Query default S3 bucket with artifacts and return the most recient path
143143get_newest_s3_artifacts () {
144144 echo $( aws s3 ls $DEFAULT_ARTIFACTS_S3_BUCKET / --no-sign-request | grep " PRE" | sort -k2 | tail -1 | awk -v bucket=" $DEFAULT_ARTIFACTS_S3_BUCKET " ' {print bucket "/" $2}' )
145- # echo "s3://spec.ccfc.min/firecracker-ci/v1.15"
146145}
147146# Function to return local path to artifacts. Accepts the url from function above
148147# as an argument.
@@ -426,9 +425,10 @@ cmd_help() {
426425 echo " Builds the rootfs and guest kernel artifacts we use for our CI."
427426 echo " Run './tools/devtool build_ci_artifacts help' for more details about the available commands."
428427 echo " "
429- echo " download_ci_artifacts [--force]"
428+ echo " download_ci_artifacts [--force] [artifact1 artifact2 ...] "
430429 echo " Downloads the CI artifacts used for testing from our S3 bucket. If --force is passed, purges any existing"
431- echo " artifacts first. Useful for refreshing local artifacts after an update, or if something got messed up."
430+ echo " artifacts first. If specific artifacts are listed, only those will be downloaded; otherwise all artifacts"
431+ echo " are downloaded. Useful for refreshing local artifacts after an update, or if something got messed up."
432432 echo " "
433433
434434 cat << EOF
@@ -577,20 +577,45 @@ cmd_distclean() {
577577}
578578
579579cmd_download_ci_artifacts () {
580- if [ " $1 " = " --force" ]; then
580+ local force=false
581+ local artifacts=()
582+
583+ while [ $# -gt 0 ]; do
584+ case " $1 " in
585+ --force)
586+ force=true
587+ ;;
588+ * )
589+ artifacts+=(" $1 " )
590+ ;;
591+ esac
592+ shift
593+ done
594+
595+ if [ " $force " = true ]; then
581596 rm -rf $ARTIFACTS_DIR
582597 fi
583598
584- ensure_ci_artifacts
599+ if [ ${# artifacts[@]} -eq 0 ]; then
600+ say " No artifacts were specified"
601+ fi
602+
603+ for artifact in " ${artifacts[@]} " ; do
604+ ensure_ci_artifacts $artifact
605+ done
585606}
586607
587608ensure_ci_artifacts () {
588- if ! command -v aws > /dev/null; then
589- die " AWS CLI not installed, which is required for downloading artifacts for integration tests."
609+ local artifacts=$1
610+
611+ if [ -z $artifacts ]; then
612+ local default_artifacts=$( get_newest_s3_artifacts)
613+ say " No specific artifacts are defined. Using default artifacts: " $default_artifacts
614+ artifacts=$default_artifacts
590615 fi
591616
592617 # Fetch all the artifacts so they are local
593- local artifacts_s3_url=$( get_newest_s3_artifacts )
618+ local artifacts_s3_url=$artifacts
594619 local artifacts_s3_url_arch=$artifacts_s3_url /$( uname -m)
595620 local artifacts_local_path=$( get_local_artifacts_path $artifacts_s3_url ) /$( uname -m)
596621
@@ -710,6 +735,7 @@ cmd_test() {
710735 do_build=1
711736 do_archive=1
712737 do_kvm_check=1
738+ do_ci_artifacts_check=1
713739 # Parse any command line args.
714740 while [ $# -gt 0 ]; do
715741 case " $1 " in
@@ -737,6 +763,9 @@ cmd_test() {
737763 " --no-kvm-check" )
738764 do_kvm_check=0
739765 ;;
766+ " --no-ci-artifacts-check" )
767+ do_ci_artifacts_check=0
768+ ;;
740769 " --" ) { shift ; break ; } ;;
741770 * )
742771 die " Unknown argument: $1 . Please use --help for help."
@@ -749,7 +778,7 @@ cmd_test() {
749778 [ $do_kvm_check != 0 ] && ensure_kvm
750779 ensure_devctr
751780 ensure_build_dir
752- ensure_ci_artifacts
781+ [ $do_ci_artifacts_check != 0 ] && ensure_ci_artifacts
753782 if [ $do_build != 0 ]; then
754783 cmd_build --release
755784 if [ -n " $BUILDKITE_PULL_REQUEST_BASE_BRANCH " ]; then
0 commit comments