Mercurial > public > mercurial-scm > hg
annotate contrib/automation/hgautomation/cli.py @ 43057:c5c502bd1f70
automation: add a command to submit to a Try server
The CI code for running the Try Server requires more thorough review.
Let's add just the client-side bits for submitting to Try so others
can start using it.
Differential Revision: https://phab.mercurial-scm.org/D6983
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 05 Oct 2019 11:21:39 -0400 |
parents | b8df6a470bbb |
children | 2372284d9457 |
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, |
43057
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
20 try_server, |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 windows, |
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 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 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
|
26 DIST_PATH = SOURCE_ROOT / 'dist' |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
29 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
|
30 parallel=False): |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
31 c = hga.aws_connection(aws_region) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
32 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
33 if distros: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
34 distros = distros.split(',') |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
35 else: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
36 distros = sorted(linux.DISTROS) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
37 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
38 # 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
|
39 # 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
|
40 # 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
|
41 # so we don't orphan instances. |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
42 if parallel: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
43 fs = [] |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
44 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
45 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
|
46 for distro in distros: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
47 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
|
48 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
49 for f in fs: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
50 f.result() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
51 else: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
52 for distro in distros: |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
53 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
|
54 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
55 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
56 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
|
57 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
|
58 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
|
59 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
|
60 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
62 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
|
63 base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 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
|
65 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
|
66 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 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
|
69 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 for a in arch: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 windows.build_inno_installer(instance.winrm_client, a, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 DIST_PATH, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 version=version) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
79 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
|
80 base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 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
|
82 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
|
83 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 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
|
86 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 for a in arch: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 windows.build_wix_installer(instance.winrm_client, a, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 DIST_PATH, version=version) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
95 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
|
96 base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
97 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
|
98 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
|
99 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 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
|
102 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
103 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
104 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
105 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
106 for a in arch: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
107 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
|
108 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
109 |
42283
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
110 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
|
111 version, base_image_name): |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
112 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
|
113 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
|
114 DIST_PATH.mkdir(exist_ok=True) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
115 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
116 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
|
117 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
118 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
119 winrm_client = instance.winrm_client |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
120 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
121 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
122 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
123 for arch in ('x86', 'x64'): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
124 windows.purge_hg(winrm_client) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
125 windows.build_wheel(winrm_client, arch, DIST_PATH) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
126 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
|
127 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
|
128 version=version) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
129 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
|
130 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
|
131 version=version) |
42024
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 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
134 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
|
135 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
|
136 aws.terminate_ec2_instances(c.ec2resource) |
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 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
139 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
|
140 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
|
141 aws.remove_resources(c) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
142 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
143 |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
144 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
|
145 python_version, test_flags, distro, filesystem): |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
146 c = hga.aws_connection(aws_region) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
147 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
|
148 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
149 t_start = time.time() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
150 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
151 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
|
152 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
153 with aws.temporary_linux_dev_instances( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
154 c, image, instance_type, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
155 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
|
156 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
157 instance = insts[0] |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
158 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
159 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
|
160 filesystem=filesystem) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
161 linux.synchronize_hg(SOURCE_ROOT, instance, '.') |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
162 t_prepared = time.time() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
163 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
|
164 test_flags) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
165 t_done = time.time() |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
166 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
167 t_setup = t_prepared - t_start |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
168 t_all = t_done - t_start |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
169 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
170 print( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
171 '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
|
172 % (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
|
173 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
174 |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
175 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
|
176 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
|
177 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
|
178 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
|
179 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
180 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
|
181 disable_antivirus=True) as insts: |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
182 instance = insts[0] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
183 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
184 windows.synchronize_hg(SOURCE_ROOT, '.', instance) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
185 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
|
186 test_flags) |
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 |
42907
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
189 def publish_windows_artifacts(hg: HGAutomation, aws_region, version: str, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
190 pypi: bool, mercurial_scm_org: bool, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
191 ssh_username: str): |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
192 windows.publish_artifacts(DIST_PATH, version, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
193 pypi=pypi, mercurial_scm_org=mercurial_scm_org, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
194 ssh_username=ssh_username) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
195 |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
196 |
43057
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
197 def run_try(hga: HGAutomation, aws_region: str, rev: str): |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
198 c = hga.aws_connection(aws_region, ensure_ec2_state=False) |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
199 try_server.trigger_try(c, rev=rev) |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
200 |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
201 |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
202 def get_parser(): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
203 parser = argparse.ArgumentParser() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
204 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
205 parser.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
206 '--state-path', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
207 default='~/.hgautomation', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
208 help='Path for local state files', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
209 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
210 parser.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
211 '--aws-region', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
212 help='AWS region to use', |
43055
b8df6a470bbb
automation: switch to us-west-2 by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43018
diff
changeset
|
213 default='us-west-2', |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
214 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
215 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
216 subparsers = parser.add_subparsers() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
217 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
218 sp = subparsers.add_parser( |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
219 'bootstrap-linux-dev', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
220 help='Bootstrap Linux development environments', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
221 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
222 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
223 '--distros', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
224 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
|
225 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
226 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
227 '--parallel', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
228 action='store_true', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
229 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
|
230 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
231 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
|
232 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
233 sp = subparsers.add_parser( |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
234 'bootstrap-windows-dev', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
235 help='Bootstrap the Windows development environment', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
236 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
237 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
238 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
239 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
240 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
241 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
242 sp.set_defaults(func=bootstrap_windows_dev) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
243 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
244 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
245 'build-all-windows-packages', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
246 help='Build all Windows packages', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
247 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
248 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
249 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
250 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
251 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
252 ) |
42283
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
253 sp.add_argument( |
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
254 '--version', |
d137a3d5ad41
automation: add --version argument to build-all-windows-packages
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42277
diff
changeset
|
255 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
|
256 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
257 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
258 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
259 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
260 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
261 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
262 sp.set_defaults(func=build_all_windows_packages) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
263 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
264 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
265 'build-inno', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
266 help='Build Inno Setup installer(s)', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
267 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
268 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
269 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
270 help='Architecture to build for', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
271 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
272 nargs='*', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
273 default=['x64'], |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
274 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
275 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
276 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
277 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
278 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
279 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
280 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
281 '--version', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
282 help='Mercurial version string to use in installer', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
283 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
284 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
285 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
286 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
287 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
288 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
289 sp.set_defaults(func=build_inno) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
290 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
291 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
292 'build-windows-wheel', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
293 help='Build Windows wheel(s)', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
294 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
295 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
296 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
297 help='Architecture to build for', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
298 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
299 nargs='*', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
300 default=['x64'], |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
301 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
302 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
303 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
304 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
305 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
306 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
307 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
308 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
309 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
310 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
311 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
312 sp.set_defaults(func=build_windows_wheel) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
313 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
314 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
315 'build-wix', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
316 help='Build WiX installer(s)' |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
317 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
318 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
319 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
320 help='Architecture to build for', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
321 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
322 nargs='*', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
323 default=['x64'], |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
324 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
325 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
326 '--revision', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
327 help='Mercurial revision to build', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
328 default='.', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
329 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
330 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
331 '--version', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
332 help='Mercurial version string to use in installer', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
333 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
334 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
335 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
336 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
337 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
338 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
339 sp.set_defaults(func=build_wix) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
340 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
341 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
342 'terminate-ec2-instances', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
343 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
|
344 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
345 sp.set_defaults(func=terminate_ec2_instances) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
346 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
347 sp = subparsers.add_parser( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
348 'purge-ec2-resources', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
349 help='Purge all EC2 resources managed by us', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
350 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
351 sp.set_defaults(func=purge_ec2_resources) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
352 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
353 sp = subparsers.add_parser( |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
354 'run-tests-linux', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
355 help='Run tests on Linux', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
356 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
357 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
358 '--distro', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
359 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
|
360 choices=linux.DISTROS, |
43018
d1d919f679f7
automation: support and use Debian Buster by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42907
diff
changeset
|
361 default='debian10', |
42285
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
362 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
363 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
364 '--filesystem', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
365 help='Filesystem type to use', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
366 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
|
367 default='default', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
368 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
369 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
370 '--instance-type', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
371 help='EC2 instance type to use', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
372 default='c5.9xlarge', |
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.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
375 '--python-version', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
376 help='Python version to use', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
377 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
|
378 'pypy', 'pypy3.5', 'pypy3.6'}, |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
379 default='system2', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
380 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
381 sp.add_argument( |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
382 'test_flags', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
383 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
|
384 nargs='*', |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
385 ) |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
386 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
|
387 |
65b3ef162b39
automation: initial support for running Linux tests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42283
diff
changeset
|
388 sp = subparsers.add_parser( |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
389 'run-tests-windows', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
390 help='Run tests on Windows', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
391 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
392 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
393 '--instance-type', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
394 help='EC2 instance type to use', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
395 default='t3.medium', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
396 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
397 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
398 '--python-version', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
399 help='Python version to use', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
400 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
|
401 default='2.7', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
402 ) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
403 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
404 '--arch', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
405 help='Architecture to test', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
406 choices={'x86', 'x64'}, |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
407 default='x64', |
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 sp.add_argument( |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
410 '--test-flags', |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
411 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
|
412 ) |
42648
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
413 sp.add_argument( |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
414 '--base-image-name', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
415 help='AMI name of base image', |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
416 default=aws.WINDOWS_BASE_IMAGE_NAME, |
d80edcb0b30c
automation: make Windows base image name configurable
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42285
diff
changeset
|
417 ) |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
418 sp.set_defaults(func=run_tests_windows) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
419 |
42907
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
420 sp = subparsers.add_parser( |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
421 'publish-windows-artifacts', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
422 help='Publish built Windows artifacts (wheels, installers, etc)' |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
423 ) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
424 sp.add_argument( |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
425 '--no-pypi', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
426 dest='pypi', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
427 action='store_false', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
428 default=True, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
429 help='Skip uploading to PyPI', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
430 ) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
431 sp.add_argument( |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
432 '--no-mercurial-scm-org', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
433 dest='mercurial_scm_org', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
434 action='store_false', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
435 default=True, |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
436 help='Skip uploading to www.mercurial-scm.org', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
437 ) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
438 sp.add_argument( |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
439 '--ssh-username', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
440 help='SSH username for mercurial-scm.org', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
441 ) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
442 sp.add_argument( |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
443 'version', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
444 help='Mercurial version string to locate local packages', |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
445 ) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
446 sp.set_defaults(func=publish_windows_artifacts) |
92593d72e10b
automation: implement "publish-windows-artifacts" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
42648
diff
changeset
|
447 |
43057
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
448 sp = subparsers.add_parser( |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
449 'try', |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
450 help='Run CI automation against a custom changeset' |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
451 ) |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
452 sp.add_argument('-r', '--rev', |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
453 default='.', |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
454 help='Revision to run CI on') |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
455 sp.set_defaults(func=run_try) |
c5c502bd1f70
automation: add a command to submit to a Try server
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43055
diff
changeset
|
456 |
42024
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
457 return parser |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
458 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
459 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
460 def main(): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
461 parser = get_parser() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
462 args = parser.parse_args() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
463 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
464 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
|
465 automation = HGAutomation(local_state_path) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
466 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
467 if not hasattr(args, 'func'): |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
468 parser.print_help() |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
469 return |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
470 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
471 kwargs = dict(vars(args)) |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
472 del kwargs['func'] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
473 del kwargs['state_path'] |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
474 |
b05a3e28cf24
automation: perform tasks on remote machines
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
475 args.func(automation, **kwargs) |