Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions cmd/image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ operating systems like Fedora, CentOS and RHEL with easy customizations support.
uploadCmd.Flags().String("aws-ami-name", "", "name for the AMI in AWS (only for type=ami)")
uploadCmd.Flags().String("aws-bucket", "", "target S3 bucket name for intermediate storage when creating AMI (only for type=ami)")
uploadCmd.Flags().String("aws-region", "", "target region for AWS uploads (only for type=ami)")
uploadCmd.Flags().StringArray("aws-tag", []string{}, "tag the AMI with this Key=Value (only for type=aws)")
uploadCmd.Flags().String("libvirt-connection", "", "connection URI (only for type=libvirt)")
uploadCmd.Flags().String("libvirt-pool", "", "pool name (only for type=libvirt)")
uploadCmd.Flags().String("libvirt-volume", "", "volume name (only for type=libvirt)")
Expand Down
16 changes: 16 additions & 0 deletions cmd/image-builder/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ func uploaderForCmdAWS(cmd *cobra.Command, targetArchStr string, bootMode *platf
if err != nil {
return nil, err
}
tags, err := cmd.Flags().GetStringArray("aws-tag")
if err != nil {
return nil, err
}
var slicedTags []awscloud.AWSTag
for _, tag := range tags {
parts := strings.SplitN(tag, "=", 2)
if len(parts) < 2 {
return nil, fmt.Errorf("Invalid tag format: %s (expected key=value)", tag)
}
slicedTags = append(slicedTags, awscloud.AWSTag{
Name: parts[0],
Value: parts[1],
})
}
if bootMode == nil {
// If unset, default to BOOT_HYBIRD which translated
// to "uefi-prefered" when registering the image.
Expand Down Expand Up @@ -129,6 +144,7 @@ func uploaderForCmdAWS(cmd *cobra.Command, targetArchStr string, bootMode *platf
opts := &awscloud.UploaderOptions{
TargetArch: targetArch,
BootMode: bootMode,
Tags: slicedTags,
}

return awscloudNewUploader(region, bucketName, amiName, opts)
Expand Down
Loading