tripleo-ci/playbooks/tripleo-ci/run-provider.yml

68 lines
2.2 KiB
YAML

- hosts: all
tasks:
- name: Discover a branch
block:
- name: Set from regular Zuul branch
set_fact:
ci_branch: "{{ zuul.branch | regex_replace('(stable|cloudsig)/', '') }}"
when: zuul is defined
- name: Set from branch_override variable
set_fact:
ci_branch: "{{ branch_override | regex_replace('(stable|cloudsig)/', '') }}"
when: branch_override is defined
- name: Set from release variable (in periodic)
set_fact:
ci_branch: "{{ release }}"
when: release is defined
- name: Set branch variables
set_fact:
provider_job_branch: "{{ ci_branch }}"
registry_ip_address_branch: "{'{{ ci_branch }}': '{{ hostvars[groups.all[0]].ansible_host }}'}"
provider_dlrn_hash_branch: "{'{{ ci_branch }}': '{{ dlrn_hash|default('') }}'}"
- name: Check if DLRN tag was dumped in /tmp/container_build_id
stat:
path: /tmp/container_build_id
register: build_id
- name: Recover DLRN tag
when: build_id.stat.exists
block:
- name: Load file
slurp:
src: /tmp/container_build_id
register: dlrn_file
- name: Set fact for DLRN tag
set_fact:
dlrn_hash: "{{ dlrn_file['content'] | b64decode | trim }}"
dlrn_hash_tag: "{{ dlrn_file['content'] | b64decode | trim }}"
- name: Return Zuul data
debug:
msg: >-
Running podman registry and repository on
{{ hostvars[groups.all[0]].ansible_host | default('nowhere') }}
for branch {{ ci_branch }} and DLRN tag {{ dlrn_hash|default('no tag') }}
- name: Set registry IP address
zuul_return:
data:
zuul:
pause: true
registry_ip_address: "{{ hostvars[groups.all[0]].ansible_host }}"
provider_dlrn_hash: "{{ dlrn_hash|default('') }}"
provider_dlrn_hash_tag: "{{ dlrn_hash_tag|default('') }}"
provider_job_branch: "{{ provider_job_branch }}"
registry_ip_address_branch: "{{ registry_ip_address_branch }}"
provider_dlrn_hash_branch: "{{ provider_dlrn_hash_branch }}"
tags:
- skip_ansible_lint