@@ -132,15 +132,44 @@ def aws_run_ore(build, args):
132
132
if 'aws-x86-boot-mode' in image_json :
133
133
ore_args .extend (['--x86-boot-mode' , image_json ['aws-x86-boot-mode' ]])
134
134
135
+ if args .winli :
136
+ ore_args .extend (["--winli" ])
137
+ winli_name = "-winli"
138
+ winli_description = " Windows License Included"
139
+ buildmeta_key = "aws-winli"
140
+ buildmeta = build .meta
141
+ source_snapshot = None
142
+ for a in buildmeta ['amis' ]:
143
+ if a ['name' ] == region :
144
+ source_snapshot = a ['snapshot' ]
145
+ break
146
+
147
+ if source_snapshot is None :
148
+ raise Exception (("Unable to find AMI source snapshot for "
149
+ f"{ region } region" ))
150
+ ore_args .extend (['--source-snapshot' , f"{ source_snapshot } " ])
151
+ else :
152
+ ore_args .extend ([
153
+ '--file' , f"{ build .image_path } " ,
154
+ '--disk-size-inspect'
155
+ ])
156
+ winli_name = ""
157
+ winli_description = ""
158
+ buildmeta_key = "amis"
159
+
160
+ if args .windows_ami :
161
+ ore_args .extend (['--windows-ami' , f"{ args .windows_ami } " ])
162
+
163
+ if args .winli_instance_type :
164
+ ore_args .extend (['--winli-instance-type' , f"{ args .winli_instance_type } " ])
165
+
135
166
ore_args .extend ([
136
167
'--region' , f"{ region } " ,
137
168
'--bucket' , f"{ args .bucket } " ,
138
- '--ami-name' , f"{ build .build_name } -{ build .build_id } -{ build .basearch } " ,
139
- '--name' , f"{ build .build_name } -{ build .build_id } -{ build .basearch } " ,
140
- '--ami-description' , f"{ build .summary } { build .build_id } { build .basearch } " ,
141
- '--file' , f"{ build .image_path } " ,
169
+ '--ami-name' , f"{ build .build_name } { winli_name } -{ build .build_id } -{ build .basearch } " ,
170
+ '--name' , f"{ build .build_name } { winli_name } -{ build .build_id } -{ build .basearch } " ,
171
+ '--ami-description' , f"{ build .summary } { build .build_id } { build .basearch } { winli_description } " ,
142
172
'--arch' , f"{ build .basearch } " ,
143
- '--disk-size-inspect' ,
144
173
'--delete-object'
145
174
])
146
175
for user in args .grant_user :
@@ -157,7 +186,7 @@ def aws_run_ore(build, args):
157
186
158
187
# This matches the Container Linux schema:
159
188
# https://stable.release.core-os.net/amd64-usr/current/coreos_production_ami_all.json
160
- ami_data = build .meta .get ("amis" , [])
189
+ ami_data = build .meta .get (buildmeta_key , [])
161
190
# filter out (remove) existing entries (can happen if --force is used) from the
162
191
# ami list that match this region.
163
192
ami_data = [ami for ami in ami_data if ami .get ('name' ) != region ]
@@ -172,7 +201,7 @@ def aws_run_ore(build, args):
172
201
if ore_data .get ("SnapshotID" ) is None :
173
202
raise Exception (f"Upload to { args .region } failed: no SnapshotID" )
174
203
175
- build .meta ['amis' ] = ami_data
204
+ build .meta [buildmeta_key ] = ami_data
176
205
build .meta_write ()
177
206
178
207
@@ -188,4 +217,7 @@ def aws_cli(parser):
188
217
parser .add_argument ("--public" , action = "store_true" , help = "Mark images as publicly available" )
189
218
parser .add_argument ("--tags" , help = "list of key=value tags to attach to the AMI" ,
190
219
action = 'append' , default = [])
220
+ parser .add_argument ("--winli" , action = "store_true" , help = "create an AWS Windows LI Ami" )
221
+ parser .add_argument ("--windows-ami" , help = "Windows Server AMI ID used to create AWS Windows LI image" )
222
+ parser .add_argument ("--winli-instance-type" , help = "ec2 instance type used to create AWS Windows LI image" )
191
223
return parser
0 commit comments