856866fdde
Change-Id: I8157ec1f31b8c5a064b63002e8311b91ef9ce9ab See: https://ansible-lint.readthedocs.io/en/latest/default_rules.html#file-permissions-not-mentioned
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
- name: Create git parent dirs
|
|
file:
|
|
path: "{{ git_cache_root }}/{{ zj_project.canonical_name | dirname }}"
|
|
state: directory
|
|
mode: 0775
|
|
with_items: "{{ zuul.projects.values() | list }}"
|
|
loop_control:
|
|
loop_var: zj_project
|
|
|
|
- name: Copy git repos to {{ git_cache_root }}
|
|
command: cp -r "{{ ansible_user_dir }}/{{ zj_project.src_dir }}/.git"
|
|
"{{ git_cache_root }}/{{ zj_project.canonical_name }}"
|
|
with_items: "{{ zuul.projects.values() | list }}"
|
|
loop_control:
|
|
loop_var: zj_project
|
|
|
|
- name: Mark repos as bare
|
|
command: git config --bool core.bare true
|
|
args:
|
|
chdir: "{{ git_cache_root }}/{{ zj_project.canonical_name }}"
|
|
with_items: "{{ zuul.projects.values() | list }}"
|
|
loop_control:
|
|
loop_var: zj_project
|
|
# We don't want git module foo, just set a config value.
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Run git garbage collection
|
|
command: git gc --prune=now --aggressive
|
|
args:
|
|
chdir: "{{ git_cache_root }}/{{ zj_project.canonical_name }}"
|
|
with_items: "{{ zuul.projects.values() | list }}"
|
|
loop_control:
|
|
loop_var: zj_project
|
|
# The ansible git module doesn't support garbage collection.
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Set git_cache_file variable
|
|
set_fact:
|
|
git_cache_file: "{{ git_cache_root }}/repos.tar.gz"
|
|
|
|
- name: Create repos tarball
|
|
shell: |
|
|
tar -czf "{{ git_cache_file }}" *
|
|
args:
|
|
chdir: "{{ git_cache_root }}"
|
|
# Ansible lint wants we should use the unarchive module but we want the other
|
|
# way round.
|
|
tags:
|
|
- skip_ansible_lint
|