Skip to content

add support for boot-oci cmd (HMS-11559) - #2756

Merged
achilleas-k merged 3 commits into
osbuild:mainfrom
src-up:boot-oci
Nov 4, 2026
Merged

achilleas-k merged 3 commits into
osbuild:mainfrom
src-up:boot-oci

Conversation

@src-up

@src-up src-up commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

add boot-oci command that allows users to launch and terminate OCI VMs.

successfully tested running go run ./cmd/boot-oci run and go run ./cmd/boot-oci setup.

@src-up
src-up marked this pull request as ready for review October 18, 2026 08:31
@src-up
src-up requested a review from a team as a code owner October 18, 2026 08:31
@achilleas-k
achilleas-k self-requested a review October 20, 2026 11:41
@achilleas-k

Copy link
Copy Markdown
Member

Really nice, thank you! Sorry this hasn't gotten any attention yet. I need to read it more carefully before I can approve.

We should actually use this in our CI now. We have OCI boot tests in osbuild-composer, so I can bring over the secrets and configuration from that to use in this repo. Can you have a look at the boot tests and see if you can add OCI there? Start at the can_boot_test() function in imgtestlib. The AWS and Azure boot tests follow the same pattern that we would want for OCI.

If you don't have the time to look into this please let me know so we can take care of it.

Comment thread pkg/cloud/oci/instance.go Resolved
Comment thread pkg/cloud/oci/instance.go Resolved
Comment thread pkg/cloud/oci/instance.go Resolved
Comment thread pkg/cloud/oci/instance.go Resolved
Comment thread cmd/boot-oci/main.go Resolved
Comment thread pkg/cloud/oci/client.go Resolved
@src-up
src-up requested a review from thozza as a code owner October 22, 2026 14:27
@src-up
src-up force-pushed the boot-oci branch 2 times, most recently from 8838e6a to 2a14159 Compare October 22, 2026 17:04
@achilleas-k

achilleas-k commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Had a call with @src-up and we tried to figure out all the variables and credentials needed here. I copied all the OCI-related variables from osbuild-composer's CI to image-builder's.

Now we need to pass the private key down through to the upload command.

env_vars = {
"region": os.environ.get("OCI_REGION"),
"compartment_id": os.environ.get("OCI_COMPARTMENT_ID"),
"subnet_id": os.environ.get("OCI_SUBNET_ID"),
"availability_domain": os.environ.get("OCI_AVAILABILITY_DOMAIN"),
"bucket_name": os.environ.get("OCI_BUCKET_NAME"),
"bucket_namespace": os.environ.get("OCI_BUCKET_NAMESPACE"),
}

The private key is added as a file in CI, so the env var OCI_PRIVATE_KEY is a path to a file that contains the key. We should add it (the path to the priv key) in env_vars at get_oci_config(). Then pass it to the osbuild-upload-oci command here

"--region", oci_config["region"],
"--bucket-name", oci_config["bucket_name"],
"--bucket-namespace", oci_config["bucket_namespace"],
"--compartment-id", oci_config["compartment_id"],
"--object-name", image_name,
"--filename", image_path]
stdout, stderr = runcmd(cmd)

The fingerprint option is also required in osbuild-upload-oci, but I think we can change the osbuild-upload-oci command to compute the fingerprint itself from the priv key. I've added an OCI_FINGERPRINT variable to the gitlab CI env vars, so we can use that directly for now, meaning we'd have to read it in get_oci_config() as well.

@src-up
src-up force-pushed the boot-oci branch 3 times, most recently from 7a6826a to 53924fa Compare October 26, 2026 21:37

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally LGTM, but I have one request below about adding json output to the upload command.

Also, maybe this is better for a follow-up but we should also add upload support for OCI to the main command (image-builder upload --to=oci ...).

Comment thread test/scripts/imgtestlib/boot.py Resolved
Comment thread pkg/cloud/oci/launch_log.go Resolved
@achilleas-k

Copy link
Copy Markdown
Member
LaunchInstance: Service error:InvalidParameter. Invalid format for ssh public key. http status code: 400. Opc request id: 843b0d4ef2c48300f2db20c27f71964b/0462DBD18615BFAA70D4E06A49414482/FF7E4084E46C5939F8FDCC68BB25873A

looks like we're making progress https://gitlab.com/redhat/services/products/image-builder/ci/images/-/jobs/17511474216

@src-up
src-up force-pushed the boot-oci branch 4 times, most recently from 4f1d87b to 6639b24 Compare November 1, 2026 20:05
@src-up

src-up commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author
LaunchInstance: Service error:InvalidParameter. Invalid format for ssh public key. http status code: 400. Opc request id: 843b0d4ef2c48300f2db20c27f71964b/0462DBD18615BFAA70D4E06A49414482/FF7E4084E46C5939F8FDCC68BB25873A

looks like we're making progress https://gitlab.com/redhat/services/products/image-builder/ci/images/-/jobs/17511474216

Right. had to make couple more changes to make schutzbot pass.

  1. ssh was failing since i had passed filename of ssh key and not the actual key in authorized_keys.
  2. RHEL 8.10 on OCI was failing CI so had to add explicit cloud-init default user.

@src-up
src-up force-pushed the boot-oci branch 6 times, most recently from 1009396 to 67ff850 Compare November 2, 2026 12:47
@src-up
src-up requested a review from achilleas-k November 3, 2026 18:04

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is really nice. Thank you!

Small comment inline, seems to be some stray line-removals in the patch, but otherwise good to merge.

Comment thread test/scripts/imgtestlib/boot.py Resolved

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks again!

@achilleas-k
achilleas-k enabled auto-merge November 3, 2026 19:50
@achilleas-k

Copy link
Copy Markdown
Member

@src-up src-up changed the title add support for boot-oci cmd add support for boot-oci cmd (HMS-11559) Nov 3, 2026
Add a boot-oci command with setup, teardown, and run subcommands for boot testing custom images in OCI. Store created resources so callers can tear them down, select a compatible availability domain and default shape, and connect over SSH to run tests.

Teach osbuild-upload-oci to emit image IDs as JSON so boot-oci can consume upload results reliably.
Exercise boot-oci during image tests by fetching the uploaded OCI image ID, passing the configured credentials and launch details, and invoking the image test executable on the resulting instance.

Keep cloud credentials available to the test helper so setup can pass the required authentication and SSH options to boot-oci.
Set opc as the cloud-init default user for RHEL 8 OCI images so they can be accessed consistently after boot.

Reuse the existing qcow2 image configuration for the OCI image type to retain its current target and kernel options.
@achilleas-k
achilleas-k added this pull request to the merge queue Nov 4, 2026
Merged via the queue into osbuild:main with commit 6d45149 Nov 4, 2026
64 of 66 checks passed
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.

3 participants