Skip to content

Commit a909b5d

Browse files
committed
Add hooks before running kuttl from operator target
Add a hook to run before calling the kuttl tests in the job variant that runs them from the operator target (wihtout using install_yamls). This change also modifies the run playbook for the kuttl job, to make sure it runs from the controller.
1 parent 01d5b02 commit a909b5d

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

ci/playbooks/kuttl/deploy-deps.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@
9999
name: 'install_yamls_makes'
100100
tasks_from: 'make_openstack_init'
101101

102+
- name: Run hooks after installing openstack
103+
vars:
104+
step: post_install_operators_kuttl_from_operator
105+
ansible.builtin.include_role:
106+
name: run_hook
107+
102108
- name: install kuttl test_suite dependencies
103109
vars:
104110
project_name: "github.com/openstack-k8s-operators/{{ operator_name }}"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- name: "Run ci/playbooks/kuttl/run-kuttl-from-operator-targets.yaml"
2+
hosts: controller
3+
gather_facts: true
4+
tasks:
5+
- name: Run kuttl tests from operator playbook
6+
ansible.builtin.command:
7+
chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework"
8+
cmd: >-
9+
ansible-playbook ci/playbooks/kuttl/run-kuttl-from-operator-targets.yaml
10+
-i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
11+
-e @scenarios/centos-9/base.yml
12+
-e @scenarios/centos-9/ci.yml
13+
{%- if cifmw_extras is defined %}
14+
{%- for extra_vars in cifmw_extras %}
15+
-e "{{ extra_vars }}"
16+
{%- endfor %}
17+
{%- endif %}
18+
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml"

ci/playbooks/kuttl/run-kuttl-from-operator-targets.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- hosts: controller
1+
- hosts: "{{ cifmw_target_host | default('localhost') }}"
22
vars:
33
project_name: "github.com/openstack-k8s-operators/{{ operator_name }}"
44
operator_basedir: >-
@@ -7,6 +7,12 @@
77
}}
88
kuttl_log_dir: "{{ local_log_dir | default(ansible_user_dir + '/zuul-output/logs/controller') }}"
99
tasks:
10+
- name: Run hooks before running kuttl tests
11+
vars:
12+
step: pre_kuttl_from_operator
13+
ansible.builtin.include_role:
14+
name: run_hook
15+
1016
- name: run kuttl test suite from operator Makefile
1117
environment:
1218
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"

docs/source/usage/01_usage.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ If you want to list multiple hooks, you have to use the following parameter name
123123
- `post_admin_setup`: before admin setup
124124
- `pre_tests`: before running tests
125125
- `post_tests`: after running tests
126+
- `post_install_operators_kuttl_from_operator`: after installing openstack operator for kuttl test when calling them from the operator's make target
127+
- `pre_kuttl_from_operator`: before running kuttl test when calling them from
128+
the operator's make target
126129

127130
Since we're already providing hooks as list, you may want to just add one or two hooks
128131
using your own environment file. Parameter structure is simple: `PREFIX_HOOKNAME: {hook struct}`

zuul.d/kuttl_multinode.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@
8282
pre-run:
8383
- ci/playbooks/kuttl/kuttl-from-operator-deps.yaml
8484
run:
85-
- ci/playbooks/kuttl/run-kuttl-from-operator-targets.yaml
85+
- ci/playbooks/kuttl/kuttl-from-operator-run.yaml
8686
vars:
8787
cifmw_target_host: controller

0 commit comments

Comments
 (0)