-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathmain.yml
More file actions
310 lines (281 loc) · 9.02 KB
/
Copy pathmain.yml
File metadata and controls
310 lines (281 loc) · 9.02 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
---
- name: "Create directory for the binaries needed for operator testing"
file:
path: "{{ testing_bin_path }}"
state: directory
tags:
- install
- image_build
- reset_tools
- cosmetics_install
- name: "Set basic facts"
set_fact:
operator_sdk_bin_path: "{{ testing_bin_path }}/operator-sdk"
oc_bin_path: "{{ 'kubectl' if run_upstream else testing_bin_path + '/oc' }}"
jq_bin_path: "{{ testing_bin_path }}/jq"
yq_bin_path: "{{ testing_bin_path }}/yq"
go_bin_path: "{{ testing_bin_path }}/go/bin/go"
umoci_bin_path: "{{ testing_bin_path }}/umoci"
offline_cataloger_bin_path: "offline-cataloger"
# Install the oc client to talk to any Openshift cluster
- name: "Download and extract OpenShift client binary 'oc' ({{ oc_version }}) to {{ testing_bin_path }}"
unarchive:
src: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ oc_version }}/openshift-client-linux-{{ oc_version }}.tar.gz"
dest: "{{ testing_bin_path }}"
remote_src: true
register: download_and_unpack_oc
until: download_and_unpack_oc is succeeded
retries: 10
delay: 15
tags:
- install
- image_build
- name: "Download and extract go binary to {{ testing_bin_path }}"
unarchive:
src: "https://dl.google.com/go/go{{ go_version }}.linux-amd64.tar.gz"
dest: "{{ testing_bin_path }}"
remote_src: true
register: download_and_unpack_go
until: download_and_unpack_go is succeeded
retries: 10
delay: 15
tags:
- install
- image_build
- name: "Remove '{{ opm_bin_path }}' binary"
file:
path: "{{ opm_bin_path }}"
state: absent
tags:
- install
- uninstall
- reset_tools
- name: "Install released opm ({{ opm_version }})"
get_url:
url: https://github.com/operator-framework/operator-registry/releases/download/{{ opm_version }}/linux-amd64-opm
dest: "{{ opm_bin_path }}"
mode: "0755"
register: opm_install_result
until: opm_install_result.status_code is undefined or opm_install_result.status_code == 200
retries: 10
delay: 15
failed_when: opm_install_result is failure
when: opm_source != "master"
tags:
- install
- host_build
- reset_tools
- name: "Install released k8s-community-bundle-validator ({{ k8s_community_bundle_validator_version }})"
get_url:
url: https://github.com/k8s-operatorhub/bundle-validator/releases/download/{{ k8s_community_bundle_validator_version }}/linux-amd64-k8s-community-bundle-validator
dest: "{{ k8s_community_bundle_validator_path }}"
mode: "0755"
register: k8s_community_bundle_validator_install_result
until: k8s_community_bundle_validator_install_result.status_code is undefined or k8s_community_bundle_validator_install_result.status_code == 200
retries: 10
delay: 15
failed_when: k8s_community_bundle_validator_install_result is failure
tags:
- install
- host_build
- reset_tools
- name: "Install grpcurl {{ grpcurl_version }}"
unarchive:
src: "https://github.com/fullstorydev/grpcurl/releases/download/v{{ grpcurl_version }}/grpcurl_{{ grpcurl_version }}_linux_x86_64.tar.gz"
dest: "{{ testing_bin_path }}"
remote_src: true
retries: 10
delay: 15
tags:
- install
- host_build
- reset_tools
- name: "Install opm from master"
include_tasks: opm_special.yml
when: opm_source == "master"
tags:
- install
- host_build
- reset_tools
- name: "Remove '{{ jq_bin_path }}' binary"
file:
path: "{{ jq_bin_path }}"
state: absent
tags:
- install
- uninstall
- reset_tools
- cosmetics_install
- name: "Download jq ({{ jq_version }})"
get_url:
url: "https://github.com/stedolan/jq/releases/download/jq-{{ jq_version }}/jq-linux64"
dest: "{{ jq_bin_path }}"
mode: "0755"
register: jq_install_result
until: jq_install_result.status_code is undefined or jq_install_result.status_code == 200
retries: 10
delay: 15
failed_when: jq_install_result is failure
tags:
- install
- image_build
- reset_tools
- cosmetics_install
- name: "Remove '{{ yq_bin_path }}' binary"
file:
path: "{{ yq_bin_path }}"
state: absent
tags:
- install
- uninstall
- reset_tools
- cosmetics_install
- name: "Download yq ({{ yq_version }})"
get_url:
url: "https://github.com/mikefarah/yq/releases/download/{{ yq_version }}/yq_linux_amd64"
dest: "{{ yq_bin_path }}"
mode: "0755"
register: yq_install_result
until: yq_install_result.status_code is undefined or yq_install_result.status_code == 200
retries: 10
delay: 15
failed_when: yq_install_result is failure
tags:
- install
- image_build
- uninstall
- reset_tools
- cosmetics_install
- name: "Create directory '{{ ansible_env.HOME }}'"
file:
path: "{{ testing_bin_path }}"
state: directory
tags:
- install
- reset_tools
- cosmetics_install
- name: "Download dyff"
unarchive:
src: "https://github.com/homeport/dyff/releases/download/v{{ dyff_version }}/dyff_{{ dyff_version }}_linux_amd64.tar.gz"
dest: "{{ testing_bin_path }}"
remote_src: true
register: dyff_install_result
until: dyff_install_result is succeeded
retries: 10
delay: 15
environment:
PATH: "{{ testing_bin_path }}:{{ ansible_env.PATH }}"
tags:
- install
- reset_tools
- cosmetics_install
- name: "Set permissions on dyff"
file:
path: "{{ testing_bin_path }}/dyff"
mode: "0755"
- name: "Install prerequisites specific to legacy operator manifest testing"
block:
- name: "Check if operator-courier is installed"
shell: "operator-courier -v"
register: operator_courier_version_result
failed_when: false
when: not run_upstream|bool
- name: "Install operator-courier ({{ operator_courier_version }}) if not already installed"
shell: "pip3 install --upgrade operator-courier=={{ operator_courier_version }}"
when:
- operator_courier_version_result.rc is defined
- operator_courier_version_result.rc != 0
- not run_upstream|bool
- name: "Check if offline-cataloger is installed"
shell: "offline-cataloger -h"
register: offline_cataloger_help_result
failed_when: false
when: not run_upstream|bool
- name: "Git clone offline-cataloger repo with the offline-cataloger command"
git:
repo: "https://github.com/kevinrizza/offline-cataloger.git"
dest: /tmp/offline-cataloger
version: "master"
force: true
when:
- offline_cataloger_help_result.rc is defined
- offline_cataloger_help_result.rc != 0
- name: "Set offline cataloger bin path"
set_fact:
offline_cataloger_bin_path: "{{ go_bin_path }} run -mod=vendor ./cmd/offline-cataloger/main.go"
when:
- offline_cataloger_help_result.rc is defined
- offline_cataloger_help_result.rc != 0
tags:
- install
- reset_tools
- image_build
- name: "Install prerequisites specific to operator bundle image testing"
block:
- name: "Check if skopeo is installed"
shell: "skopeo -h"
register: skopeo_help_result
failed_when: false
- name: "Install skopeo"
block:
- name: "Generating file for install_skopeo.sh"
template:
src: install_skopeo.sh.j2
dest: "/tmp/install_skopeo.sh"
mode: "0755"
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: "Installing skopeo for ubuntu"
shell: "/tmp/install_skopeo.sh"
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- package:
name: skopeo
state: present
become: true
when:
- skopeo_help_result.rc is defined
- skopeo_help_result.rc != 0
tags:
- host_build
- image_build
- install
- uninstall
- reset_tools
- name: "Remove '{{ umoci_bin_path }}' binary"
file:
path: "{{ umoci_bin_path }}"
state: absent
tags:
- uninstall
- reset_tools
- name: "Handling umoci binary"
block:
- name: "Check if umoci is installed"
shell: "{{ umoci_bin_path }} -h"
register: umoci_help_result
failed_when: false
- name: "Make sure that '{{ testing_bin_path }}' is present"
file:
path: "{{ testing_bin_path }}"
state: directory
- name: "Install umoci ({{ umoci_version }})"
get_url:
url: "https://github.com/opencontainers/umoci/releases/download/{{ umoci_version }}/umoci.amd64"
dest: "{{ umoci_bin_path }}"
mode: "0755"
register: umoci_install_result
until: umoci_install_result.status_code is undefined or umoci_install_result.status_code == 200
retries: 10
delay: 15
failed_when: umoci_install_result is failure
when:
- umoci_help_result.rc is defined
- umoci_help_result.rc != 0
tags:
- install
- uninstall
- reset_tools
tags:
- install
- image_build
- iib
- reset_tools