Skip to content

Conversation

@ShadowCurse
Copy link
Contributor

Changes

  • make devtool pull latest artifacts from s3
  • add ability to download multiple custom artifacts
  • add ability to specify which artifacts to use in tests
  • add ability to specify artifacts for A/B tests

Reason

Artifacts are rebuilt periodically now, so update our tools to be able to pull latest ones.
Additionally, while we are at it, add ability to download and switch between multiple
artifacts. This also opened a path for A/B tests of artifacts as well.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.23%. Comparing base (f0691f8) to head (075b628).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5585   +/-   ##
=======================================
  Coverage   83.23%   83.23%           
=======================================
  Files         277      277           
  Lines       29263    29263           
=======================================
  Hits        24358    24358           
  Misses       4905     4905           
Flag Coverage Δ
5.10-m5n.metal 83.58% <ø> (+<0.01%) ⬆️
5.10-m6a.metal 82.91% <ø> (ø)
5.10-m6g.metal 80.19% <ø> (ø)
5.10-m6i.metal 83.57% <ø> (ø)
5.10-m7a.metal-48xl 82.90% <ø> (ø)
5.10-m7g.metal 80.19% <ø> (ø)
5.10-m7i.metal-24xl 83.54% <ø> (ø)
5.10-m7i.metal-48xl 83.54% <ø> (ø)
5.10-m8g.metal-24xl 80.18% <ø> (ø)
5.10-m8g.metal-48xl 80.18% <ø> (ø)
6.1-m5n.metal 83.60% <ø> (+<0.01%) ⬆️
6.1-m6a.metal 82.94% <ø> (ø)
6.1-m6g.metal 80.18% <ø> (-0.01%) ⬇️
6.1-m6i.metal 83.60% <ø> (ø)
6.1-m7a.metal-48xl 82.93% <ø> (ø)
6.1-m7g.metal 80.18% <ø> (-0.01%) ⬇️
6.1-m7i.metal-24xl 83.62% <ø> (+<0.01%) ⬆️
6.1-m7i.metal-48xl 83.61% <ø> (ø)
6.1-m8g.metal-24xl 80.18% <ø> (ø)
6.1-m8g.metal-48xl 80.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ShadowCurse ShadowCurse force-pushed the pull_latest_s3_artifacts branch 7 times, most recently from 1de4267 to 59fb38f Compare December 17, 2025 17:10
@ShadowCurse ShadowCurse self-assigned this Dec 17, 2025
@ShadowCurse ShadowCurse added Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests labels Dec 17, 2025
Manciukic
Manciukic previously approved these changes Dec 18, 2025
Comment on lines +39 to +43
current_artifacts_dir = (
open(Path(LOCAL_BUILD_PATH) / "current_artifacts", "r", encoding="utf-8")
.read()
.strip()
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we just use the directory (which I'm assuming it's a link) directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

links do not work because of docker

utils.run_cmd(["dmesg", "-dPx"]).stdout
)
shutil.copy(f"/firecracker/build/img/{platform.machine()}/id_rsa", uvm_data)
shutil.copy("/srv/current_artifacts/id_rsa", uvm_data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be /firecracker/build/current_artifacts? Why can't we use the constants defined in defs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are correct, switch to using ARTIFACT_DIR

Comment on lines +121 to +123
# File with a single line specifing the name of the
# currently used artifacts
LOCAL_ARTIFACTS_CURRENT_DIR_FILE="build/current_artifacts"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a symlink?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, why not in build/artifacts/current ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I had this idea initially, but as it turns out symlinks will not work because we will create symlinks outside docker, but tests are run inside, so links will be broken
  2. no particular reason, I just happened to choose current_artifacts, can change if you prefer the other version

tools/devtool Outdated
# Query default S3 bucket with artifacts and return the most recient path
get_newest_s3_artifacts() {
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}')
# echo "s3://spec.ccfc.min/firecracker-ci/v1.15"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

tools/devtool Outdated
cmd_download_ci_artifacts() {
if [ "$1" = "--force" ]; then
rm -rf $FC_BUILD_DIR/img
rm -rf $ARTIFACTS_DIR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find where this is defined. Also, the action of --force should be to override that specific artifacts if present, not to delete all of them (rm -rf artifacts_local_path)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a commit where --force is removed. I think it is pretty simple to just delete build/artifacts/... if you need to.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please use singular and plural consistently. Also, it's not clear whether this is an S3 key, a URI, or something else

tools/devtool Outdated
Comment on lines 766 to 791
"--no-ci-artifacts-check")
do_ci_artifacts_check=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe --no-download-artifacts?

Also, please add it to the docs for the command

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a separate commit with this

command.append(pipeline.devtool_download_artifacts(artifacts))
# Hack because devtool_test already returns an array, just this array always
# has just 1 element
command.append(pipeline.devtool_test(devtool_opts, test_script_opts)[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you could use extend

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

done
}

cmd_set_current_artifacts() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a separate command when the download one would just do the same when they're already downloaded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the logic a bit. Now downloading is separate from setting current artifacts.

tools/devtool Outdated
fi

for artifact in "${artifacts[@]}"; do
ensure_ci_artifacts $artifact
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a way to specify which ones we want to be set as the current, or to be explicit that the last one will be set as current

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think download command should mess with current artifacts. There is a separate command to set it.

@Manciukic Manciukic dismissed their stale review December 18, 2025 11:16

I selected approve by mistakr

@ShadowCurse ShadowCurse force-pushed the pull_latest_s3_artifacts branch 5 times, most recently from 46a7c58 to 80e3f2d Compare December 18, 2025 17:50
The snapshot version check was iterating over last several FC versions
pulled from S3, but it was unnecessary since there were no cross FC
checks. Remove checks of old FC versions and only test the current
version.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Instead of using fixed artifact path for a current FC version
pull newest artifacts from S3. This way we can update them
independently while keeping old versions around.

Unfortunately there is no simple way to query newest
added directory in S3, so do the next best thing of looking
through all files in all directories and determining the `newest`
directory be the `LastModified` status of files inside.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
The old setup used `build/img` as the base directory
for artifacts pulled from S3. In S3 the artifacts directory
contains 1 subdirectory per architecture (x86_64 and aarch64).
This was causing final local artifacts path to be `build/img/x86_64`
or `build/img/aarch64`.

This commit changes the structure a to have a separate `build/artifacts`
directory with subdirectories containing different versions of
artifacts. The path to currently used artifacts will be placed in
`build/current_artifacts` file. This make is easy to switch between
multiple versions of artifacts without a need to delete/download them.
This also opens a door for A/B testing of artifacts.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Downloading artifacts is a separate step that should
not mess with currently selected artifacts.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
It will interfere with following multi-artifacts downloads later.
Additionally it is simple enough to just delete build/artifacts
by hand.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Modify `download_ci_artifacts` to accept artifacts paths
as input and download by passing these paths to
`ensure_ci_artifacts`. `ensure_ci_artifacts` will default
to latest s3 artifacts if no args were provided.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add arguments names for binary paths for ab_test.py

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Update `ab_test.py` with ability to accept custom artifacts for A and B
runs.

Additionally update `pipeline_perf.py` as well. Now REVISION_A_ARTIFACTS
and REVISION_B_ARTIFACTS environment variables specify custom artifacts
which will be used in A/B test

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Some tests like style checks do not require artifacts to be present.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
There is no reason for style check to download artifacts

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add missing descriptions for additional arguments

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
@ShadowCurse ShadowCurse force-pushed the pull_latest_s3_artifacts branch from 80e3f2d to 075b628 Compare December 18, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants