From 32978fe72961515b634986b6ea723177858180f3 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 28 Apr 2020 07:46:04 -0500 Subject: [PATCH] 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 --- .../roles/sync-project-config/defaults/main.yaml | 1 + playbooks/roles/sync-project-config/tasks/main.yaml | 10 ++++++++-- playbooks/zuul/run-production-playbook.yaml | 11 +++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/sync-project-config/defaults/main.yaml b/playbooks/roles/sync-project-config/defaults/main.yaml index 1dad7599f7..e17024ad67 100644 --- a/playbooks/roles/sync-project-config/defaults/main.yaml +++ b/playbooks/roles/sync-project-config/defaults/main.yaml @@ -1,2 +1,3 @@ project_config_dest: /opt/project-config project_config_subdir: "" +infra_prod_run_from_master: "{{ zuul.pipeline|default('') in ['periodic', 'opendev-prod-hourly'] }}" diff --git a/playbooks/roles/sync-project-config/tasks/main.yaml b/playbooks/roles/sync-project-config/tasks/main.yaml index c0f1f5f4e7..cff9acc5f7 100644 --- a/playbooks/roles/sync-project-config/tasks/main.yaml +++ b/playbooks/roles/sync-project-config/tasks/main.yaml @@ -3,9 +3,15 @@ path: '{{ project_config_dest }}' 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 synchronize: src: '{{ project_config_src }}/{{ project_config_subdir }}' dest: '{{ project_config_dest }}' - - diff --git a/playbooks/zuul/run-production-playbook.yaml b/playbooks/zuul/run-production-playbook.yaml index 3ff8346ba5..7b3d68065a 100644 --- a/playbooks/zuul/run-production-playbook.yaml +++ b/playbooks/zuul/run-production-playbook.yaml @@ -31,6 +31,17 @@ include_role: 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 block: