-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add container state test + CI updates
CI test playbook for checking container states. Add `requirements.yml` for installing Ansible Galaxy. Update `requirements.txt` test with `urllib3. Cleanup GitHub CI files. closes #101 Signed-off-by: Shantanoo 'Shan' Desai <[email protected]>
- Loading branch information
1 parent
febd34d
commit f71e1b7
Showing
4 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ansible | ||
docker | ||
urllib3 < 2.0 # Pin this requirement to combat a current incompatibility with docker and urllib3 | ||
urllib3 | ||
jsonschema | ||
passlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
--- | ||
collections: | ||
- name: community.docker | ||
version: 3.4.8 | ||
- name: ansible.utils | ||
version: 2.10.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
--- | ||
- name: Bring the Compose Application up and check if containers exist and are running | ||
hosts: localhost | ||
gather_facts: false | ||
vars_files: | ||
- "{{ playbook_dir }}/../vars/config.yml" | ||
|
||
tasks: | ||
- name: Container Checks | ||
block: | ||
- name: (Komponist-Docker) Bring the Compose Application up | ||
ansible.builtin.command: | ||
cmd: docker compose --project-directory="{{ playbook_dir }}/../deploy" up --quiet-pull -d | ||
register: compose_up | ||
changed_when: compose_up.rc != 0 | ||
|
||
- name: (Komponist-Docker) Obtain information about containers | ||
community.docker.docker_container_info: | ||
name: "{{ komponist.project_name }}_{{ item }}" | ||
register: containers_info | ||
loop: "{{ komponist.configuration.keys() }}" | ||
|
||
- name: (Komponist-Docker) Check if containers exist | ||
ansible.builtin.assert: | ||
that: item.exists | ||
fail_msg: "FAIL: {{ item.item }} container DOES NOT EXIST." | ||
success_msg: "PASS: {{ item.item }} container EXISTS." | ||
loop: "{{ containers_info.results }}" | ||
loop_control: | ||
label: "{{ item.item }}" | ||
|
||
- name: (Komponist-Docker) Check if containers are running | ||
ansible.builtin.assert: | ||
that: item.container.State.Status == 'running' | ||
fail_msg: "FAIL: {{ item.item }} container NOT RUNNING." | ||
success_msg: "PASS: {{ item.item }} container RUNNING." | ||
loop: "{{ containers_info.results }}" | ||
loop_control: | ||
label: "{{ item.item }}" | ||
|
||
always: | ||
- name: (Komponist-Docker) docker compose down --volumes | ||
ansible.builtin.command: | ||
cmd: docker compose --project-directory="{{ playbook_dir }}/../deploy" down --volumes | ||
register: compose_down | ||
changed_when: compose_down.rc != 0 |