zuul/playbooks/tutorial/admin.yaml
James E. Blair acbe8a8730 Add lock expiration delays to quick-start
Recent runs of the quick-start job have started to fail and the
apparent cause is that podman may shut down the ZK pod before
the Zuul components have had a chance to release their locks.
This can cause the scheduler to need to wait for lock expiration
before starting the gerrit event stream, which in turn may cause
it to miss important events in the job.

To correct this, add a 30 second delay between stopping and starting
the containers.  When humans run through this sequence, they are
likely to be slow enough not to observe this condition, so we only
need to fix this in the test playbook (not the actual tutorial
instructions).

Change-Id: I806d33237058fa6f0a7c7cc22ceec47242cb4ad1
2024-06-27 09:20:10 -07:00

85 lines
2.3 KiB
YAML

# Stop the basic tutorial
- name: Run podman-compose down
when: not local
shell:
cmd: podman-compose -p zuul-tutorial stop
chdir: src/opendev.org/zuul/zuul/doc/source/examples
- name: Run podman-compose down
when: local
shell:
cmd: podman-compose -p zuul-tutorial stop
chdir: ../../doc/source/examples
# Restart with the new config
- name: Run podman-compose up
when: not local
shell:
cmd: podman-compose -p zuul-tutorial up -d
chdir: src/opendev.org/zuul/zuul/doc/source/examples
environment:
ZUUL_TUTORIAL_CONFIG: "./keycloak/etc_zuul/"
- name: Run podman-compose up
when: local
shell:
cmd: podman-compose -p zuul-tutorial up -d
chdir: ../../doc/source/examples
environment:
ZUUL_TUTORIAL_CONFIG: "./keycloak/etc_zuul/"
# Start keycloak
- name: Run podman-compose up
when: not local
shell:
cmd: podman-compose -p zuul-tutorial-keycloak up -d
chdir: src/opendev.org/zuul/zuul/doc/source/examples/keycloak
- name: Run podman-compose up
when: local
shell:
cmd: podman-compose -p zuul-tutorial-keycloak up -d
chdir: ../../doc/source/examples/keycloak
# Verify that Zuul runs with the new config
- name: Wait for Zuul
uri:
url: http://localhost:9000/api/tenant/example-tenant/status
method: GET
return_content: true
status_code: 200
body_format: json
register: result
retries: 30
delay: 10
until: result.status == 200 and result.json["zuul_version"] is defined
changed_when: false
# In case ZK is shutdown first, allow the locks to expire.
- name: Delay for ZK lock expiration
wait_for:
timeout: 30
delegate_to: localhost
- name: Verify Keycloak authentication is available
uri:
url: http://localhost:9000/api/tenant/example-tenant/info
method: GET
return_content: true
status_code: 200
body_format: json
register: result
failed_when: result.json["info"]["capabilities"]["auth"]["realms"]["zuul-demo"]["authority"] != "http://keycloak:8082/realms/zuul-demo"
changed_when: false
- name: Verify that old builds are available
uri:
url: "http://localhost:9000/api/tenant/example-tenant/builds"
method: GET
return_content: true
status_code: 200
body_format: json
register: result
failed_when: "result.json | length < 4"
changed_when: false