Merge pull request #816 from moreati/issue815
Expand coverage of mitogen/<distro>-test docker imagespull/707/head^2
commit
36f3e3b28c
@ -0,0 +1,20 @@
|
||||
- name: Start containers
|
||||
hosts: all
|
||||
strategy: mitogen_free
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Fetch container images
|
||||
docker_image:
|
||||
name: "{{ docker_base }}"
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Start containers
|
||||
docker_container:
|
||||
name: "{{ inventory_hostname }}"
|
||||
image: "{{ docker_base }}"
|
||||
command: /bin/bash
|
||||
hostname: "mitogen-{{ inventory_hostname }}"
|
||||
detach: true
|
||||
interactive: true
|
||||
tty: true
|
||||
delegate_to: localhost
|
@ -0,0 +1,18 @@
|
||||
- name: Prepare images
|
||||
hosts: all
|
||||
strategy: mitogen_free
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: Commit containers
|
||||
command: >
|
||||
docker commit
|
||||
--change 'EXPOSE 22'
|
||||
--change 'CMD ["/usr/sbin/sshd", "-D"]'
|
||||
{{ inventory_hostname }}
|
||||
public.ecr.aws/n5z0e8q9/{{ inventory_hostname }}-test
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Stop containers
|
||||
command: >
|
||||
docker rm -f {{ inventory_hostname }}
|
||||
delegate_to: localhost
|
@ -1,7 +1,11 @@
|
||||
|
||||
[defaults]
|
||||
deprecation_warnings = false
|
||||
strategy_plugins = ../../ansible_mitogen/plugins/strategy
|
||||
retry_files_enabled = false
|
||||
display_args_to_stdout = True
|
||||
no_target_syslog = True
|
||||
host_key_checking = False
|
||||
|
||||
[inventory]
|
||||
unparsed_is_fatal = true
|
||||
|
@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Build the Docker images used for testing.
|
||||
"""
|
||||
|
||||
import commands
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
BASEDIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def sh(s, *args):
|
||||
if args:
|
||||
s %= args
|
||||
return shlex.split(s)
|
||||
|
||||
|
||||
|
||||
label_by_id = {}
|
||||
|
||||
for base_image, label in [
|
||||
('astj/centos5-vault', 'centos5'), # Python 2.4.3
|
||||
# Debian containers later than debuerreotype/debuerreotype#48 no longer
|
||||
# ship a stub 'initctl', causing (apparently) the Ansible service
|
||||
# module run at the end of DebOps to trigger a full stop/start of SSHd.
|
||||
# When SSHd is killed, Docker responds by destroying the container.
|
||||
# Proper solution is to include a full /bin/init; Docker --init doesn't
|
||||
# help. In the meantime, just use a fixed older version.
|
||||
('debian:stretch-20181112', 'debian'), # Python 2.7.13, 3.5.3
|
||||
('centos:6', 'centos6'), # Python 2.6.6
|
||||
('centos:7', 'centos7') # Python 2.7.5
|
||||
]:
|
||||
args = sh('docker run --rm -it -d -h mitogen-%s %s /bin/bash',
|
||||
label, base_image)
|
||||
container_id = subprocess.check_output(args).strip()
|
||||
label_by_id[container_id] = label
|
||||
|
||||
with tempfile.NamedTemporaryFile() as fp:
|
||||
fp.write('[all]\n')
|
||||
for id_, label in label_by_id.items():
|
||||
fp.write('%s ansible_host=%s\n' % (label, id_))
|
||||
fp.flush()
|
||||
|
||||
try:
|
||||
subprocess.check_call(
|
||||
cwd=BASEDIR,
|
||||
args=sh('ansible-playbook -i %s -c docker setup.yml', fp.name) + sys.argv[1:],
|
||||
)
|
||||
|
||||
for container_id, label in label_by_id.items():
|
||||
subprocess.check_call(sh('''
|
||||
docker commit
|
||||
--change 'EXPOSE 22'
|
||||
--change 'CMD ["/usr/sbin/sshd", "-D"]'
|
||||
%s
|
||||
mitogen/%s-test
|
||||
''', container_id, label))
|
||||
finally:
|
||||
subprocess.check_call(sh('docker rm -f %s', ' '.join(label_by_id)))
|
@ -1,3 +1,9 @@
|
||||
common_packages:
|
||||
- openssh-server
|
||||
- rsync
|
||||
- strace
|
||||
- sudo
|
||||
|
||||
sudo_group:
|
||||
MacOSX: admin
|
||||
Debian: sudo
|
@ -0,0 +1,6 @@
|
||||
bootstrap_packages: [python-simplejson]
|
||||
|
||||
docker_base: astj/centos5-vault
|
||||
|
||||
packages:
|
||||
- perl
|
@ -0,0 +1,6 @@
|
||||
bootstrap_packages: [python]
|
||||
|
||||
docker_base: moreati/centos6-vault
|
||||
|
||||
packages:
|
||||
- perl-JSON
|
@ -0,0 +1,8 @@
|
||||
bootstrap_packages: [python]
|
||||
|
||||
docker_base: centos:7
|
||||
|
||||
packages:
|
||||
- perl-JSON
|
||||
- python-virtualenv
|
||||
- python3
|
@ -0,0 +1,10 @@
|
||||
bootstrap_packages: [python3]
|
||||
|
||||
docker_base: centos:8
|
||||
|
||||
packages:
|
||||
- perl-JSON
|
||||
- python2-virtualenv
|
||||
- python3-virtualenv
|
||||
- python36
|
||||
- python38
|
@ -0,0 +1,11 @@
|
||||
bootstrap_packages: [python]
|
||||
|
||||
docker_base: debian:10
|
||||
|
||||
packages:
|
||||
- libjson-perl
|
||||
- locales
|
||||
- python-virtualenv
|
||||
- python3
|
||||
- python3-virtualenv
|
||||
- virtualenv
|
@ -0,0 +1,11 @@
|
||||
bootstrap_packages: [python3, python3-apt]
|
||||
|
||||
docker_base: debian:bullseye
|
||||
|
||||
packages:
|
||||
- libjson-perl
|
||||
- locales
|
||||
- python-is-python3
|
||||
- python2
|
||||
- python3-virtualenv
|
||||
- virtualenv
|
@ -0,0 +1,11 @@
|
||||
bootstrap_packages: [python]
|
||||
|
||||
docker_base: debian:9
|
||||
|
||||
packages:
|
||||
- libjson-perl
|
||||
- locales
|
||||
- python-virtualenv
|
||||
- python3
|
||||
- python3-virtualenv
|
||||
- virtualenv
|
@ -0,0 +1,11 @@
|
||||
bootstrap_packages: [python]
|
||||
|
||||
docker_base: ubuntu:16.04
|
||||
|
||||
packages:
|
||||
- libjson-perl
|
||||
- locales
|
||||
- python-virtualenv
|
||||
- python3
|
||||
- python3-virtualenv
|
||||
- virtualenv
|
@ -0,0 +1,11 @@
|
||||
bootstrap_packages: [python]
|
||||
|
||||
docker_base: ubuntu:18.04
|
||||
|
||||
packages:
|
||||
- libjson-perl
|
||||
- locales
|
||||
- python-virtualenv
|
||||
- python3
|
||||
- python3-virtualenv
|
||||
- virtualenv
|
@ -0,0 +1,11 @@
|
||||
bootstrap_packages: [python3]
|
||||
|
||||
docker_base: ubuntu:20.04
|
||||
|
||||
packages:
|
||||
- libjson-perl
|
||||
- locales
|
||||
- python-is-python3
|
||||
- python2
|
||||
- python3-virtualenv
|
||||
- virtualenv
|
@ -0,0 +1,23 @@
|
||||
[all:children]
|
||||
centos
|
||||
debian
|
||||
ubuntu
|
||||
|
||||
[all:vars]
|
||||
ansible_connection = docker
|
||||
|
||||
[centos]
|
||||
centos5
|
||||
centos6
|
||||
centos7
|
||||
centos8
|
||||
|
||||
[debian]
|
||||
debian9
|
||||
debian10
|
||||
debian11
|
||||
|
||||
[ubuntu]
|
||||
ubuntu1604
|
||||
ubuntu1804
|
||||
ubuntu2004
|
@ -1,3 +1,6 @@
|
||||
#!/usr/bin/env ansible-playbook
|
||||
|
||||
- include: _container_create.yml
|
||||
- include: _container_setup.yml
|
||||
- include: _user_accounts.yml
|
||||
- include: _container_finalize.yml
|
||||
|
@ -0,0 +1,29 @@
|
||||
[tox]
|
||||
envlist =
|
||||
ansible2.3,
|
||||
ansible2.10,
|
||||
skipsdist = true
|
||||
|
||||
[testenv]
|
||||
setenv =
|
||||
ANSIBLE_STRATEGY_PLUGINS={envsitepackagesdir}/ansible_mitogen/plugins/strategy
|
||||
|
||||
[testenv:ansible2.3]
|
||||
basepython = python2
|
||||
deps =
|
||||
ansible>=2.3,<2.4
|
||||
docker-py>=1.7.0
|
||||
mitogen>=0.2.10rc1,<0.3
|
||||
install_command =
|
||||
python -m pip --no-python-version-warning install {opts} {packages}
|
||||
commands =
|
||||
./setup.yml -i hosts.ini -l 'localhost,centos5' {posargs}
|
||||
|
||||
[testenv:ansible2.10]
|
||||
basepython = python3
|
||||
deps =
|
||||
ansible>=2.10,<2.11
|
||||
docker>=1.8.0
|
||||
mitogen>=0.3.0rc1,<0.4
|
||||
commands =
|
||||
./setup.yml -i hosts.ini -l '!centos5' {posargs}
|
Loading…
Reference in New Issue