Show More
@@ -1032,7 +1032,8 b' def temporary_linux_dev_instances(c: AWS' | |||||
1032 | instance.ssh_client.close() |
|
1032 | instance.ssh_client.close() | |
1033 |
|
1033 | |||
1034 |
|
1034 | |||
1035 |
def ensure_windows_dev_ami(c: AWSConnection, prefix='hg-' |
|
1035 | def ensure_windows_dev_ami(c: AWSConnection, prefix='hg-', | |
|
1036 | base_image_name=WINDOWS_BASE_IMAGE_NAME): | |||
1036 | """Ensure Windows Development AMI is available and up-to-date. |
|
1037 | """Ensure Windows Development AMI is available and up-to-date. | |
1037 |
|
1038 | |||
1038 | If necessary, a modern AMI will be built by starting a temporary EC2 |
|
1039 | If necessary, a modern AMI will be built by starting a temporary EC2 | |
@@ -1050,7 +1051,7 b' def ensure_windows_dev_ami(c: AWSConnect' | |||||
1050 |
|
1051 | |||
1051 | name = '%s%s' % (prefix, 'windows-dev') |
|
1052 | name = '%s%s' % (prefix, 'windows-dev') | |
1052 |
|
1053 | |||
1053 |
image = find_image(ec2resource, AMAZON_ACCOUNT_ID, |
|
1054 | image = find_image(ec2resource, AMAZON_ACCOUNT_ID, base_image_name) | |
1054 |
|
1055 | |||
1055 | config = { |
|
1056 | config = { | |
1056 | 'BlockDeviceMappings': [ |
|
1057 | 'BlockDeviceMappings': [ | |
@@ -1103,6 +1104,7 b' def ensure_windows_dev_ami(c: AWSConnect' | |||||
1103 | 'user_data': WINDOWS_USER_DATA, |
|
1104 | 'user_data': WINDOWS_USER_DATA, | |
1104 | 'initial_bootstrap': WINDOWS_BOOTSTRAP_POWERSHELL, |
|
1105 | 'initial_bootstrap': WINDOWS_BOOTSTRAP_POWERSHELL, | |
1105 | 'bootstrap_commands': commands, |
|
1106 | 'bootstrap_commands': commands, | |
|
1107 | 'base_image_name': base_image_name, | |||
1106 | }) |
|
1108 | }) | |
1107 |
|
1109 | |||
1108 | existing_image = find_and_reconcile_image(ec2resource, name, fingerprint) |
|
1110 | existing_image = find_and_reconcile_image(ec2resource, name, fingerprint) |
@@ -52,15 +52,16 b' def bootstrap_linux_dev(hga: HGAutomatio' | |||||
52 | aws.ensure_linux_dev_ami(c, distro=distro) |
|
52 | aws.ensure_linux_dev_ami(c, distro=distro) | |
53 |
|
53 | |||
54 |
|
54 | |||
55 | def bootstrap_windows_dev(hga: HGAutomation, aws_region): |
|
55 | def bootstrap_windows_dev(hga: HGAutomation, aws_region, base_image_name): | |
56 | c = hga.aws_connection(aws_region) |
|
56 | c = hga.aws_connection(aws_region) | |
57 | image = aws.ensure_windows_dev_ami(c) |
|
57 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | |
58 | print('Windows development AMI available as %s' % image.id) |
|
58 | print('Windows development AMI available as %s' % image.id) | |
59 |
|
59 | |||
60 |
|
60 | |||
61 |
def build_inno(hga: HGAutomation, aws_region, arch, revision, version |
|
61 | def build_inno(hga: HGAutomation, aws_region, arch, revision, version, | |
|
62 | base_image_name): | |||
62 | c = hga.aws_connection(aws_region) |
|
63 | c = hga.aws_connection(aws_region) | |
63 | image = aws.ensure_windows_dev_ami(c) |
|
64 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | |
64 | DIST_PATH.mkdir(exist_ok=True) |
|
65 | DIST_PATH.mkdir(exist_ok=True) | |
65 |
|
66 | |||
66 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
|
67 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | |
@@ -74,9 +75,10 b' def build_inno(hga: HGAutomation, aws_re' | |||||
74 | version=version) |
|
75 | version=version) | |
75 |
|
76 | |||
76 |
|
77 | |||
77 |
def build_wix(hga: HGAutomation, aws_region, arch, revision, version |
|
78 | def build_wix(hga: HGAutomation, aws_region, arch, revision, version, | |
|
79 | base_image_name): | |||
78 | c = hga.aws_connection(aws_region) |
|
80 | c = hga.aws_connection(aws_region) | |
79 | image = aws.ensure_windows_dev_ami(c) |
|
81 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | |
80 | DIST_PATH.mkdir(exist_ok=True) |
|
82 | DIST_PATH.mkdir(exist_ok=True) | |
81 |
|
83 | |||
82 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
|
84 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | |
@@ -89,9 +91,10 b' def build_wix(hga: HGAutomation, aws_reg' | |||||
89 | DIST_PATH, version=version) |
|
91 | DIST_PATH, version=version) | |
90 |
|
92 | |||
91 |
|
93 | |||
92 |
def build_windows_wheel(hga: HGAutomation, aws_region, arch, revision |
|
94 | def build_windows_wheel(hga: HGAutomation, aws_region, arch, revision, | |
|
95 | base_image_name): | |||
93 | c = hga.aws_connection(aws_region) |
|
96 | c = hga.aws_connection(aws_region) | |
94 | image = aws.ensure_windows_dev_ami(c) |
|
97 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | |
95 | DIST_PATH.mkdir(exist_ok=True) |
|
98 | DIST_PATH.mkdir(exist_ok=True) | |
96 |
|
99 | |||
97 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
|
100 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | |
@@ -104,9 +107,9 b' def build_windows_wheel(hga: HGAutomatio' | |||||
104 |
|
107 | |||
105 |
|
108 | |||
106 | def build_all_windows_packages(hga: HGAutomation, aws_region, revision, |
|
109 | def build_all_windows_packages(hga: HGAutomation, aws_region, revision, | |
107 | version): |
|
110 | version, base_image_name): | |
108 | c = hga.aws_connection(aws_region) |
|
111 | c = hga.aws_connection(aws_region) | |
109 | image = aws.ensure_windows_dev_ami(c) |
|
112 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | |
110 | DIST_PATH.mkdir(exist_ok=True) |
|
113 | DIST_PATH.mkdir(exist_ok=True) | |
111 |
|
114 | |||
112 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
|
115 | with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | |
@@ -169,9 +172,9 b' def run_tests_linux(hga: HGAutomation, a' | |||||
169 |
|
172 | |||
170 |
|
173 | |||
171 | def run_tests_windows(hga: HGAutomation, aws_region, instance_type, |
|
174 | def run_tests_windows(hga: HGAutomation, aws_region, instance_type, | |
172 | python_version, arch, test_flags): |
|
175 | python_version, arch, test_flags, base_image_name): | |
173 | c = hga.aws_connection(aws_region) |
|
176 | c = hga.aws_connection(aws_region) | |
174 | image = aws.ensure_windows_dev_ami(c) |
|
177 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | |
175 |
|
178 | |||
176 | with aws.temporary_windows_dev_instances(c, image, instance_type, |
|
179 | with aws.temporary_windows_dev_instances(c, image, instance_type, | |
177 | disable_antivirus=True) as insts: |
|
180 | disable_antivirus=True) as insts: | |
@@ -217,6 +220,11 b' def get_parser():' | |||||
217 | 'bootstrap-windows-dev', |
|
220 | 'bootstrap-windows-dev', | |
218 | help='Bootstrap the Windows development environment', |
|
221 | help='Bootstrap the Windows development environment', | |
219 | ) |
|
222 | ) | |
|
223 | sp.add_argument( | |||
|
224 | '--base-image-name', | |||
|
225 | help='AMI name of base image', | |||
|
226 | default=aws.WINDOWS_BASE_IMAGE_NAME, | |||
|
227 | ) | |||
220 | sp.set_defaults(func=bootstrap_windows_dev) |
|
228 | sp.set_defaults(func=bootstrap_windows_dev) | |
221 |
|
229 | |||
222 | sp = subparsers.add_parser( |
|
230 | sp = subparsers.add_parser( | |
@@ -232,6 +240,11 b' def get_parser():' | |||||
232 | '--version', |
|
240 | '--version', | |
233 | help='Mercurial version string to use', |
|
241 | help='Mercurial version string to use', | |
234 | ) |
|
242 | ) | |
|
243 | sp.add_argument( | |||
|
244 | '--base-image-name', | |||
|
245 | help='AMI name of base image', | |||
|
246 | default=aws.WINDOWS_BASE_IMAGE_NAME, | |||
|
247 | ) | |||
235 | sp.set_defaults(func=build_all_windows_packages) |
|
248 | sp.set_defaults(func=build_all_windows_packages) | |
236 |
|
249 | |||
237 | sp = subparsers.add_parser( |
|
250 | sp = subparsers.add_parser( | |
@@ -254,6 +267,11 b' def get_parser():' | |||||
254 | '--version', |
|
267 | '--version', | |
255 | help='Mercurial version string to use in installer', |
|
268 | help='Mercurial version string to use in installer', | |
256 | ) |
|
269 | ) | |
|
270 | sp.add_argument( | |||
|
271 | '--base-image-name', | |||
|
272 | help='AMI name of base image', | |||
|
273 | default=aws.WINDOWS_BASE_IMAGE_NAME, | |||
|
274 | ) | |||
257 | sp.set_defaults(func=build_inno) |
|
275 | sp.set_defaults(func=build_inno) | |
258 |
|
276 | |||
259 | sp = subparsers.add_parser( |
|
277 | sp = subparsers.add_parser( | |
@@ -272,6 +290,11 b' def get_parser():' | |||||
272 | help='Mercurial revision to build', |
|
290 | help='Mercurial revision to build', | |
273 | default='.', |
|
291 | default='.', | |
274 | ) |
|
292 | ) | |
|
293 | sp.add_argument( | |||
|
294 | '--base-image-name', | |||
|
295 | help='AMI name of base image', | |||
|
296 | default=aws.WINDOWS_BASE_IMAGE_NAME, | |||
|
297 | ) | |||
275 | sp.set_defaults(func=build_windows_wheel) |
|
298 | sp.set_defaults(func=build_windows_wheel) | |
276 |
|
299 | |||
277 | sp = subparsers.add_parser( |
|
300 | sp = subparsers.add_parser( | |
@@ -294,6 +317,11 b' def get_parser():' | |||||
294 | '--version', |
|
317 | '--version', | |
295 | help='Mercurial version string to use in installer', |
|
318 | help='Mercurial version string to use in installer', | |
296 | ) |
|
319 | ) | |
|
320 | sp.add_argument( | |||
|
321 | '--base-image-name', | |||
|
322 | help='AMI name of base image', | |||
|
323 | default=aws.WINDOWS_BASE_IMAGE_NAME, | |||
|
324 | ) | |||
297 | sp.set_defaults(func=build_wix) |
|
325 | sp.set_defaults(func=build_wix) | |
298 |
|
326 | |||
299 | sp = subparsers.add_parser( |
|
327 | sp = subparsers.add_parser( | |
@@ -368,6 +396,11 b' def get_parser():' | |||||
368 | '--test-flags', |
|
396 | '--test-flags', | |
369 | help='Extra command line flags to pass to run-tests.py', |
|
397 | help='Extra command line flags to pass to run-tests.py', | |
370 | ) |
|
398 | ) | |
|
399 | sp.add_argument( | |||
|
400 | '--base-image-name', | |||
|
401 | help='AMI name of base image', | |||
|
402 | default=aws.WINDOWS_BASE_IMAGE_NAME, | |||
|
403 | ) | |||
371 | sp.set_defaults(func=run_tests_windows) |
|
404 | sp.set_defaults(func=run_tests_windows) | |
372 |
|
405 | |||
373 | return parser |
|
406 | return parser |
General Comments 0
You need to be logged in to leave comments.
Login now