Ian Wienand 72d7401b8c infra-prod: override checkout on periodic/hourly
This override is already done in system-config, but it makes more
sense to do it here in the generic job.

Change-Id: If47d2068b02cc868b03dfe7ceb254c7d1ecf9d9b
2021-11-18 09:12:29 +11:00

60 lines
2.3 KiB
YAML

- hosts: localhost
tasks:
- name: Add bridge.o.o to inventory
add_host:
name: bridge.openstack.org
ansible_python_interpreter: python3
ansible_user: zuul
# Without setting ansible_host directly, mirror-workspace-git-repos
# gets sad because if delegate_to localhost and with add_host that
# ends up with ansible_host being localhost.
ansible_host: bridge.openstack.org
ansible_port: 22
- hosts: localhost
tasks:
- name: Add bridge.o.o hostkey to known hosts
known_hosts:
name: bridge.openstack.org
key: "bridge.openstack.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxRzDkWvvVQtsLTAqAwedRWA84/42KKVdFS0QP8lZFsMpgTXUhjipJ7VcFun5gM87tnt0J71rlN+ospBh0/1wfp2jASEskUyGhXAa5xHjnJN7veUyW+AggEosK/OTunvZgf54p1sQg45Sq/uCjc0Ua0fRMOq2o5z/mgpl6rSjLOlWi9wKA/6axnUbs9w4iD5esyBQ+VcISSJOTqhAo/3UG0NwCU+6Ggwwhg0nl5iCMpQfq4A207IbJ72MkJzlQgW3edsRb5POzdZcGxkTYvVdP3kgHP4Bof3MFFZjBUMz6SuRQyNV5poysMtbtlO0SvgAJNhXr6Vn0GA9XhqFP6+HT"
- hosts: bridge.openstack.org
tasks:
- name: "Make sure a manaul maint isn't going on"
wait_for:
path: /home/zuul/DISABLE-ANSIBLE
state: absent
sleep: 10
timeout: 3600 # Wait for an hour before bailing
- name: "Correct ownership of repos"
command: "chown -R zuul:zuul /home/zuul/src"
# E303: Skip linting since it triggers on the "chown" command,
# but we prefer the shell above
tags:
- skip_ansible_lint
# Ignore the error if the dir doesn't exist
ignore_errors: true
# Do this as root, because it needs to chown root-owned files
become: true
# This role executes code on the executor, so this needs to be in
# a trusted playbook.
- name: Synchronize src repos to workspace directory.
include_role:
name: prepare-workspace-git
# When running from periodic/hourly we want to explicitly override
# to run from the tip of master
- 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
version: master