Update to tip of master in periodic jobs

The intent of the periodic jobs is to run with latest master. If
they get enqueued, then other patches land, they'll still run with
the value of the zuul ref from when they were enqueued. That's not
what we want for prod, as it can lead to running old versions of
config.

We don't usually like doing this, but in this case, rather than
making us remember to add a flag every time a prod job gets added
to a periodic pipeline, how's about we just calculate it.

Change-Id: Ib999731fe132b1e9f197e51d74066fa75cb6c69b
This commit is contained in:
Monty Taylor 2020-04-28 07:46:04 -05:00
parent 2cd57c3b18
commit 32978fe729
3 changed files with 20 additions and 2 deletions

View File

@ -1,2 +1,3 @@
project_config_dest: /opt/project-config project_config_dest: /opt/project-config
project_config_subdir: "" project_config_subdir: ""
infra_prod_run_from_master: "{{ zuul.pipeline|default('') in ['periodic', 'opendev-prod-hourly'] }}"

View File

@ -3,9 +3,15 @@
path: '{{ project_config_dest }}' path: '{{ project_config_dest }}'
state: directory state: directory
- name: Update from master
when: infra_prod_run_from_master|bool
delegate_to: bridge.openstack.org
git:
repo: https://opendev.org/openstack/project-config
dest: '{{ project_config_src }}'
force: yes
- name: Sync project-config repo - name: Sync project-config repo
synchronize: synchronize:
src: '{{ project_config_src }}/{{ project_config_subdir }}' src: '{{ project_config_src }}/{{ project_config_subdir }}'
dest: '{{ project_config_dest }}' dest: '{{ project_config_dest }}'

View File

@ -31,6 +31,17 @@
include_role: include_role:
name: prepare-workspace-git name: prepare-workspace-git
- name: Should we run from master
set_fact:
infra_prod_run_from_master: "{{ zuul.pipeline|default('') in ['periodic', 'opendev-prod-hourly'] }}"
- name: Update from master
when: infra_prod_run_from_master|bool
git:
repo: https://opendev.org/opendev/system-config
dest: /home/zuul/src/opendev.org/opendev/system-config
force: yes
- name: Run the production playbook and capture logs - name: Run the production playbook and capture logs
block: block: