Extend docker_compose tests, add Alpine to CI (#304)

* Add test where project is started with project_src only (#303).

* Work around bug in docker_compose.

* Add Alpine in CI.
This commit is contained in:
Felix Fontein 2022-03-14 10:34:08 +01:00 committed by GitHub
parent 5f9afb8c12
commit 48391d6755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 0 deletions

View File

@ -129,6 +129,8 @@ stages:
test: ubuntu1804
- name: Ubuntu 20.04
test: ubuntu2004
- name: Alpine 3
test: alpine3
groups:
- 4
- 5
@ -165,6 +167,8 @@ stages:
test: fedora33
- name: Ubuntu 18.04
test: ubuntu1804
- name: Alpine 3
test: alpine3
groups:
- 4
- 5

View File

@ -177,3 +177,63 @@
- "{{ env_file }}"
- "{{ new_env_file }}"
when: docker_compose_version is version('1.25.0', '>=')
####################################################################
## Project_src #####################################################
####################################################################
- name: Define service and files
set_fact:
compose_file: "{{ remote_tmp_dir }}/docker-compose.yml"
env_sleep_cmd: sleep 10m
new_env_sleep_cmd: sleep 20m
test_service: |
version: '3'
services:
{{ cname_1 }}:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c 10m'
stop_grace_period: 1s
- name: Generate compose file
ansible.builtin.copy:
content: "{{ test_service }}"
dest: "{{ compose_file }}"
- name: Start with project_src
docker_compose:
project_src: "{{ remote_tmp_dir }}"
register: project_src_1
- name: Start with project_src (idempotent)
docker_compose:
project_src: "{{ remote_tmp_dir }}"
register: project_src_2
- name: Stop with project_src
docker_compose:
project_src: "{{ remote_tmp_dir }}"
state: absent
register: project_src_3
- name: Stop with project_src (idempotent)
docker_compose:
project_src: "{{ remote_tmp_dir }}"
state: absent
register: project_src_4
- name: Remove files
ansible.builtin.file:
path: "{{ file_path }}"
state: absent
loop_control:
loop_var: file_path
loop:
- "{{ compose_file }}"
- assert:
that:
- project_src_1 is changed
# - project_src_2 is not changed -- for some reason, this currently fails!
- project_src_3 is changed
- project_src_4 is not changed

View File

@ -0,0 +1,6 @@
---
- name: Install docker
apk:
name: docker
update_cache: yes
notify: cleanup docker

View File

@ -0,0 +1,5 @@
---
- name: Install docker-compose as system package
apk:
name: "{{ docker_compose_packages }}"
state: present

View File

@ -0,0 +1,3 @@
---
cryptography_package_name: py-cryptography
cryptography_package_name_python3: py3-cryptography