-
Notifications
You must be signed in to change notification settings - Fork 0
/
local-test-operator-bundle.yml
97 lines (82 loc) · 2.73 KB
/
local-test-operator-bundle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
- name: Test the operator bundle image
hosts: all
become: false
gather_facts: false
vars:
run_upstream: false
run_prereqs: true
run_cleanup: true
run_lint: true
run_catalog_init: true
work_dir: "/tmp/operator-test"
testing_bin_path: "{{ work_dir }}/bin"
current_channel: >
'' # Added to avoid a potential
bug with undefined variables
olm_ver: 0.14.1
tasks:
- set_fact:
operator_work_dir: "{{ work_dir }}/operator-files"
operator_bundle_dir: "{{ work_dir }}/operator-bundle"
jq_bin_path: "{{ testing_bin_path }}/jq"
yq_bin_path: "{{ testing_bin_path }}/yq"
umoci_bin_path: "{{ testing_bin_path }}/umoci"
opm_bin_path: "{{ testing_bin_path }}/opm"
operator_sdk_bin_path: "{{ testing_bin_path }}/operator-sdk"
oc_bin_path: >
'{{ ''kubectl'' if run_upstream
else "{{ testing_bin_path }}/oc" }}'
- name: "Install operator testing prerequisites"
include_role:
name: install_operator_prereqs
when: run_prereqs|bool
- name: "Build bundle image"
include_role:
name: build_image_bundle
when: run_upstream|bool
- name: >
"Extract the operator bundle image
into files needed to run the tests"
include_role:
name: extract_operator_bundle
- name: "Parse the operator bundle image, manifest and metadata"
include_role:
name: parse_operator_bundle
- name: "Validate the operator manifest and metadata using operator-sdk"
include_role:
name: validate_operator_bundle
- name: "Build the operator bundle index"
include_role:
name: build_index_bundle
when: run_upstream|bool
- name: "OLM"
block:
- name: "Check if OLM is needed"
shell: "{{ oc_bin_path }} api-resources | grep -o operatorgroup"
register: olm_needed
ignore_errors: true
- name: "Install OLM"
block:
- name: "Installing OLM"
shell: >
"{{ operator_sdk_bin_path }} olm
install --version {{ olm_ver }}"
- name: "Delete catalogsource"
shell: >
"{{ oc_bin_path }} delete catalogsource
operatorhubio-catalog -n olm"
ignore_errors: true
when:
- olm_needed.stdout != "operatorgroup"
when: run_upstream|bool
- name: "Test operator on OLM"
include_role:
name: deploy_olm_operator_upstream_bundle
when: run_upstream|bool
- name: "Cleanup created resources on the KIND cluster"
include_role:
name: cleanup_operator_resources
when:
- run_cleanup|bool
- run_upstream|bool