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

View File

@ -116,16 +116,33 @@
set_fact: set_fact:
clone_roles: "{{ clone_roles + user_roles }}" clone_roles: "{{ clone_roles + user_roles }}"
- name: Clone git repos (parallel) - name: Clone git repos
git_requirements: block:
default_path: "{{ role_path_default }}" - name: Clone git repos (parallel)
default_depth: 10 git_requirements:
default_version: "master" default_path: "{{ role_path_default }}"
repo_info: "{{ clone_roles }}" default_depth: 10
retries: "{{ git_clone_retries }}" default_version: "master"
delay: "{{ git_clone_retry_delay }}" repo_info: "{{ clone_roles }}"
force: true retries: "{{ git_clone_retries }}"
core_multiplier: 4 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: vars:
ansible_python_interpreter: "/opt/ansible-runtime/bin/python" ansible_python_interpreter: "/opt/ansible-runtime/bin/python"