diff --git a/shippable.yml b/shippable.yml index d70d894437b..86ee46764b6 100644 --- a/shippable.yml +++ b/shippable.yml @@ -32,6 +32,7 @@ matrix: - env: T=rhel/8.2/1 - env: T=freebsd/11.1/1 - env: T=freebsd/12.1/1 + - env: T=linux/alpine3/1 - env: T=linux/centos6/1 - env: T=linux/centos7/1 - env: T=linux/centos8/1 @@ -47,6 +48,7 @@ matrix: - env: T=rhel/8.2/2 - env: T=freebsd/11.1/2 - env: T=freebsd/12.1/2 + - env: T=linux/alpine3/2 - env: T=linux/centos6/2 - env: T=linux/centos7/2 - env: T=linux/centos8/2 @@ -62,6 +64,7 @@ matrix: - env: T=rhel/8.2/3 - env: T=freebsd/11.1/3 - env: T=freebsd/12.1/3 + - env: T=linux/alpine3/3 - env: T=linux/centos6/3 - env: T=linux/centos7/3 - env: T=linux/centos8/3 @@ -77,6 +80,7 @@ matrix: - env: T=rhel/8.2/4 - env: T=freebsd/11.1/4 - env: T=freebsd/12.1/4 + - env: T=linux/alpine3/4 - env: T=linux/centos6/4 - env: T=linux/centos7/4 - env: T=linux/centos8/4 @@ -92,6 +96,7 @@ matrix: - env: T=rhel/8.2/5 - env: T=freebsd/11.1/5 - env: T=freebsd/12.1/5 + - env: T=linux/alpine3/5 - env: T=linux/centos6/5 - env: T=linux/centos7/5 - env: T=linux/centos8/5 diff --git a/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml b/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml index f4beb9d61ef..b83d3e78e7a 100644 --- a/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml +++ b/test/integration/targets/ansible-galaxy-collection-scm/tasks/setup.yml @@ -1,7 +1,7 @@ - name: ensure git is installed package: name: git - when: ansible_distribution != "MacOSX" + when: ansible_distribution not in ["MacOSX", "Alpine"] register: git_install - name: set git global user.email if not already set diff --git a/test/integration/targets/ansible-galaxy/setup.yml b/test/integration/targets/ansible-galaxy/setup.yml index a82d02aed2d..ebd5a1c08be 100644 --- a/test/integration/targets/ansible-galaxy/setup.yml +++ b/test/integration/targets/ansible-galaxy/setup.yml @@ -3,7 +3,7 @@ - name: install git package: name: git - when: ansible_distribution != "MacOSX" + when: ansible_distribution not in ["MacOSX", "Alpine"] register: git_install - name: save install result copy: diff --git a/test/integration/targets/connection_ssh/runme.sh b/test/integration/targets/connection_ssh/runme.sh index e7b2b21f0b0..32dbdd937b6 100755 --- a/test/integration/targets/connection_ssh/runme.sh +++ b/test/integration/targets/connection_ssh/runme.sh @@ -22,12 +22,14 @@ if command -v sshpass > /dev/null; then -e ansible_sshpass_prompt=notThis: \ -e ansible_password=foo \ -e ansible_user=definitelynotroot \ - -i test_connection.inventory \ + -i test_connection.inventory \ ssh-pipelining ret=$? - if [[ $ret -ne 124 ]]; then + # 124 is EXIT_TIMEDOUT from gnu coreutils + # 143 is 128+SIGTERM(15) from BusyBox + if [[ $ret -ne 124 && $ret -ne 143 ]]; then echo "Expected to time out and we did not. Exiting with failure." - exit 1 + exit 1 fi else ansible -m ping \ @@ -35,7 +37,7 @@ if command -v sshpass > /dev/null; then -e ansible_sshpass_prompt=notThis: \ -e ansible_password=foo \ -e ansible_user=definitelynotroot \ - -i test_connection.inventory \ + -i test_connection.inventory \ ssh-pipelining | grep 'customized password prompts' ret=$? [[ $ret -eq 0 ]] || exit $ret diff --git a/test/integration/targets/cron/tasks/main.yml b/test/integration/targets/cron/tasks/main.yml index 950d52dc4fc..38898dc4961 100644 --- a/test/integration/targets/cron/tasks/main.yml +++ b/test/integration/targets/cron/tasks/main.yml @@ -100,7 +100,9 @@ - assert: that: remove_cron_file is not changed +# BusyBox does not have /etc/cron.d - name: Removing a cron file when the name is specified is allowed (#57471) + when: ansible_distribution != 'Alpine' block: - name: Cron file creation cron: @@ -124,6 +126,7 @@ that: not cron_file_stats.stat.exists - name: Allow non-ascii chars in job (#69492) + when: ansible_distribution != 'Alpine' block: - name: Cron file creation cron: @@ -155,6 +158,7 @@ that: not cron_file_stats.stat.exists - name: Allow non-ascii chars in cron_file (#69492) + when: ansible_distribution != 'Alpine' block: - name: Cron file creation with non-ascii filename (これは日本語です; This is Japanese) cron: diff --git a/test/integration/targets/getent/tasks/main.yml b/test/integration/targets/getent/tasks/main.yml index 825ad5ea31a..bd17bd62587 100644 --- a/test/integration/targets/getent/tasks/main.yml +++ b/test/integration/targets/getent/tasks/main.yml @@ -29,13 +29,13 @@ key: root service: files register: getent_test0 - when: ansible_system != 'FreeBSD' + when: ansible_system != 'FreeBSD' and ansible_distribution != 'Alpine' - name: run getent w/o specified service (FreeBSD) getent: database: passwd key: root register: getent_test0 - when: ansible_system == 'FreeBSD' + when: ansible_system == 'FreeBSD' or ansible_distribution == 'Alpine' - debug: var=getent_test0 - name: validate results assert: diff --git a/test/integration/targets/git/tasks/setup.yml b/test/integration/targets/git/tasks/setup.yml index 16c56904aba..3158bf62d13 100644 --- a/test/integration/targets/git/tasks/setup.yml +++ b/test/integration/targets/git/tasks/setup.yml @@ -11,7 +11,7 @@ - name: SETUP | install git package: name: '{{ item }}' - when: ansible_distribution != "MacOSX" + when: ansible_distribution not in ["MacOSX", "Alpine"] notify: - cleanup with_items: "{{ git_required_packages[ansible_os_family | default('default') ] | default(git_required_packages.default) }}" diff --git a/test/integration/targets/group/tasks/tests.yml b/test/integration/targets/group/tasks/tests.yml index e35b23c9162..0822682a2ff 100644 --- a/test/integration/targets/group/tasks/tests.yml +++ b/test/integration/targets/group/tasks/tests.yml @@ -198,7 +198,13 @@ args: name: libuser state: present - when: ansible_facts.system in ['Linux'] + when: ansible_facts.system in ['Linux'] and ansible_distribution != 'Alpine' + tags: + - user_test_local_mode + +- name: Ensure lgroupadd is present - Alpine + command: apk add -U libuser --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing + when: ansible_distribution == 'Alpine' tags: - user_test_local_mode diff --git a/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml b/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml index 607318bbd59..0bc4c382b69 100644 --- a/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml +++ b/test/integration/targets/handler_race/roles/random_sleep/tasks/main.yml @@ -2,7 +2,7 @@ # tasks file for random_sleep - name: Generate sleep time set_fact: - sleep_time: "{{ 60 | random }}" + sleep_time: "{{ 30 | random }}" - name: Do random sleep shell: sleep "{{ sleep_time }}" diff --git a/test/integration/targets/include_import/runme.sh b/test/integration/targets/include_import/runme.sh index 6e26226facc..8b80dc54dbd 100755 --- a/test/integration/targets/include_import/runme.sh +++ b/test/integration/targets/include_import/runme.sh @@ -5,7 +5,7 @@ set -eux export ANSIBLE_ROLES_PATH=./roles function gen_task_files() { - for i in $(seq -f '%03g' 1 39); do + for i in $(printf "%03d " {1..39}); do echo -e "- name: Hello Message\n debug:\n msg: Task file ${i}" > "tasks/hello/tasks-file-${i}.yml" done } diff --git a/test/integration/targets/loops/tasks/main.yml b/test/integration/targets/loops/tasks/main.yml index 5575dd36497..a44abcd07ff 100644 --- a/test/integration/targets/loops/tasks/main.yml +++ b/test/integration/targets/loops/tasks/main.yml @@ -27,20 +27,27 @@ block: - name: Measure time before loop with .5s pause set_fact: - times: "{{times|default([]) + [ lookup('pipe','date +%s.%3N') ]}}" + times: "{{times|default([]) + [ now(fmt='%s.%f') ]}}" with_sequence: count=3 loop_control: pause: 0.6 - - name: ensure lag, since there is 3 rounds, and 0.5 seconds between, it should last 1.2 seconds, but allowing leeway due to CI lag - assert: - that: - - tdiff|float >= 1.2 - - tdiff|int < 3 - vars: + - name: Debug times var + debug: + var: times + + - vars: tdiff: '{{ times[2]|float - times[0]|float }}' - when: - - ansible_facts['distribution'] not in ("MacOSX", "FreeBSD") + block: + - name: Debug tdiff used in next task + debug: + msg: 'tdiff={{ tdiff }}' + + - name: ensure lag, since there is 3 rounds, and 0.5 seconds between, it should last 1.2 seconds, but allowing leeway due to CI lag + assert: + that: + - tdiff|float >= 1.2 + - tdiff|int < 3 # # Tests of loop syntax with args diff --git a/test/integration/targets/pip/tasks/main.yml b/test/integration/targets/pip/tasks/main.yml index 20e84d79438..89955e5ad90 100644 --- a/test/integration/targets/pip/tasks/main.yml +++ b/test/integration/targets/pip/tasks/main.yml @@ -15,7 +15,7 @@ package: name: git state: present - when: ansible_distribution != "MacOSX" + when: ansible_distribution not in ["MacOSX", "Alpine"] register: git_install - include_tasks: pip.yml diff --git a/test/integration/targets/prepare_http_tests/tasks/default.yml b/test/integration/targets/prepare_http_tests/tasks/default.yml index 5f098e72063..6a1c8d2fe94 100644 --- a/test/integration/targets/prepare_http_tests/tasks/default.yml +++ b/test/integration/targets/prepare_http_tests/tasks/default.yml @@ -22,19 +22,19 @@ dest: "/etc/pki/trust/anchors/ansible.pem" when: ansible_os_family == 'Suse' -- name: Debian - Retrieve test cacert +- name: Debian/Alpine - Retrieve test cacert get_url: url: "http://ansible.http.tests/cacert.pem" dest: "/usr/local/share/ca-certificates/ansible.crt" - when: ansible_os_family == 'Debian' + when: ansible_os_family in ['Debian', 'Alpine'] - name: Redhat - Update ca trust command: update-ca-trust extract when: ansible_os_family == 'RedHat' -- name: Debian/Suse - Update ca certificates +- name: Debian/Alpine/Suse - Update ca certificates command: update-ca-certificates - when: ansible_os_family == 'Debian' or ansible_os_family == 'Suse' + when: ansible_os_family in ['Debian', 'Alpine', 'Suse'] - name: FreeBSD - Retrieve test cacert get_url: diff --git a/test/integration/targets/pull/setup.yml b/test/integration/targets/pull/setup.yml index a82d02aed2d..ebd5a1c08be 100644 --- a/test/integration/targets/pull/setup.yml +++ b/test/integration/targets/pull/setup.yml @@ -3,7 +3,7 @@ - name: install git package: name: git - when: ansible_distribution != "MacOSX" + when: ansible_distribution not in ["MacOSX", "Alpine"] register: git_install - name: save install result copy: diff --git a/test/integration/targets/service/tasks/main.yml b/test/integration/targets/service/tasks/main.yml index 69a9ef205e2..4fc2ddfe32f 100644 --- a/test/integration/targets/service/tasks/main.yml +++ b/test/integration/targets/service/tasks/main.yml @@ -1,3 +1,7 @@ +- name: skip unsupported distros + meta: end_host + when: ansible_distribution in ['Alpine'] + - name: install the test daemon script copy: src: ansible_test_service.py diff --git a/test/integration/targets/service_facts/tasks/main.yml b/test/integration/targets/service_facts/tasks/main.yml index 5a08fad3002..d2d6528bce2 100644 --- a/test/integration/targets/service_facts/tasks/main.yml +++ b/test/integration/targets/service_facts/tasks/main.yml @@ -3,6 +3,10 @@ # Copyright: (c) 2020, Abhijeet Kasurde # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +- name: skip broken distros + meta: end_host + when: ansible_distribution == 'Alpine' + - name: Gather service facts service_facts: diff --git a/test/integration/targets/setup_cron/tasks/main.yml b/test/integration/targets/setup_cron/tasks/main.yml index 93dcefa56e3..c5a988e0a56 100644 --- a/test/integration/targets/setup_cron/tasks/main.yml +++ b/test/integration/targets/setup_cron/tasks/main.yml @@ -19,17 +19,23 @@ - when: faketime_pkg | default(false, true) block: - - name: install cron and faketime packages + - name: install faketime packages package: name: '{{ faketime_pkg }}' register: faketime_package_installed until: faketime_package_installed is success + when: ansible_distribution != 'Alpine' + + - name: install faketime packages - Alpine + command: apk add -U {{ faketime_pkg }} --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing + when: ansible_distribution == 'Alpine' - name: Find libfaketime path shell: '{{ list_pkg_files }} {{ faketime_pkg }} | grep -F libfaketime.so.1' args: warn: false register: libfaketime_path + when: list_pkg_files is defined - when: ansible_service_mgr == 'systemd' block: @@ -68,3 +74,11 @@ daemon-reload: "{{ (ansible_service_mgr == 'systemd') | ternary(true, omit) }}" name: '{{ cron_service }}' state: restarted + when: ansible_distribution != 'Alpine' + +- name: enable cron service - Alpine + command: nohup crond + environment: + FAKETIME: "+0y x10" + LD_PRELOAD: "/usr/lib/faketime/libfaketime.so.1" + when: ansible_distribution == 'Alpine' diff --git a/test/integration/targets/setup_cron/vars/alpine.yml b/test/integration/targets/setup_cron/vars/alpine.yml new file mode 100644 index 00000000000..37e6fc3714c --- /dev/null +++ b/test/integration/targets/setup_cron/vars/alpine.yml @@ -0,0 +1 @@ +faketime_pkg: libfaketime diff --git a/test/integration/targets/setup_paramiko/install-Alpine-3-python-3.yml b/test/integration/targets/setup_paramiko/install-Alpine-3-python-3.yml new file mode 100644 index 00000000000..a09f5b5500d --- /dev/null +++ b/test/integration/targets/setup_paramiko/install-Alpine-3-python-3.yml @@ -0,0 +1,3 @@ +- name: Install Paramiko for Python 3 on Alpine + pip: # no apk package manager in core, just use pip + name: paramiko diff --git a/test/integration/targets/setup_paramiko/uninstall-Alpine-3-python-3.yml b/test/integration/targets/setup_paramiko/uninstall-Alpine-3-python-3.yml new file mode 100644 index 00000000000..e9dcc62c688 --- /dev/null +++ b/test/integration/targets/setup_paramiko/uninstall-Alpine-3-python-3.yml @@ -0,0 +1,4 @@ +- name: Uninstall Paramiko for Python 3 on Alpine + pip: + name: paramiko + state: absent diff --git a/test/integration/targets/subversion/roles/subversion/tasks/setup.yml b/test/integration/targets/subversion/roles/subversion/tasks/setup.yml index 5c9c5cb5410..f654efa66c5 100644 --- a/test/integration/targets/subversion/roles/subversion/tasks/setup.yml +++ b/test/integration/targets/subversion/roles/subversion/tasks/setup.yml @@ -11,6 +11,11 @@ package: name: '{{ subversion_packages }}' state: present + when: ansible_distribution != 'Alpine' + +- name: install SVN pre-reqs - Alpine + command: 'apk add -U {{ subversion_packages|join(" ") }}' + when: ansible_distribution == 'Alpine' - name: upgrade SVN pre-reqs package: @@ -55,9 +60,9 @@ - name: start test Apache SVN site - non Red Hat command: apachectl -k start -f {{ subversion_server_dir }}/subversion.conf - when: not ansible_os_family == 'RedHat' + when: ansible_os_family not in ['RedHat', 'Alpine'] # On Red Hat based OS', we can't use apachectl to start up own instance, just use the raw httpd - name: start test Apache SVN site - Red Hat command: httpd -k start -f {{ subversion_server_dir }}/subversion.conf - when: ansible_os_family == 'RedHat' + when: ansible_os_family in ['RedHat', 'Alpine'] diff --git a/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2 b/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2 index 07e7083a6bc..86f40707419 100644 --- a/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2 +++ b/test/integration/targets/subversion/roles/subversion/templates/subversion.conf.j2 @@ -39,6 +39,10 @@ LoadModule authz_svn_module libexec/apache24/mod_authz_svn.so Include /etc/apache2/httpd.conf LoadModule dav_module /usr/lib64/apache2/mod_dav.so LoadModule dav_svn_module /usr/lib64/apache2/mod_dav_svn.so +{% elif ansible_os_family == "Alpine" %} +Include /etc/apache2/httpd.conf +LoadModule dav_module /usr/lib/apache2/mod_dav.so +LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so {% elif ansible_os_family == "RedHat" %} Include /etc/httpd/conf/httpd.conf {% endif %} diff --git a/test/integration/targets/subversion/vars/Alpine.yml b/test/integration/targets/subversion/vars/Alpine.yml new file mode 100644 index 00000000000..ce071fdd1c5 --- /dev/null +++ b/test/integration/targets/subversion/vars/Alpine.yml @@ -0,0 +1,7 @@ +--- +subversion_packages: +- subversion +- mod_dav_svn +- apache2-webdav +apache_user: apache +apache_group: apache diff --git a/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml b/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml index 6181e3bd628..e4c2bec5615 100644 --- a/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml +++ b/test/integration/targets/unarchive/tasks/test_unprivileged_user.yml @@ -1,7 +1,6 @@ - name: Create unarchivetest1 user user: name: unarchivetest1 - uid: 1002610001 group: "{{ group_table[ansible_facts['distribution']] | default(omit) }}" register: user vars: diff --git a/test/integration/targets/user/tasks/main.yml b/test/integration/targets/user/tasks/main.yml index 534dd92547e..5b83166e698 100644 --- a/test/integration/targets/user/tasks/main.yml +++ b/test/integration/targets/user/tasks/main.yml @@ -17,6 +17,10 @@ # along with Ansible. If not, see . # +- name: skip broken distros + meta: end_host + when: ansible_distribution == 'Alpine' + ## user add - name: remove the test user diff --git a/test/lib/ansible_test/_data/completion/docker.txt b/test/lib/ansible_test/_data/completion/docker.txt index aad67ab71a0..10efa100354 100644 --- a/test/lib/ansible_test/_data/completion/docker.txt +++ b/test/lib/ansible_test/_data/completion/docker.txt @@ -1,5 +1,6 @@ default name=quay.io/ansible/default-test-container:2.6.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=collection default name=quay.io/ansible/ansible-base-test-container:1.5.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=ansible-base +alpine3 name=quay.io/ansible/alpine3-test-container:1.19.0 python=3.8 centos6 name=quay.io/ansible/centos6-test-container:1.17.0 python=2.6 seccomp=unconfined centos7 name=quay.io/ansible/centos7-test-container:1.17.0 python=2.7 seccomp=unconfined centos8 name=quay.io/ansible/centos8-test-container:1.17.0 python=3.6 seccomp=unconfined