project-config/roles/use-cached-repos/tasks/main.yaml
Andreas Jaeger e117d34e91 ansible-lint: Handle some git warnings
Ignore some places where ansible warns about git usage.

Change-Id: I9c5c19cca8c1c32ee0cde85e2ec66140364c14bc
2017-10-29 15:37:22 +00:00

41 lines
1.4 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
command: "git remote rm origin"
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