Skip to content

Commit 2885f62

Browse files
authored
Merge pull request #869 from moreati/azure-tox
ci: Switch Continuous Integration to Tox
2 parents 7e2f921 + c5c65ab commit 2885f62

12 files changed

+60
-190
lines changed

.ci/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ for doing `setup.py install` while pulling a Docker container, for example.
2828

2929
### Environment Variables
3030

31-
* `VER`: Ansible version the `_install` script should install. Default changes
32-
over time.
3331
* `TARGET_COUNT`: number of targets for `debops_` run. Defaults to 2.
3432
* `DISTRO`: the `mitogen_` tests need a target Docker container distro. This
3533
name comes from the Docker Hub `mitogen` user, i.e. `mitogen/$DISTRO-test`

.ci/ansible_install.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,9 @@
33
import ci_lib
44

55
batches = [
6-
[
7-
'pip install '
8-
'-r tests/requirements.txt '
9-
'-r tests/ansible/requirements.txt',
10-
# encoding is required for installing ansible 2.10 with pip2, otherwise we get a UnicodeDecode error
11-
'LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 pip install "ansible-base<2.10.14" "ansible=={}"'.format(ci_lib.ANSIBLE_VERSION)
12-
],
136
[
147
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
158
]
169
]
1710

18-
batches[-1].extend([
19-
'docker pull %s' % (ci_lib.image_for_distro(distro),)
20-
for distro in ci_lib.DISTROS
21-
])
22-
2311
ci_lib.run_batches(batches)

.ci/azure-pipelines-steps.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@ parameters:
55
sign: false
66

77
steps:
8-
- script: "PYTHONVERSION=$(python.version) .ci/prep_azure.py"
9-
displayName: "Run prep_azure.py"
8+
- task: UsePythonVersion@0
9+
displayName: Install python
10+
inputs:
11+
versionSpec: '$(python.version)'
1012

11-
- script: |
12-
echo "##vso[task.prependpath]/tmp/venv/bin"
13+
- script: python -mpip install tox
14+
displayName: Install tooling
1315

14-
displayName: activate venv
15-
16-
- script: .ci/$(MODE)_install.py
17-
displayName: "Run $(MODE)_install.py"
16+
- script: tox -e $(tox.env)
17+
displayName: "Run tests"
1818
env:
1919
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
2020
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
2121
AWS_DEFAULT_REGION: $(AWS_DEFAULT_REGION)
22-
23-
- script: .ci/$(MODE)_tests.py
24-
displayName: "Run $(MODE)_tests.py"

.ci/azure-pipelines.yml

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,62 +16,46 @@ jobs:
1616
steps:
1717
- template: azure-pipelines-steps.yml
1818
pool:
19+
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md
1920
vmImage: macOS-10.15
2021
strategy:
2122
matrix:
2223
Mito27_27:
2324
python.version: '2.7'
24-
MODE: mitogen
25+
tox.env: py27-mode_mitogen
26+
2527
# TODO: test python3, python3 tests are broken
2628
Ans210_27:
2729
python.version: '2.7'
28-
MODE: localhost_ansible
29-
VER: 2.10.0
30+
tox.env: py27-mode_localhost-ansible2.10
3031

3132
# NOTE: this hangs when ran in Ubuntu 18.04
3233
Vanilla_210_27:
3334
python.version: '2.7'
34-
MODE: localhost_ansible
35-
VER: 2.10.0
35+
tox.env: py27-mode_localhost-ansible2.10
3636
STRATEGY: linear
3737
ANSIBLE_SKIP_TAGS: resource_intensive
3838

3939

4040
- job: Linux
4141
pool:
42+
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
4243
vmImage: "Ubuntu 18.04"
4344
steps:
4445
- template: azure-pipelines-steps.yml
4546
strategy:
4647
matrix:
47-
#
48-
# Confirmed working
49-
#
5048
Mito27Debian_27:
5149
python.version: '2.7'
52-
MODE: mitogen
53-
DISTRO: debian9
54-
55-
#MitoPy27CentOS6_26:
56-
#python.version: '2.7'
57-
#MODE: mitogen
58-
#DISTRO: centos6
50+
tox.env: py27-mode_mitogen-distro_debian9
5951

6052
Mito36CentOS6_26:
6153
python.version: '3.6'
62-
MODE: mitogen
63-
DISTRO: centos6
64-
65-
Mito37Debian_27:
66-
python.version: '3.7'
67-
MODE: mitogen
68-
DISTRO: debian9
54+
tox.env: py36-mode_mitogen-distro_centos6
6955

7056
Mito39Debian_27:
7157
python.version: '3.9'
72-
MODE: mitogen
73-
DISTRO: debian9
74-
VER: 2.10.0
58+
tox.env: py39-mode_mitogen-distro_debian9
7559

7660
#Py26CentOS7:
7761
#python.version: '2.7'
@@ -117,15 +101,12 @@ jobs:
117101

118102
Ansible_210_27:
119103
python.version: '2.7'
120-
MODE: ansible
121-
VER: 2.10.0
104+
tox.env: py27-mode_ansible-ansible2.10
122105

123-
Ansible_210_35:
124-
python.version: '3.5'
125-
MODE: ansible
126-
VER: 2.10.0
106+
Ansible_210_36:
107+
python.version: '3.6'
108+
tox.env: py36-mode_ansible-ansible2.10
127109

128110
Ansible_210_39:
129111
python.version: '3.9'
130-
MODE: ansible
131-
VER: 2.10.0
112+
tox.env: py39-mode_ansible-ansible2.10

.ci/ci_lib.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ def have_docker():
5959
return proc.wait() == 0
6060

6161

62-
# -----------------
63-
64-
# Force line buffering on stdout.
65-
sys.stdout = os.fdopen(1, 'w', 1)
66-
67-
6862
def _argv(s, *args):
6963
"""Interpolate a command line using *args, return an argv style list.
7064
@@ -195,13 +189,11 @@ def __exit__(self, _1, _2, _3): pass
195189

196190
os.environ.setdefault('ANSIBLE_STRATEGY',
197191
os.environ.get('STRATEGY', 'mitogen_linear'))
198-
# Ignoreed when MODE=mitogen
199-
ANSIBLE_VERSION = os.environ.get('VER', '2.6.2')
200192
GIT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
201193
# Used only when MODE=mitogen
202-
DISTRO = os.environ.get('DISTRO', 'debian')
194+
DISTRO = os.environ.get('DISTRO', 'debian9')
203195
# Used only when MODE=ansible
204-
DISTROS = os.environ.get('DISTROS', 'debian centos6 centos7').split()
196+
DISTROS = os.environ.get('DISTROS', 'centos6 centos8 debian9 debian11 ubuntu1604 ubuntu2004').split()
205197
TARGET_COUNT = int(os.environ.get('TARGET_COUNT', '2'))
206198
BASE_PORT = 2200
207199
TMP = TempDir().path
@@ -254,11 +246,13 @@ def make_containers(name_prefix='', port_offset=0):
254246
>>> pprint.pprint(make_containers())
255247
[{'distro': 'debian',
256248
'hostname': 'localhost',
249+
'image': 'public.ecr.aws/n5z0e8q9/debian-test',
257250
'name': 'target-debian-1',
258251
'port': 2201,
259252
'python_path': '/usr/bin/python'},
260253
{'distro': 'centos6',
261254
'hostname': 'localhost',
255+
'image': 'public.ecr.aws/n5z0e8q9/centos6-test',
262256
'name': 'target-centos6-2',
263257
'port': 2202,
264258
'python_path': '/usr/bin/python'}]
@@ -280,6 +274,7 @@ def make_containers(name_prefix='', port_offset=0):
280274
for x in range(count):
281275
lst.append({
282276
"distro": firstbit(distro),
277+
"image": image_for_distro(distro),
283278
"name": name_prefix + ("target-%s-%s" % (distro, i)),
284279
"hostname": docker_hostname,
285280
"port": BASE_PORT + i + port_offset,
@@ -358,7 +353,7 @@ def start_containers(containers):
358353
"--publish 0.0.0.0:%(port)s:22/tcp "
359354
"--hostname=%(name)s "
360355
"--name=%(name)s "
361-
"mitogen/%(distro)s-test "
356+
"%(image)s"
362357
% container
363358
]
364359
for container in containers

.ci/debops_common_install.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77

88
ci_lib.run_batches([
99
[
10-
'pip install -qqq "debops[ansible]==2.1.2" "ansible-base<2.10.14" "ansible=={}"'.format(ci_lib.ANSIBLE_VERSION),
10+
'pip install -qqq "debops[ansible]==2.1.2"',
1111
],
1212
[
1313
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
14-
'docker pull %s' % (ci_lib.image_for_distro('debian'),),
1514
],
1615
])
1716

.ci/localhost_ansible_install.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
import ci_lib
44

55
batches = [
6-
[
7-
'pip install '
8-
'-r tests/requirements.txt '
9-
'-r tests/ansible/requirements.txt',
10-
'pip install -q "ansible-base<2.10.14" "ansible=={}"'.format(ci_lib.ANSIBLE_VERSION)
11-
]
126
]
137

148
ci_lib.run_batches(batches)

.ci/mitogen_install.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
import ci_lib
44

55
batches = [
6-
[
7-
'pip install -r tests/requirements.txt',
8-
]
96
]
107

118
if ci_lib.have_docker():
129
batches.append([
1310
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
14-
'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),),
1511
])
1612

1713

.ci/mitogen_py24_install.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
batches = [
66
[
77
'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws',
8-
'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),),
98
],
109
[
1110
'curl https://dw.github.io/mitogen/binaries/ubuntu-python-2.4.6.tar.bz2 | sudo tar -C / -jxv',

.ci/prep_azure.py

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)