Skip to content

Commit 0e9261a

Browse files
committed
Add role for running integration tests with podman or docker
1 parent 48f7d47 commit 0e9261a

4 files changed

Lines changed: 37 additions & 11 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- name: Login to quay.io
2+
community.docker.docker_login:
3+
registry_url: quay.io
4+
username: "{{ quay.username }}"
5+
password: "{{ quay.password }}"
6+
7+
- name: Run tests
8+
ansible.builtin.shell:
9+
cmd: |
10+
cd "${HOME}/fact"
11+
source ".venv/bin/activate"
12+
make integration-tests
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- name: Run integration tests with docker
2+
ansible.builtin.include_tasks: docker.yml
3+
when: runtime_command == 'docker'
4+
5+
- name: Run integration tests with podman
6+
ansible.builtin.include_tasks: podman.yml
7+
when: runtime_command == 'podman'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- name: Login to quay.io
2+
become: true
3+
containers.podman.podman_login:
4+
registry: quay.io
5+
username: "{{ quay.username }}"
6+
password: "{{ quay.password }}"
7+
8+
- name: Run tests
9+
become: true
10+
environment:
11+
DOCKER: podman
12+
ansible.builtin.shell:
13+
cmd: |
14+
cd "${HOME}/fact"
15+
source ".venv/bin/activate"
16+
make integration-tests

ansible/run-tests.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
ansible.builtin.include_role:
1010
name: install-test-dependencies
1111

12-
- name: Login to quay.io
13-
community.docker.docker_login:
14-
registry_url: quay.io
15-
username: "{{ quay.username }}"
16-
password: "{{ quay.password }}"
17-
1812
- name: Clone the repo
1913
ansible.builtin.git:
2014
repo: https://github.com/stackrox/fact
@@ -31,11 +25,8 @@
3125

3226
- block:
3327
- name: Run tests
34-
ansible.builtin.shell:
35-
cmd: |
36-
cd "${HOME}/fact"
37-
source ".venv/bin/activate"
38-
make integration-tests
28+
ansible.builtin.include_role:
29+
name: integration-tests
3930
always:
4031
- name: Retrieve results
4132
ansible.builtin.fetch:

0 commit comments

Comments
 (0)