Skip to content

Commit e7f74e7

Browse files
Microzuul CIGerrit Code Review
authored andcommitted
Merge "ext zuul-executor - ci test - enable the test for OLM too"
2 parents 855ff79 + 8992a63 commit e7f74e7

File tree

13 files changed

+72
-106
lines changed

13 files changed

+72
-106
lines changed

doc/developer/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Tests run in the [project's CI](https://zuul.microshift.softwarefactory-project.
66
1. This command is a wrapper on top of `ansible-playbook` to run the same Ansible playbook
77
than the CI. This includes steps to deploy the operator if needed.
88

9-
The command requires a configuration file that can be intiated with `go run ./main.go init config`.
9+
The command requires a configuration file that can be intialized with `go run ./main.go init config`.
1010
The path to the configuration file must be specified via the `--config` parameter. A valid file
1111
for running CI jobs locally is available in `playbooks/files/sf-operator-cli.yaml`.
1212

playbooks/files/sf-no-ze.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
cr_path: playbooks/files/sf.yaml
3+
namespace: sf

roles/apply-custom-resources/tasks/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Apply the custom resources
3-
ansible.builtin.command: kubectl apply -f playbooks/files/sf.yaml
3+
ansible.builtin.command: kubectl -n {{ namespace }} apply -f {{ cr_path }}
44
args:
55
chdir: "{{ zuul.project.src_dir }}"
66

roles/clean-installations-cli/tasks/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
- name: Clean up previous operator installation
33
when: remote_os_host
44
ansible.builtin.shell: >
5-
go run ./main.go {{ cli_global_flags }} SF wipe --all
5+
go run ./main.go {{ cli_global_flags }} SF wipe --all
66
args:
77
chdir: "{{ zuul.project.src_dir | default(src_dir) }}"

roles/clean-installations/tasks/main.yaml

Lines changed: 0 additions & 60 deletions
This file was deleted.

roles/health-check/check-sf-resource-ready/defaults/main.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
retries: 60
33
delay: 10
44
reconciledBy: ""
5+
namespace: sf
6+
cr_name: my-sf

roles/health-check/check-sf-resource-ready/tasks/main.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
when: mode == 'olm'
44
block:
55
- name: Wait for the custom resources to be reconciledBy {{ reconciledBy }}
6-
ansible.builtin.command: kubectl get sf my-sf -o=jsonpath='{.status}'
6+
ansible.builtin.command: kubectl -n {{ namespace }} get sf {{ cr_name }} -o=jsonpath='{.status}'
77
register: sf_ready
88
until:
99
- sf_ready.stdout != ""
@@ -22,14 +22,14 @@
2222
ansible.builtin.command: sleep 1
2323

2424
- name: Get current resource generation
25-
ansible.builtin.command: kubectl get sf my-sf -o=jsonpath='{.metadata.generation}'
25+
ansible.builtin.command: kubectl -n {{ namespace }} get sf {{ cr_name }} -o=jsonpath='{.metadata.generation}'
2626
register: cr_generation
2727
until: cr_generation.stdout != ""
2828
retries: "{{ retries }}"
2929
delay: "{{ delay }}"
3030

3131
- name: Wait for the custom resources to be ready
32-
ansible.builtin.command: kubectl get sf my-sf -o=jsonpath='{.status}'
32+
ansible.builtin.command: kubectl -n {{ namespace }} get sf {{ cr_name }} -o=jsonpath='{.status}'
3333
register: sf_ready
3434
until:
3535
- sf_ready.stdout != ""

roles/health-check/test-external-ze/tasks/main.yaml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
---
2+
### Pre cleaning to ensure that no zuul-executor exists in the adjacent namespace
3+
4+
- name: "Ensure no External Zuul executor running"
5+
ansible.builtin.shell: |
6+
kubectl -n ext-ze delete SoftwareFactory my-ext-ze || true
7+
kubectl -n ext-ze delete sts zuul-executor || true
8+
9+
### Set control plane to deactivate the default zuul-executor and expose required services
10+
211
- name: "Deactivate the Zuul executor in the control plan"
312
ansible.builtin.include_role:
4-
name: run-operator-standalone
13+
name: update-custom-resource
514
vars:
6-
cr_path: playbooks/files/sf-no-ze.yaml
15+
cr_spec:
16+
config-location:
17+
base-url: "http://gerrit-httpd/"
18+
name: config
19+
zuul-connection-name: gerrit
20+
k8s-api-url: "https://microshift.dev:6443"
21+
logserver-host: microshift.dev
22+
zuul:
23+
executor:
24+
enabled: false
725

826
- name: Expose a Zookeeper Service as a LoadBalancer (reachable on microshift.dev)
927
kubernetes.core.k8s:
@@ -62,6 +80,8 @@
6280
statefulset.kubernetes.io/pod-name: logserver-0
6381
type: LoadBalancer
6482

83+
### Deploy the external zuul-executor in the adjacent namespace
84+
6585
- name: "Sync expected secrets resources from the control plan ns to ext-ze ns"
6686
ansible.builtin.shell: |
6787
kubectl get secrets {{ item }} -o json | jq --arg name {{ item }} '. + {metadata: {name: $name}}' | kubectl apply -n ext-ze -f -
@@ -72,11 +92,23 @@
7292
- zuul-keystore-password
7393

7494
- name: "Deploy the external Zuul executor"
95+
when: mode == 'standalone'
7596
ansible.builtin.include_role:
7697
name: run-operator-standalone
7798
vars:
7899
cr_path: playbooks/files/ext-ze.yaml
79100
context: ext-ze
101+
log_file: sf-operator_ext-ze.log
102+
current_cr_path: /tmp/current_cr_ext-ze.yaml
103+
104+
- name: "Deploy the external Zuul executor"
105+
when: mode == 'olm'
106+
ansible.builtin.include_role:
107+
name: apply-custom-resources
108+
vars:
109+
cr_path: playbooks/files/ext-ze.yaml
110+
namespace: ext-ze
111+
cr_name: my-ext-ze
80112

81113
- name: Expose a Zuul Executor Finger service as a LoadBalancer (reachable on microshift.dev)
82114
kubernetes.core.k8s:
@@ -98,14 +130,30 @@
98130
run: zuul-executor
99131
type: LoadBalancer
100132

133+
### Real proof that external executor is running as expected
134+
101135
- name: "Run the 'config-update-zuul' test case"
102136
ansible.builtin.include_role:
103137
name: health-check/config-update-zuul
104138

105-
- name: "Remove the External Zuul executor"
139+
### Post actions
140+
141+
- name: "Ensure no External Zuul executor running"
106142
ansible.builtin.shell: |
107-
kubectl -n ext-ze delete sts zuul-executor
143+
kubectl -n ext-ze delete SoftwareFactory my-ext-ze || true
144+
kubectl -n ext-ze delete sts zuul-executor || true
108145
109-
- name: "Activate the Zuul executor in the control plan"
146+
- name: "Restore the Zuul executor in the control plan (by using the default CR)"
110147
ansible.builtin.include_role:
111-
name: run-operator-standalone
148+
name: update-custom-resource
149+
vars:
150+
cr_spec:
151+
config-location:
152+
base-url: "http://gerrit-httpd/"
153+
name: config
154+
zuul-connection-name: gerrit
155+
k8s-api-url: ""
156+
logserver-host: ""
157+
zuul:
158+
executor:
159+
enabled: true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
glue: true
22
cr_path: playbooks/files/sf.yaml
33
context: ci
4+
log_file: sf-operator.log
5+
current_cr_path: /tmp/current_cr.yaml

0 commit comments

Comments
 (0)