zuul/playbooks/tutorial/roles/gate-pipeline/tasks/main.yaml

47 lines
1.6 KiB
YAML

- name: "Gate pipeline: Wait for Zuul to report gate job has started: {{ title }}"
uri:
url: "http://localhost:8080/a/changes/{{ change_id }}/detail"
method: GET
user: admin
password: secret
return_content: true
register: result
until: result.status == 200 and (result.content[5:] | from_json | to_json | from_json | json_query(json_query_change_gate_started) | length == 1)
delay: 1
retries: 30
- name: "Gate pipeline: Wait for Zuul to report gate job has finished: {{ title }}"
uri:
url: "http://localhost:8080/a/changes/{{ change_id }}/detail"
method: GET
user: admin
password: secret
return_content: true
register: result
until: result.status == 200 and (result.content[5:] | from_json | to_json | from_json | json_query(json_query_change_gate) | length == 1)
delay: 1
retries: "{{ gate_timeout }}"
- name: "Gate pipeline: set variable: {{ title }}"
when: pipeline_expected_result != "ok"
set_fact:
result_json: "{{ result.content[5:] }}"
- block:
- name: "Gate pipeline: change is merged: {{ title }}"
uri:
url: "http://localhost:8080/a/changes/{{ change_id }}/detail"
method: GET
user: admin
password: secret
return_content: true
register: result
until: result.status == 200 and (result.content[5:] | from_json | to_json | from_json | json_query(json_query_change_merged_ok) | length == 1)
delay: 1
retries: 30
- name: "Gate pipeline: set variable: {{ title }}"
set_fact:
result_json: "{{ result.content[5:] }}"
when: pipeline_expected_result == "ok"