Skip to content

many: use image-builder upload in tests (HMS-10856)#2476

Merged
supakeen merged 11 commits into
osbuild:mainfrom
supakeen:use-image-builder-upload
Jul 4, 2026
Merged

many: use image-builder upload in tests (HMS-10856)#2476
supakeen merged 11 commits into
osbuild:mainfrom
supakeen:use-image-builder-upload

Conversation

@supakeen

@supakeen supakeen commented Jun 30, 2026

Copy link
Copy Markdown
Member

Replace the upload parts of boot-(aws|azure) with image-builder upload. Had to add some options and move all the Azure upload code since it didn't exist yet.

@supakeen

Copy link
Copy Markdown
Member Author

This all probably won't work as it likely needs secrets we can't currently pass on the commandline of image-builder.

@supakeen supakeen changed the title wip: use image-builder upload in tests wip: use image-builder upload in tests (HMS-10856) Jun 30, 2026
@supakeen supakeen force-pushed the use-image-builder-upload branch 2 times, most recently from 38fdcf5 to 406a31d Compare June 30, 2026 10:48
@supakeen

Copy link
Copy Markdown
Member Author

Ok; this needs to wire up boot-mode for AWS in the image-builder upload command to make it work for older RHELs which were BIOS-only.

@supakeen supakeen force-pushed the use-image-builder-upload branch from 406a31d to cb828b9 Compare June 30, 2026 13:34
Comment thread test/scripts/imgtestlib/boot.py
@supakeen supakeen force-pushed the use-image-builder-upload branch from cb828b9 to def9c07 Compare June 30, 2026 14:14
@supakeen supakeen changed the title wip: use image-builder upload in tests (HMS-10856) many: use image-builder upload in tests (HMS-10856) Jun 30, 2026
@supakeen

Copy link
Copy Markdown
Member Author

I cannot see the Snyk issue but otherwise this is ready for review.

@supakeen supakeen marked this pull request as ready for review June 30, 2026 15:03
@supakeen supakeen requested review from a team, achilleas-k and thozza as code owners June 30, 2026 15:03
@supakeen supakeen requested a review from avitova June 30, 2026 15:03
@supakeen supakeen force-pushed the use-image-builder-upload branch 2 times, most recently from 023d25d to 981ad76 Compare July 1, 2026 07:27
@supakeen

supakeen commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Ok; this is only failing on the dnf5 depsolver tests now; let's see if a rebase fixes that.

@supakeen supakeen force-pushed the use-image-builder-upload branch from 981ad76 to a5020af Compare July 1, 2026 08:32
@supakeen

supakeen commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Snyk errors are not relevant, the idiom already existed.

Comment thread cmd/image-builder/bib_main_test.go Outdated
Comment thread cmd/image-builder/upload.go
Comment thread pkg/cloud/azure/uploader.go Outdated
Comment thread cmd/boot-aws/main.go
Comment thread test/scripts/imgtestlib/boot.py Outdated

@brlane-rht brlane-rht left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks pretty good, just a few small questions.

supakeen added 4 commits July 2, 2026 07:13
Change UploadAndRegister to return *UploadResult and an error instead
of error. The UploadResult struct carries the provider name and the
cloud-specific image identifier.

This allows callers to obtain the image ID after upload or any
additional information that might be relevant.
Add --format flag to the upload command. After a successful upload,
the new UploadResult is serialized and printed to stdout as yaml
or json.
Move the upload logic from cmd/boot-azure into a new azureUploader
that implements the cloud.Uploader interface. This handles storage
account setup, page blob upload, and image registration for both
x86_64 (standard image) and aarch64 (gallery image).
Wire the new Azure uploader into the upload command.
supakeen added 7 commits July 2, 2026 07:16
Remove the upload and image registration logic from boot-aws. The
command now takes a pre-uploaded AMI ID via --ami instead of a local
image file. Upload should be done separately via
`image-builder upload --to=aws`.
Remove the upload and image registration bits from boot-azure. The
command now requires a pre-uploaded image via --image (or --snapshot
for Windows/WSL). Upload should be done separately via image-builder
upload --to=azure.
Update the test scripts to use the new workflow:

1. Upload via image-builder upload --to=aws/azure --format=json
2. Boot via boot-aws --ami or boot-azure --image

Add upload_to_aws() and upload_to_azure() helpers that call
image-builder upload and parse the JSON result for the image ID.
Bump the seed to ensure all images get built and boot tested with the
new tools.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
The two places that use `pb` directly were writing their output to
stdout while normally we write output of progress to stderr.

Fix that, and the tests.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Allow specifying the AWS boot mode for a given upload. Sometimes it's
necessary to set this.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Take the boot mode from `describe` and pass it to `image-builder
upload`.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
@supakeen supakeen force-pushed the use-image-builder-upload branch from a5020af to cbe00ce Compare July 2, 2026 05:16
@supakeen

supakeen commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Looks pretty good, just a few small questions.

I've addressed all of them 🙂

@brlane-rht brlane-rht left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

@achilleas-k

Copy link
Copy Markdown
Member

Very nice and clean. Thank you!

@achilleas-k achilleas-k added this pull request to the merge queue Jul 3, 2026
Comment on lines +272 to +281
requiredArgs := []string{"azure-client-id", "azure-client-secret", "azure-tenant", "azure-subscription", "azure-resource-group", "azure-image-name"}
for _, argName := range requiredArgs {
arg, err := cmd.Flags().GetString(argName)
if err != nil {
return nil, err
}
if arg == "" {
missing = append(missing, fmt.Sprintf("--%s", argName))
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since all of the args are required, we could also remove whatever is in the function before, and just do:

Suggested change
requiredArgs := []string{"azure-client-id", "azure-client-secret", "azure-tenant", "azure-subscription", "azure-resource-group", "azure-image-name"}
for _, argName := range requiredArgs {
arg, err := cmd.Flags().GetString(argName)
if err != nil {
return nil, err
}
if arg == "" {
missing = append(missing, fmt.Sprintf("--%s", argName))
}
}
usedArgs := make(map[string]string)
requiredArgs := []string{"azure-client-id", "azure-client-secret", "azure-tenant", "azure-subscription", "azure-resource-group", "azure-image-name"}
for _, argName := range requiredArgs {
arg, err := cmd.Flags().GetString(argName)
if err != nil {
return nil, err
}
if arg == "" {
missing = append(missing, fmt.Sprintf("--%s", argName))
} else {
usedArgs[argName] = arg
}
}

And then we return values from the map. Not necessary, might complicate things once we start using arguments that are not required, but I think worth thinking about?

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 3, 2026
@supakeen supakeen added this pull request to the merge queue Jul 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 3, 2026
@supakeen

supakeen commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

Failing with data race detections in the merge queue.

@supakeen

supakeen commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

I think we found this race here because we actually run with the race detector in this branch; I've opened a PR to address it and we'll need to rebase this PR (and likely others) after that lands: #2487

@supakeen supakeen added this pull request to the merge queue Jul 4, 2026
Merged via the queue into osbuild:main with commit b78fa16 Jul 4, 2026
50 checks passed
@supakeen supakeen deleted the use-image-builder-upload branch July 4, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants