Skip to content

Commit

Permalink
downstream-ee/aws: call runme.sh from within the container (#1510)
Browse files Browse the repository at this point in the history
downstream-ee/aws: call runme.sh from within the container

Depends-On: ansible-collections/amazon.aws#797
  • Loading branch information
goneri authored Apr 29, 2022
1 parent 9156c8b commit 1fceb64
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
16 changes: 16 additions & 0 deletions playbooks/downstream-ee-testing/aws/pre.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
- hosts: controller
gather_facts: false
vars:
target_name: "{{ downstream_ee_testing_targets[0] }}"

tasks:
- name: Fetch the aws_session file from the controller
fetch:
Expand All @@ -13,3 +16,16 @@
template:
src: "site.yaml.j2"
dest: "{{ zuul.projects[ansible_collections_repo].src_dir }}/tests/integration/targets/site.yaml"
- ini_file:
path: "~/{{ zuul.projects[ansible_collections_repo].src_dir }}/tests/integration/targets/{{ target_name }}/inventory"
section: "all:vars"
option: "{{ item.key }}"
value: "{{ item.value }}"
with_dict:
aws_access_key: "{{ aws_session.aws.credentials.access_key }}"
aws_secret_key: "{{ aws_session.aws.credentials.secret_key }}"
security_token: "{{ aws_session.aws.credentials.session_token }}"
aws_region: us-east-1
resource_prefix: "{{ zuul.build }}"
tiny_prefix: "{{ zuul.build[0:6] }}"
aws_cleanup: true
26 changes: 23 additions & 3 deletions playbooks/downstream-ee-testing/aws/run.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
---
- hosts: controller
gather_facts: false
vars:
target_name: "{{ downstream_ee_testing_targets[0] }}"
tasks:
- command: "ansible-navigator run --eei brew.registry.redhat.io/{{ downstream_ee_image }} site.yaml --mode=stdout --pull-policy=never"
args:
chdir: "~/{{ zuul.projects[ansible_collections_repo].src_dir }}/tests/integration/targets"
- name: Test if runne.sh exists
stat:
path: "~/{{ zuul.projects[ansible_collections_repo].src_dir }}/tests/integration/targets/{{ target_name }}/runme.sh"
register: runme_sh_stat

- when: runme_sh_stat.stat.exists
block:
- name: Run the target with ./runme.sh
command: "ansible-navigator exec --eei brew.registry.redhat.io/{{ downstream_ee_image }} --mode=stdout --pull-policy=never -- bash -c 'ls && cd {{ target_name }} && ./runme.sh' && echo runme.sh_success "
args:
chdir: "~/{{ zuul.projects[ansible_collections_repo].src_dir }}/tests/integration/targets"
register: runme_output
# See: https://github.com/ansible/ansible-navigator/issues/1215
- name: Evaluate if the runme.sh was a success
assert:
that:
- '"runme.sh_success" in runme_output.stdout'

- when: not runme_sh_stat.stat.exists
name: Run the target with site.yaml
command: "ansible-navigator run --eei brew.registry.redhat.io/{{ downstream_ee_image }} site.yaml --mode=stdout --pull-policy=never"
1 change: 1 addition & 0 deletions playbooks/downstream-ee-testing/aws/site.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
aws_region: us-east-1
resource_prefix: "{{ zuul.build }}"
downstream_ee_testing_targets: "{{ downstream_ee_testing_targets }}"
aws_cleanup: true
{% raw %}
tasks:
- when: not downstream_ee_testing_targets|length
Expand Down
7 changes: 4 additions & 3 deletions playbooks/downstream-ee-testing/pre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
- hosts: controller
gather_facts: false
tasks:
- name: Install pip
- name: Install python3.8
package:
name: python3-pip
name: python38
state: present
become: true
- name: Pull the image
command: "podman pull brew.registry.redhat.io/{{ downstream_ee_image }}"
- command: pip3 install --user ansible-navigator
- name: Install Ansible Navigator
command: "pip3.8 install --user ~/{{ zuul.projects['github.com/ansible/ansible-navigator'].src_dir }}"
- name: Copy the include_role.yaml file
copy:
src: files/include_role.yaml
Expand Down
1 change: 1 addition & 0 deletions zuul.d/downstream-ee-amazon-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- name: github.com/ansible/ansible
override-checkout: milestone
- name: github.com/ansible-collections/amazon.aws
- name: github.com/ansible/ansible-navigator
timeout: 3600
nodeset: rhel8
vars:
Expand Down
1 change: 1 addition & 0 deletions zuul.d/downstream-ee-vmware-vmware_rest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- name: github.com/ansible/ansible
override-checkout: milestone
- name: github.com/ansible-collections/vmware.vmware_rest
- name: github.com/ansible/ansible-navigator
timeout: 3600
nodeset: vmware-vcsa_1esxi-7.0.3-rhel
vars:
Expand Down

0 comments on commit 1fceb64

Please sign in to comment.