Skip to content

Support Building AWS Windows LI Images#4069

Merged
marmijo merged 10 commits intocoreos:mainfrom
marmijo:aws-winli
Apr 22, 2025
Merged

Support Building AWS Windows LI Images#4069
marmijo merged 10 commits intocoreos:mainfrom
marmijo:aws-winli

Conversation

@marmijo
Copy link
Copy Markdown
Member

@marmijo marmijo commented Apr 8, 2025

Expand the functionality of cosa to build and replicate AWS Windows License Included CoreOS Images using ore.

See individual commits.

xfef: https://issues.redhat.com/browse/COS-3042

To build an aws-winli AMI, run the following command:

cosa imageupload-aws --upload --winli \
	--windows-ami ${windows_server_ami_id}  \
        --winli-instance-type ${instance_type} \
	--region ${region} \
	--credentials-file ${aws_config_file} \
	--arch x86_64 \
	--bucket s3://${bucket}

Edit:

  • 2025-04-24: updated ami creation command now that buildextend is RIP

@marmijo marmijo marked this pull request as draft April 8, 2025 22:56
@marmijo marmijo force-pushed the aws-winli branch 4 times, most recently from 7b3492a to 7a91a88 Compare April 9, 2025 23:15
Copy link
Copy Markdown
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

Initial review. Thank you for working on this!

Comment thread mantle/platform/api/aws/images.go Outdated
Comment thread mantle/platform/api/aws/images.go Outdated
Comment thread mantle/platform/api/aws/images.go Outdated
Comment thread mantle/platform/api/aws/images.go
Comment thread mantle/platform/api/aws/images.go
Comment thread mantle/cmd/ore/aws/upload.go Outdated
Comment thread mantle/cmd/ore/aws/upload.go Outdated
Comment thread mantle/platform/api/aws/ec2.go
Comment thread mantle/platform/api/aws/ec2.go Outdated
Comment thread mantle/platform/api/aws/ec2.go Outdated
@marmijo marmijo changed the title WIP: Support Building AWS Windows LI Images Support Building AWS Windows LI Images Apr 17, 2025
@marmijo marmijo marked this pull request as ready for review April 17, 2025 00:16
Comment thread mantle/platform/api/aws/images.go Outdated
Comment thread mantle/cmd/ore/aws/upload.go Outdated
@marmijo
Copy link
Copy Markdown
Member Author

marmijo commented Apr 18, 2025

I added another commit to this PR to include the aws-winli information in the release metadata.

Comment thread mantle/platform/api/aws/api.go Outdated
Comment on lines +136 to +142
func randomName(prefix string) string {
b := make([]byte, 5)
if _, err := rand.Read(b); err != nil {
plog.Errorf("randomName: failed to generate a random name: %v", err)
}
return fmt.Sprintf("%s-%x", prefix, b)
}
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.

I was thinking more that rather than copy/paste the function from azure/api.go we'd put it in util/ (like the retry functions) and use that everywhere (i.e. we'd delete the copy of this in azure/api.go too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, yeah that makes sense. I can make that change as a separate commit. Should I make the change to the azure API in a separate PR after this merges?

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.

I would just put it in the same PR.

Comment thread mantle/cmd/ore/aws/upload.go Outdated
cmdUpload.Flags().StringVar(&uploadX86BootMode, "x86-boot-mode", "uefi-preferred", "Set boot mode (uefi-preferred, uefi)")
cmdUpload.Flags().BoolVar(&uploadCreateWinLIAMI, "winli", false, "Create a Windows LI AMI")
cmdUpload.Flags().StringVar(&uploadWinLIwindowsServerAMI, "windows-ami", "", "Windows Server AMI used to create a Windows LI AMI")
cmdUpload.Flags().StringVar(&uploadWinLIInstanceType, "winli-instance-type", "", "ec2 instance type used to create a Windows LI AMI (default: t2.large)")
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.

Suggested change
cmdUpload.Flags().StringVar(&uploadWinLIInstanceType, "winli-instance-type", "", "ec2 instance type used to create a Windows LI AMI (default: t2.large)")
cmdUpload.Flags().StringVar(&uploadWinLIInstanceType, "winli-instance-type", "t2.large", "ec2 instance type used to create a Windows LI AMI")

I think you can just set a default this way and you won't have to do the conditional logic below.

Comment thread src/cosalib/aws.py Outdated
action='append', default=[])
parser.add_argument("--winli", action="store_true", help="create an AWS Windows LI Ami")
parser.add_argument("--windows-ami", help="Windows Server AMI ID used to create AWS Windows LI image")
parser.add_argument("--winli-instance-type", help="ec2 instance type used to create AWS Windows LI image (default: t2.large)")
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.

Suggested change
parser.add_argument("--winli-instance-type", help="ec2 instance type used to create AWS Windows LI image (default: t2.large)")
parser.add_argument("--winli-instance-type", help="ec2 instance type used to create AWS Windows LI image")

I'd just leave off this detail here as it could become stale.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SGTM. That's why I created the option in the first place, so we wouldn't hard code it. Just like the windows server ami, this can become stale. Although, much less frequently.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done!

@marmijo marmijo force-pushed the aws-winli branch 2 times, most recently from b66b975 to 963bea5 Compare April 18, 2025 17:16
dustymabe
dustymabe previously approved these changes Apr 18, 2025
Copy link
Copy Markdown
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

LGTM

@marmijo marmijo force-pushed the aws-winli branch 2 times, most recently from 3ff8a7e to 238517b Compare April 18, 2025 19:27
dustymabe
dustymabe previously approved these changes Apr 18, 2025
Copy link
Copy Markdown
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

still LGTM - maybe wait til next week to merge just in case this disrupts something.

marmijo added 6 commits April 22, 2025 13:40
Add command line options to ore to support building Windows LI images.
Expand the schema to include aws-winli amis.

Also expand cmd-coreos-prune to hanlde the new schema and prune
aws-winli images if they exist in the metadata.

Auto-generated code using `make schema`
Add command line options to support building aws windows li images.
Adjust ore replicate to handle both the `aws` and `aws-winli` metadata
keys when replicating to aws regions.
The new Windows License Included AMI creation process creates volumes
that might not be deleted when the instance they're attached to is
deleted. Expand AWS Garbage Colleciton to also clean up EC2 volumes
that were created by mantle.
Add AWS Windows License Included AMI information to the
rhel-coreos-extensions section of the release metadata.

See: https://issues.redhat.com/browse/COS-3057
@marmijo
Copy link
Copy Markdown
Member Author

marmijo commented Apr 22, 2025

Pushed some updates to make CI happy. I also edited the schema commit to include pruning aws-winli images based on the new schema.

@marmijo marmijo merged commit 5e3785f into coreos:main Apr 22, 2025
5 checks passed
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 23, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add a `winli` knob to the pipeline config clouds.aws section
to only build winli images for specific streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 23, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add a `winli` knob to the pipeline config clouds.aws section
to only build winli images for specific streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 24, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add a `winli` knob to the pipeline config clouds.aws section
to only build winli images for specific streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 24, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add a `winli` knob to the pipeline config clouds.aws section
to only build winli images for specific streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 24, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add a `winli` knob to the pipeline config clouds.aws section
to only build winli images for specific streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 24, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 24, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 25, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 25, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 25, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 25, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 28, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 28, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 28, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 29, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 29, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to marmijo/fedora-coreos-pipeline that referenced this pull request Apr 29, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
marmijo added a commit to coreos/fedora-coreos-pipeline that referenced this pull request Apr 29, 2025
Expand the replicate to clouds functionality to build AWS Windows
License Included (winli) images for streams that support it before
replicating AMIs to other regions. `cosa aws-replicate` will now
replicate both traditional AMIs and aws-winli AMIs if present in the
metadata.

See: coreos/coreos-assembler#4069

Also add `create_and_replicate_winli_ami` as a stream level knob to the
pipeline config to enable building and replicating the AMIs for specific
streams.
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.

2 participants