From e2e7390adc65298756e7359b7ddc59b4f7b87a3a Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 23 Aug 2016 23:08:11 -0700 Subject: [PATCH] Add Python 3 CI support. (#17209) --- test/utils/docker/ubuntu1604py3/Dockerfile | 61 +++++++++++++++++++ test/utils/shippable/integration.sh | 15 +++++ .../shippable/python3-test-tag-blacklist.txt | 44 +++++++++++++ .../python3-test-target-blacklist.txt | 14 +++++ 4 files changed, 134 insertions(+) create mode 100644 test/utils/docker/ubuntu1604py3/Dockerfile create mode 100644 test/utils/shippable/python3-test-tag-blacklist.txt create mode 100644 test/utils/shippable/python3-test-target-blacklist.txt diff --git a/test/utils/docker/ubuntu1604py3/Dockerfile b/test/utils/docker/ubuntu1604py3/Dockerfile new file mode 100644 index 00000000000..42c75d0bebc --- /dev/null +++ b/test/utils/docker/ubuntu1604py3/Dockerfile @@ -0,0 +1,61 @@ +FROM ubuntu:16.04 + +RUN apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + acl \ + apache2 \ + bzip2 \ + curl \ + debhelper \ + debianutils \ + devscripts \ + docbook-xml \ + dpkg-dev \ + fakeroot \ + gawk \ + git \ + iproute2 \ + libxml2-utils \ + locales \ + lsb-release \ + make \ + mysql-server \ + openssh-client \ + openssh-server \ + python3-coverage \ + python3-dbus \ + python3-httplib2 \ + python3-jinja2 \ + python3-mock \ + python3-mysqldb \ + python3-nose \ + python3-paramiko \ + python3-passlib \ + python3-pip \ + python3-setuptools \ + python3-virtualenv \ + python3-wheel \ + python3-yaml \ + reprepro \ + rsync \ + ruby \ + subversion \ + sudo \ + unzip \ + virtualenv \ + xsltproc \ + zip \ + && \ + apt-get clean + +RUN rm /etc/apt/apt.conf.d/docker-clean +RUN mkdir /etc/ansible/ +RUN /bin/echo -e "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts +RUN locale-gen en_US.UTF-8 +RUN ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \ + cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \ + for key in /etc/ssh/ssh_host_*_key.pub; do echo "localhost $(cat ${key})" >> /root/.ssh/known_hosts; done +VOLUME /sys/fs/cgroup /run/lock /run /tmp +RUN pip3 install junit-xml python3-keyczar +ENV container=docker +CMD ["/sbin/init"] diff --git a/test/utils/shippable/integration.sh b/test/utils/shippable/integration.sh index c74ba35883d..bd6d20effd9 100755 --- a/test/utils/shippable/integration.sh +++ b/test/utils/shippable/integration.sh @@ -7,6 +7,7 @@ test_privileged="${PRIVILEGED:-false}" test_flags="${TEST_FLAGS:-}" test_target="${TARGET:-}" test_ansible_dir="${TEST_ANSIBLE_DIR:-/root/ansible}" +test_python3="${PYTHON3:-}" http_image="${HTTP_IMAGE:-ansible/ansible:httptester}" @@ -85,12 +86,26 @@ container_id=$(docker run -d \ show_environment +if [ "${test_python3}" ]; then + docker exec "${container_id}" ln -s /usr/bin/python3 /usr/bin/python + docker exec "${container_id}" ln -s /usr/bin/pip3 /usr/bin/pip + + skip_tags=$(tr '\n' ',' < "${source_root}/test/utils/shippable/python3-test-tag-blacklist.txt") + test_flags="--skip-tags ${skip_tags} ${test_flags}" +fi + docker exec "${container_id}" pip install jmespath if [ "${copy_source}" ]; then docker exec "${container_id}" cp -a "${test_shared_dir}" "${test_ansible_dir}" fi +if [ "${test_python3}" ]; then + docker exec "${container_id}" sed -i -f \ + "${test_ansible_dir}/test/utils/shippable/python3-test-target-blacklist.txt" \ + "${test_ansible_dir}/test/integration/Makefile" +fi + docker exec "${container_id}" mkdir -p "${test_shared_dir}/shippable/testresults" docker exec "${container_id}" /bin/sh -c "cd '${test_ansible_dir}' && . hacking/env-setup && cd test/integration && \ JUNIT_OUTPUT_DIR='${test_shared_dir}/shippable/testresults' ANSIBLE_CALLBACK_WHITELIST=junit \ diff --git a/test/utils/shippable/python3-test-tag-blacklist.txt b/test/utils/shippable/python3-test-tag-blacklist.txt new file mode 100644 index 00000000000..f523139cc58 --- /dev/null +++ b/test/utils/shippable/python3-test-tag-blacklist.txt @@ -0,0 +1,44 @@ +test_apache2_module +test_apt +test_apt_repository +test_assemble +test_async +test_authorized_key +test_become +test_binary +test_changed_when +test_command_shell +test_conditionals +test_copy +test_embedded_module +test_facts_d +test_failed_when +test_fetch +test_file +test_filters +test_gem +test_get_url +test_git +test_good_parsing +test_handlers +test_hg +test_iterators +test_lineinfile +test_lookups +test_mysql_db +test_mysql_user +test_mysql_variables +test_pip +test_postgresql +test_service +test_special_vars +test_stat +test_subversion +test_sudo +test_synchronize +test_task_ordering +test_template +test_unarchive +test_until +test_uri +test_var_blending diff --git a/test/utils/shippable/python3-test-target-blacklist.txt b/test/utils/shippable/python3-test-target-blacklist.txt new file mode 100644 index 00000000000..7825b2f7875 --- /dev/null +++ b/test/utils/shippable/python3-test-target-blacklist.txt @@ -0,0 +1,14 @@ +s/ check_mode / / +s/ environment / / +s/ includes / / +s/ no_log / / +s/ pull / / +s/ test_async_conditional / / +s/ test_binary_modules$/ / +s/ test_connection / / +s/ test_handlers / / +s/ test_hash / / +s/ test_lookup_paths / / +s/ test_var_precedence / / +s/ test_vault / / +s/ unicode / /