Merge "Set force option to false by default"

This commit is contained in:
Zuul 2021-01-06 17:50:39 +00:00 committed by Gerrit Code Review
commit d0b3bfe07f
2 changed files with 29 additions and 12 deletions

View File

@ -60,7 +60,7 @@ options:
force:
description:
Boolean. Apply --force flags to git clones wherever
possible. Defaults to True. Not required.
possible. Defaults to False. Not required.
core_multiplier:
description:
Integer multiplier on the number of cores
@ -258,7 +258,7 @@ def main():
"default": 0},
"force": {"required": False,
"type": "bool",
"default": True},
"default": False},
"core_multiplier": {"required": False,
"type": "int",
"default": 4},

View File

@ -116,16 +116,33 @@
set_fact:
clone_roles: "{{ clone_roles + user_roles }}"
- name: Clone git repos (parallel)
git_requirements:
default_path: "{{ role_path_default }}"
default_depth: 10
default_version: "master"
repo_info: "{{ clone_roles }}"
retries: "{{ git_clone_retries }}"
delay: "{{ git_clone_retry_delay }}"
force: true
core_multiplier: 4
- name: Clone git repos
block:
- name: Clone git repos (parallel)
git_requirements:
default_path: "{{ role_path_default }}"
default_depth: 10
default_version: "master"
repo_info: "{{ clone_roles }}"
retries: "{{ git_clone_retries }}"
delay: "{{ git_clone_retry_delay }}"
force: "{{ not (ansible_distribution | lower == 'ubuntu' and ansible_distribution_version is version('20.04', '>=')) }}"
core_multiplier: 4
rescue:
- name: Clone git repos (with git)
git:
repo: "{{ item.src }}"
dest: "{{ item.path | default(role_path_default) }}/{{ item.name | default(item.src | basename) }}"
version: "{{ item.version | default('master') }}"
refspec: "{{ item.refspec | default(omit) }}"
depth: "{{ item.depth | default('10') }}"
update: true
force: true
with_items: "{{ clone_roles }}"
register: git_clone
until: git_clone is success
retries: "{{ git_clone_retries }}"
delay: "{{ git_clone_retry_delay }}"
vars:
ansible_python_interpreter: "/opt/ansible-runtime/bin/python"