Skip to content
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

devtool: add download_ci_artifacts command #4937

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ cmd_help() {
echo " Builds the rootfs and guest kernel artifacts we use for our CI."
echo " Run './tools/devtool build_ci_artifacts help' for more details about the available commands."
echo ""
echo " download_ci_artifacts [--force]"
echo " Downloads the CI artifacts used for testing from our S3 bucket. If --force is passed, purges any existing"
echo " artifacts first. Useful for refreshing local artifacts after an update, or if something got messed up."
echo ""

cat <<EOF
test_debug [-- [<pytest args>]]
Expand Down Expand Up @@ -555,14 +559,23 @@ cmd_distclean() {
fi
}

cmd_download_ci_artifacts() {
if [ "$1" = "--force" ]; then
rm -rf $FC_BUILD_DIR/img
fi

ensure_ci_artifacts
}

ensure_ci_artifacts() {
if ! command -v aws >/dev/null; then
die "AWS CLI not installed, which is required for downloading artifacts for integration tests."
fi

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

cmd_sh() {
ensure_build_dir
ensure_ci_artifacts
run_devctr \
--privileged \
--ulimit nofile=4096:4096 \
Expand Down Expand Up @@ -916,6 +928,7 @@ cmd_sandbox_native() {
}

cmd_test_debug() {
ensure_ci_artifacts
cmd_sh "tmux new ./tools/test.sh --pdb $@"
}

Expand Down