Mercurial > public > mercurial-scm > hg
annotate contrib/automation/hgautomation/cli.py @ 42648:d80edcb0b30c stable
automation: make Windows base image name configurable
Since automation broke in the middle of the 5.0 release cycle,
there's a good chance it will break again in the future. While
a robust solution might be to search for all available images and
choose the newest one, it does seem useful to be able to explicitly
choose the name of the image to find and use so users can opt in
to using a different image.
This commit implements that functionality.
Differential Revision: https://phab.mercurial-scm.org/D6673
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 22 Jul 2019 19:06:20 -0700 |
parents | 65b3ef162b39 |
children | 92593d72e10b |
rev | line source |
---|---|
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # cli.py - Command line interface for automation |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 # |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 # |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 # no-check-code because Python 3 native. |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 import argparse |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
11 import concurrent.futures as futures |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 import os |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 import pathlib |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
14 import time |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 from . import ( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 aws, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 HGAutomation, |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
19 linux, |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 windows, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 SOURCE_ROOT = pathlib.Path(os.path.abspath(__file__)).parent.parent.parent.parent |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 DIST_PATH = SOURCE_ROOT / 'dist' |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
28 def bootstrap_linux_dev(hga: HGAutomation, aws_region, distros=None, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
29 parallel=False): |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
30 c = hga.aws_connection(aws_region) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
31 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
32 if distros: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
33 distros = distros.split(',') |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
34 else: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
35 distros = sorted(linux.DISTROS) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
36 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
37 # TODO There is a wonky interaction involving KeyboardInterrupt whereby |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
38 # the context manager that is supposed to terminate the temporary EC2 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
39 # instance doesn't run. Until we fix this, make parallel building opt-in |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
40 # so we don't orphan instances. |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
41 if parallel: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
42 fs = [] |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
43 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
44 with futures.ThreadPoolExecutor(len(distros)) as e: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
45 for distro in distros: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
46 fs.append(e.submit(aws.ensure_linux_dev_ami, c, distro=distro)) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
47 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
48 for f in fs: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
49 f.result() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
50 else: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
51 for distro in distros: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
52 aws.ensure_linux_dev_ami(c, distro=distro) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
53 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
54 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
55 def bootstrap_windows_dev(hga: HGAutomation, aws_region, base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 c = hga.aws_connection(aws_region) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
57 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 print('Windows development AMI available as %s' % image.id) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
61 def build_inno(hga: HGAutomation, aws_region, arch, revision, version, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
62 base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 c = hga.aws_connection(aws_region) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
64 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
69 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 for a in arch: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 windows.build_inno_installer(instance.winrm_client, a, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 DIST_PATH, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 version=version) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
78 def build_wix(hga: HGAutomation, aws_region, arch, revision, version, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
79 base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 c = hga.aws_connection(aws_region) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
81 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 for a in arch: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 windows.build_wix_installer(instance.winrm_client, a, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 DIST_PATH, version=version) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
94 def build_windows_wheel(hga: HGAutomation, aws_region, arch, revision, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
95 base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 c = hga.aws_connection(aws_region) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
97 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
98 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
102 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
103 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
104 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
105 for a in arch: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
106 windows.build_wheel(instance.winrm_client, a, DIST_PATH) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
107 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
108 |
42283
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
109 def build_all_windows_packages(hga: HGAutomation, aws_region, revision, |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
110 version, base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
111 c = hga.aws_connection(aws_region) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
112 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
113 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
114 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
115 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
116 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
117 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
118 winrm_client = instance.winrm_client |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
119 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
120 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
121 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
122 for arch in ('x86', 'x64'): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
123 windows.purge_hg(winrm_client) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
124 windows.build_wheel(winrm_client, arch, DIST_PATH) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
125 windows.purge_hg(winrm_client) |
42283
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
126 windows.build_inno_installer(winrm_client, arch, DIST_PATH, |
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
127 version=version) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
128 windows.purge_hg(winrm_client) |
42283
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
129 windows.build_wix_installer(winrm_client, arch, DIST_PATH, |
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
130 version=version) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
131 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
132 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
133 def terminate_ec2_instances(hga: HGAutomation, aws_region): |
42277
dd6a9723ae2b
automation: don't create resources when deleting things
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42024
diff
changeset
|
134 c = hga.aws_connection(aws_region, ensure_ec2_state=False) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
135 aws.terminate_ec2_instances(c.ec2resource) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
136 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
137 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
138 def purge_ec2_resources(hga: HGAutomation, aws_region): |
42277
dd6a9723ae2b
automation: don't create resources when deleting things
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42024
diff
changeset
|
139 c = hga.aws_connection(aws_region, ensure_ec2_state=False) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
140 aws.remove_resources(c) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
141 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
142 |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
143 def run_tests_linux(hga: HGAutomation, aws_region, instance_type, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
144 python_version, test_flags, distro, filesystem): |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
145 c = hga.aws_connection(aws_region) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
146 image = aws.ensure_linux_dev_ami(c, distro=distro) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
147 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
148 t_start = time.time() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
149 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
150 ensure_extra_volume = filesystem not in ('default', 'tmpfs') |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
151 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
152 with aws.temporary_linux_dev_instances( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
153 c, image, instance_type, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
154 ensure_extra_volume=ensure_extra_volume) as insts: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
155 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
156 instance = insts[0] |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
157 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
158 linux.prepare_exec_environment(instance.ssh_client, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
159 filesystem=filesystem) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
160 linux.synchronize_hg(SOURCE_ROOT, instance, '.') |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
161 t_prepared = time.time() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
162 linux.run_tests(instance.ssh_client, python_version, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
163 test_flags) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
164 t_done = time.time() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
165 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
166 t_setup = t_prepared - t_start |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
167 t_all = t_done - t_start |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
168 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
169 print( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
170 'total time: %.1fs; setup: %.1fs; tests: %.1fs; setup overhead: %.1f%%' |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
171 % (t_all, t_setup, t_done - t_prepared, t_setup / t_all * 100.0)) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
172 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
173 |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
174 def run_tests_windows(hga: HGAutomation, aws_region, instance_type, |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
175 python_version, arch, test_flags, base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
176 c = hga.aws_connection(aws_region) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
177 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
178 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
179 with aws.temporary_windows_dev_instances(c, image, instance_type, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
180 disable_antivirus=True) as insts: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
181 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
182 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
183 windows.synchronize_hg(SOURCE_ROOT, '.', instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
184 windows.run_tests(instance.winrm_client, python_version, arch, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
185 test_flags) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
186 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
187 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
188 def get_parser(): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
189 parser = argparse.ArgumentParser() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
190 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
191 parser.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
192 '--state-path', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
193 default='~/.hgautomation', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
194 help='Path for local state files', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
195 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
196 parser.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
197 '--aws-region', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
198 help='AWS region to use', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
199 default='us-west-1', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
200 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
201 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
202 subparsers = parser.add_subparsers() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
203 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
204 sp = subparsers.add_parser( |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
205 'bootstrap-linux-dev', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
206 help='Bootstrap Linux development environments', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
207 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
208 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
209 '--distros', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
210 help='Comma delimited list of distros to bootstrap', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
211 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
212 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
213 '--parallel', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
214 action='store_true', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
215 help='Generate AMIs in parallel (not CTRL-c safe)' |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
216 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
217 sp.set_defaults(func=bootstrap_linux_dev) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
218 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
219 sp = subparsers.add_parser( |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
220 'bootstrap-windows-dev', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
221 help='Bootstrap the Windows development environment', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
222 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
223 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
224 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
225 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
226 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
227 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
228 sp.set_defaults(func=bootstrap_windows_dev) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
229 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
230 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
231 'build-all-windows-packages', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
232 help='Build all Windows packages', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
233 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
234 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
235 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
236 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
237 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
238 ) |
42283
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
239 sp.add_argument( |
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
240 '--version', |
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
241 help='Mercurial version string to use', |
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
242 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
243 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
244 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
245 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
246 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
247 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
248 sp.set_defaults(func=build_all_windows_packages) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
249 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
250 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
251 'build-inno', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
252 help='Build Inno Setup installer(s)', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
253 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
254 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
255 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
256 help='Architecture to build for', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
257 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
258 nargs='*', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
259 default=['x64'], |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
260 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
261 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
262 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
263 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
264 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
265 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
266 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
267 '--version', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
268 help='Mercurial version string to use in installer', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
269 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
270 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
271 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
272 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
273 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
274 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
275 sp.set_defaults(func=build_inno) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
276 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
277 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
278 'build-windows-wheel', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
279 help='Build Windows wheel(s)', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
280 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
281 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
282 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
283 help='Architecture to build for', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
284 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
285 nargs='*', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
286 default=['x64'], |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
287 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
288 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
289 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
290 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
291 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
292 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
293 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
294 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
295 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
296 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
297 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
298 sp.set_defaults(func=build_windows_wheel) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
299 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
300 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
301 'build-wix', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
302 help='Build WiX installer(s)' |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
303 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
304 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
305 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
306 help='Architecture to build for', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
307 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
308 nargs='*', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
309 default=['x64'], |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
310 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
311 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
312 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
313 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
314 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
315 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
316 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
317 '--version', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
318 help='Mercurial version string to use in installer', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
319 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
320 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
321 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
322 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
323 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
324 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
325 sp.set_defaults(func=build_wix) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
326 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
327 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
328 'terminate-ec2-instances', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
329 help='Terminate all active EC2 instances managed by us', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
330 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
331 sp.set_defaults(func=terminate_ec2_instances) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
332 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
333 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
334 'purge-ec2-resources', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
335 help='Purge all EC2 resources managed by us', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
336 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
337 sp.set_defaults(func=purge_ec2_resources) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
338 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
339 sp = subparsers.add_parser( |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
340 'run-tests-linux', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
341 help='Run tests on Linux', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
342 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
343 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
344 '--distro', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
345 help='Linux distribution to run tests on', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
346 choices=linux.DISTROS, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
347 default='debian9', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
348 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
349 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
350 '--filesystem', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
351 help='Filesystem type to use', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
352 choices={'btrfs', 'default', 'ext3', 'ext4', 'jfs', 'tmpfs', 'xfs'}, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
353 default='default', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
354 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
355 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
356 '--instance-type', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
357 help='EC2 instance type to use', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
358 default='c5.9xlarge', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
359 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
360 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
361 '--python-version', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
362 help='Python version to use', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
363 choices={'system2', 'system3', '2.7', '3.5', '3.6', '3.7', '3.8', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
364 'pypy', 'pypy3.5', 'pypy3.6'}, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
365 default='system2', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
366 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
367 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
368 'test_flags', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
369 help='Extra command line flags to pass to run-tests.py', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
370 nargs='*', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
371 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
372 sp.set_defaults(func=run_tests_linux) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
373 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
374 sp = subparsers.add_parser( |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
375 'run-tests-windows', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
376 help='Run tests on Windows', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
377 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
378 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
379 '--instance-type', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
380 help='EC2 instance type to use', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
381 default='t3.medium', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
382 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
383 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
384 '--python-version', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
385 help='Python version to use', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
386 choices={'2.7', '3.5', '3.6', '3.7', '3.8'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
387 default='2.7', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
388 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
389 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
390 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
391 help='Architecture to test', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
392 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
393 default='x64', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
394 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
395 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
396 '--test-flags', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
397 help='Extra command line flags to pass to run-tests.py', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
398 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
399 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
400 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
401 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
402 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
403 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
404 sp.set_defaults(func=run_tests_windows) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
405 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
406 return parser |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
407 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
408 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
409 def main(): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
410 parser = get_parser() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
411 args = parser.parse_args() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
412 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
413 local_state_path = pathlib.Path(os.path.expanduser(args.state_path)) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
414 automation = HGAutomation(local_state_path) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
415 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
416 if not hasattr(args, 'func'): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
417 parser.print_help() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
418 return |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
419 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
420 kwargs = dict(vars(args)) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
421 del kwargs['func'] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
422 del kwargs['state_path'] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
423 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
424 args.func(automation, **kwargs) |