0326363e48
- Use zuul_return fake module to make ansible lint happy, this allows to remove Zuul import. - While ansible-lint 4.2.0 is now able to detect playbooks/roles, this is broken, so don't use it - move its config out of tox.ini so it can be used by any tools, or without tox Change-Id: Ie8935f47db855647e19ae091044e5ac1871f1551 Co-Authored-By: Sorin Sbarnea <ssbarnea@redhat.com> Co-Authored-By: Andreas Jaeger <aj@suse.com>
42 lines
1.5 KiB
YAML
42 lines
1.5 KiB
YAML
- name: Find locally cached git repos
|
|
stat:
|
|
path: "/opt/git/{{ item.name }}"
|
|
with_items: "{{ zuul.projects.values() | list }}"
|
|
register: cached_repos
|
|
|
|
- name: Clone cached repo to workspace
|
|
command: "git clone /opt/git/{{ item.0.name }} {{ ansible_user_dir }}/{{ item.0.src_dir }}"
|
|
args:
|
|
creates: "{{ ansible_user_dir }}/{{ item.0.src_dir }}"
|
|
when: item.1.stat.exists
|
|
with_together:
|
|
- "{{ zuul.projects.values() | list }}"
|
|
- "{{ cached_repos.results }}"
|
|
# ANSIBLE0006: If we use the git module, we get warning
|
|
# ANSIBLE0004 since we do not give an explicit version
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Clone upstream repo to workspace
|
|
command: "git clone https://{{ item.0.canonical_hostname }}/{{ item.0.name }} {{ ansible_user_dir }}/{{ item.0.src_dir }}"
|
|
args:
|
|
creates: "{{ ansible_user_dir }}/{{ item.0.src_dir }}"
|
|
when: not item.1.stat.exists
|
|
with_together:
|
|
- "{{ zuul.projects.values() | list }}"
|
|
- "{{ cached_repos.results }}"
|
|
# ANSIBLE0006: If we use the git module, we get warning
|
|
# ANSIBLE0004 since we do not give an explicit version
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Remove origin from local git repos
|
|
# To be idempotent, remove origin only if it's found in the local list.
|
|
shell: "git remote -v | grep origin && git remote rm origin || true"
|
|
args:
|
|
chdir: "{{ ansible_user_dir }}/{{ item.src_dir }}"
|
|
with_items: "{{ zuul.projects.values() | list }}"
|
|
# ANSIBLE0006: git remote is not supported by ansible module
|
|
tags:
|
|
- skip_ansible_lint
|