-
Notifications
You must be signed in to change notification settings - Fork 40
/
operator-scorecard-test.yml
57 lines (53 loc) · 1.97 KB
/
operator-scorecard-test.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
---
- name: >
Run scorecard tests on the OLM
deployed operator as part of
the operator testing pipeline
hosts: all
become: false
gather_facts: false
vars:
run_upstream: false
openshift_namespace: "test-operator"
operator_work_dir: "/home/jenkins/agent/test-operator"
current_csv_dir: "/home/jenkins/agent/test-operator"
scorecard_cr_dir: "/home/jenkins/agent/scorecard-cr-files"
work_dir: "{{ lookup('env', 'WORKSPACE') }}"
operator_sdk_bin_path: "/usr/local/bin/operator-sdk"
jq_bin_path: "/usr/bin/jq"
yq_bin_path: "/usr/local/bin/yq"
oc_bin_path: "{{ 'kubectl' if run_upstream else 'oc' }}"
check_scorecard_results: false
tasks:
- name: "Operator scorecard tests"
block:
- name: "Find all extracted CRs from alm-examples"
shell: "find \"{{ scorecard_cr_dir }}\" -name \"*.cr.yaml\" -print"
register: scorecard_cr_files_result
- name: "Run scorecard tests on the deployed operator"
include_role:
name: operator_scorecard_tests
with_items: "{{ scorecard_cr_files_result.stdout_lines }}"
loop_control:
loop_var: cr_path
always:
- name: >
"Get the pod container logs of the
operator after running scorecard tests"
shell: >
"{{ oc_bin_path }} get --output=name pods
| grep {{ operator_pod_name }} |
xargs -I{} {{ oc_bin_path }} logs {} -c
{{ operator_container_name }}"
register: operator_container_result
ignore_errors: true
environment:
KUBECONFIG: "{{ kubeconfig_path }}"
no_log: true
- name: "Output the operator container log to a debug file"
copy:
content: "{{ operator_container_result.stdout }}"
dest: "{{ work_dir }}/scorecard-operator-container-debug.txt"
mode: 0644
when:
- operator_container_result.stdout != ""