From a78e64b3d1491ec100c5f0b0dbb8a87cacabfbbb Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Sun, 14 Jun 2020 22:30:44 +0200 Subject: [PATCH] Allow changing 'update' and 'force' when cloning repos Change-Id: I0079deb31a4268fd75c323aff3c4778c7d170053 --- .../roles/bifrost-create-vm-nodes/defaults/main.yml | 2 ++ playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml | 4 ++-- .../roles/bifrost-prep-for-install/defaults/main.yml | 3 +++ .../roles/bifrost-prep-for-install/tasks/main.yml | 4 ++-- releasenotes/notes/update-repos-b60563ee51b574fc.yaml | 10 ++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/update-repos-b60563ee51b574fc.yaml diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml index a880c3cca..439ed1c19 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml @@ -47,6 +47,8 @@ reqs_git_url: https://opendev.org/openstack/requirements reqs_git_folder: "{{ git_root }}/requirements" reqs_git_branch: "{{ git_branch }}" upper_constraints_file: "{{ lookup('env', 'UPPER_CONSTRAINTS_FILE') | default(reqs_git_folder + '/upper-constraints.txt', True) }}" +update_repos: true +force_update_repos: true # Conditional variables utilized based on CI or manual testing options. copy_from_local_path: false diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index ae118ddfa..7bab13cd1 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -106,10 +106,10 @@ - name: download requirements via git git: dest: "{{ reqs_git_folder }}" - force: yes + force: "{{ force_update_repos | bool }}" repo: "{{ reqs_git_url }}" version: "{{ reqs_git_branch }}" - update: yes + update: "{{ update_repos | bool }}" clone: yes when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false diff --git a/playbooks/roles/bifrost-prep-for-install/defaults/main.yml b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml index 099b7a404..30e4c03a2 100644 --- a/playbooks/roles/bifrost-prep-for-install/defaults/main.yml +++ b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml @@ -46,6 +46,9 @@ sushy_git_branch: "{{ git_branch }}" ipa_git_branch: "{{ git_branch }}" ipa_builder_git_branch: master +update_repos: true +force_update_repos: true + # Conditional variables utilized based on CI or manual testing options. copy_from_local_path: false ci_testing_zuul: false diff --git a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml index cf2cc9b1b..96a9a2349 100644 --- a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml +++ b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml @@ -24,10 +24,10 @@ - name: "Download via GIT" git: dest: "{{ item.git_folder }}" - force: yes + force: "{{ force_update_repos | bool }}" repo: "{{ item.git_url }}" version: "{{ item.git_branch }}" - update: yes + update: "{{ update_repos | bool }}" clone: yes with_items: "{{ bifrost_install_sources }}" when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false diff --git a/releasenotes/notes/update-repos-b60563ee51b574fc.yaml b/releasenotes/notes/update-repos-b60563ee51b574fc.yaml new file mode 100644 index 000000000..c7df7fca6 --- /dev/null +++ b/releasenotes/notes/update-repos-b60563ee51b574fc.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + Adds two new parameters for controlling how existing git checkouts are + handled: + + * ``update_repos`` can be set to ``false`` to prevent the repositories + from being updated. + * ``force_update_repos`` can be set to ``false`` to prevent Bifrost from + overwriting local changes.