@ -22,13 +22,16 @@
- name : SUBMODULES | Test that clone without recursive does not retrieve submodules
- name : SUBMODULES | Test that clone without recursive does not retrieve submodules
git:
git:
repo : "{{ repo_submodules }}"
repo : "{{ repo_submodules }}"
version : 45c6c07ef10fd9e453d90207e63da1ce5bd3ae1e
dest : "{{ checkout_dir }}"
dest : "{{ checkout_dir }}"
recursive : no
recursive : no
- command : 'ls -1a {{ checkout_dir }}/submodule1'
- name : SUBMODULES | List submodule1
command : 'ls -1a {{ checkout_dir }}/submodule1'
register : submodule1
register : submodule1
- assert:
- name : SUBMODULES | Ensure submodu1 is at the appropriate commit
assert:
that : '{{ submodule1.stdout_lines | length }} == 2'
that : '{{ submodule1.stdout_lines | length }} == 2'
- name : SUBMODULES | clear checkout_dir
- name : SUBMODULES | clear checkout_dir
@ -41,76 +44,81 @@
git:
git:
repo : "{{ repo_submodules }}"
repo : "{{ repo_submodules }}"
dest : "{{ checkout_dir }}"
dest : "{{ checkout_dir }}"
version : 45c6c07ef10fd9e453d90207e63da1ce5bd3ae1e
recursive : yes
recursive : yes
- command : 'ls -1a {{ checkout_dir }}/submodule1'
- name : SUBMODULES | List submodule1
command : 'ls -1a {{ checkout_dir }}/submodule1'
register : submodule1
register : submodule1
- assert:
- name : SUBMODULES | Ensure submodule1 is at the appropriate commit
assert:
that : '{{ submodule1.stdout_lines | length }} == 4'
that : '{{ submodule1.stdout_lines | length }} == 4'
- name : SUBMODULES | Copy the checkout so we can run several different tests on it
- name : SUBMODULES | Copy the checkout so we can run several different tests on it
command : 'cp -pr {{ checkout_dir }} {{ checkout_dir }}.bak'
command : 'cp -pr {{ checkout_dir }} {{ checkout_dir }}.bak'
- name : SUBMODULES | Test that update without recursive does not change submodules
- name : SUBMODULES | Test that update without recursive does not change submodules
command : 'git config --replace-all remote.origin.url {{ repo_submodules_newer }}'
git:
args:
repo : "{{ repo_submodules }}"
chdir : '{{ checkout_dir }}'
version : d2974e4bbccdb59368f1d5eff2205f0fa863297e
- git:
repo : "{{ repo_submodules_newer }}"
dest : "{{ checkout_dir }}"
dest : "{{ checkout_dir }}"
recursive : no
recursive : no
update : yes
update : yes
track_submodules : yes
track_submodules : yes
- command : 'ls -1a {{ checkout_dir }}/submodule1'
- name : SUBMODULES | List submodule1
command : 'ls -1a {{ checkout_dir }}/submodule1'
register : submodule1
register : submodule1
- stat:
- name : SUBMODULES | Stat submodule2
stat:
path : "{{ checkout_dir }}/submodule2"
path : "{{ checkout_dir }}/submodule2"
register : submodule2
register : submodule2
- command : ls -1a {{ checkout_dir }}/submodule2
- name : SUBMODULES | List submodule2
command : ls -1a {{ checkout_dir }}/submodule2
register : submodule2
register : submodule2
- assert:
- name : SUBMODULES | Ensure both submodules are at the appropriate commit
that : '{{ submodule1.stdout_lines|length }} == 4'
assert:
that:
- assert:
- '{{ submodule1.stdout_lines|length }} == 4'
that : '{{ submodule2.stdout_lines|length }} == 2'
- '{{ submodule2.stdout_lines|length }} == 2'
- name : SUBMODULES | Re store checkout to prior state
- name : SUBMODULES | Re move checkout dir
file:
file:
state : absent
state : absent
path : "{{ checkout_dir }}"
path : "{{ checkout_dir }}"
- command : 'cp -pr {{ checkout_dir }}.bak {{ checkout_dir }}'
- name : SUBMODULES | Test that update with recursive updated existing submodules
- name : SUBMODULES | Restore checkout to prior state
command : 'git config --replace-all remote.origin.url {{ repo_submodules_newer }}'
command : 'cp -pr {{ checkout_dir }}.bak {{ checkout_dir }}'
args:
chdir : "{{ checkout_dir }}"
- git:
- name : SUBMODULES | Test that update with recursive updated existing submodules
repo : "{{ repo_submodules_newer }}"
git:
repo : "{{ repo_submodules }}"
version : d2974e4bbccdb59368f1d5eff2205f0fa863297e
dest : "{{ checkout_dir }}"
dest : "{{ checkout_dir }}"
update : yes
update : yes
recursive : yes
recursive : yes
track_submodules : yes
track_submodules : yes
- command : 'ls -1a {{ checkout_dir }}/submodule1'
- name : SUBMODULES | List submodule 1
command : 'ls -1a {{ checkout_dir }}/submodule1'
register : submodule1
register : submodule1
- assert:
- name : SUBMODULES | Ensure submodule1 is at the appropriate commit
that : '{{ submodule1.stdout_lines|length }} == 5'
assert:
that : '{{ submodule1.stdout_lines | length }} == 5'
- name : SUBMODULES | Test that update with recursive found new submodules
- name : SUBMODULES | Test that update with recursive found new submodules
command : 'ls -1a {{ checkout_dir }}/submodule2'
command : 'ls -1a {{ checkout_dir }}/submodule2'
register : submodule2
register : submodule2
- assert:
- name : SUBMODULES | Enusre submodule2 is at the appropriate commit
that : '{{ submodule2.stdout_lines|length }} == 4'
assert:
that : '{{ submodule2.stdout_lines | length }} == 4'