tests: Run containers on macOS with podman, instead of Docker

This commit is contained in:
Alex Willmer 2022-04-22 18:08:54 +01:00
parent 96e20a09d6
commit db9e52ce8e
1 changed files with 26 additions and 25 deletions

View File

@ -13,36 +13,33 @@
- name: set up test container and run tests inside it - name: set up test container and run tests inside it
block: block:
- name: install deps - name: install deps
block: homebrew:
- name: install docker name:
shell: | - podman
# NOTE: for tracking purposes: https://github.com/docker/for-mac/issues/2359 state: present
# using docker for mac CI workaround: https://github.com/drud/ddev/pull/1748/files#diff-19288f650af2dabdf1dcc5b354d1f245
DOCKER_URL=https://download.docker.com/mac/stable/31259/Docker.dmg && - name: start machine
curl -O -sSL $DOCKER_URL && command:
open -W Docker.dmg && cp -r /Volumes/Docker/Docker.app /Applications cmd: "{{ item.cmd }}"
sudo /Applications/Docker.app/Contents/MacOS/Docker --quit-after-install --unattended && loop:
ln -s /Applications/Docker.app/Contents/Resources/bin/docker /usr/local/bin/docker && - cmd: podman machine init
nohup /Applications/Docker.app/Contents/MacOS/Docker --unattended & - cmd: podman machine start
# wait 2 min for docker to come up - cmd: podman info
counter=0 && timeout: 300
while ! /usr/local/bin/docker ps 2>/dev/null ; do register: podman_machine
if [ $counter -lt 24 ]; then
let counter=counter+1 - debug:
else var: podman_machine
exit 1
fi
sleep 5
done
# python bindings (docker_container) aren't working on this host, so gonna shell out # python bindings (docker_container) aren't working on this host, so gonna shell out
- name: create docker container - name: create container
shell: /usr/local/bin/docker run --name testMitogen -d --rm centos:8 bash -c "sleep infinity & wait" command:
cmd: podman run --name testMitogen -d --rm centos:8 bash -c "sleep infinity & wait"
- name: add container to inventory - name: add container to inventory
add_host: add_host:
name: testMitogen name: testMitogen
ansible_connection: docker ansible_connection: podman
ansible_user: root ansible_user: root
changed_when: false changed_when: false
environment: environment:
@ -82,6 +79,10 @@
PATH: /usr/local/bin/:{{ ansible_env.PATH }} PATH: /usr/local/bin/:{{ ansible_env.PATH }}
- name: remove test container - name: remove test container
shell: /usr/local/bin/docker stop testMitogen command:
cmd: "{{ item.cmd }}"
loop:
- cmd: podman stop testMitogen
- cmd: podman machine stop
tags: tags:
- issue_655 - issue_655