* Correct usage for shutil.rmtree
Fix adds correct usage of shutil.rmtree in git module
Fixes: #31225
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Include archive tests so they get run
* Use new include syntax
* Cleanup syntax on git tests
- use multi-line YAML
- remove unneeded {{ }} around vars in conditionals
- remove unneeded quotes
- add task file name to task names for easier troubleshooting when things fail
* Make archive tests work for RHEL/CentOS 6
The older versions of Jinja2 in RHEL/CentOS 6 required assertion tasks using the map filter to be skipped.
The older version of git required gzip compression to be skipped on RHEL/CentOS 6.
* Account for ansible_distribution_major_version missing
(cherry picked from commit a047fe0e4c3621afdb1760812b0b0c52b7524162)
... | ... |
@@ -943,13 +943,13 @@ def create_archive(git_path, module, dest, archive, version, repo, result): |
943 | 943 |
result.update(changed=False) |
944 | 944 |
# Cleanup before exiting |
945 | 945 |
try: |
946 |
- shutil.remove(tempdir) |
|
946 |
+ shutil.rmtree(tempdir) |
|
947 | 947 |
except OSError: |
948 | 948 |
pass |
949 | 949 |
else: |
950 | 950 |
try: |
951 | 951 |
shutil.move(new_archive, archive) |
952 |
- shutil.remove(tempdir) |
|
952 |
+ shutil.rmtree(tempdir) |
|
953 | 953 |
result.update(changed=True) |
954 | 954 |
except OSError as e: |
955 | 955 |
module.fail_json(msg="Failed to move %s to %s" % |
... | ... |
@@ -1,31 +1,37 @@ |
1 |
- |
|
2 | 1 |
# test for https://github.com/ansible/ansible-modules-core/pull/3386 |
3 | 2 |
|
4 |
-- name: clone repo |
|
3 |
+- name: AMBIGUOUS-REF | clone repo |
|
5 | 4 |
git: |
6 | 5 |
repo: '{{ repo_format1 }}' |
7 | 6 |
dest: '{{ checkout_dir }}' |
8 | 7 |
|
9 |
-- name: rename remote to be ambiguous |
|
10 |
- command: git remote rename origin v0.1 chdir="{{ checkout_dir }}" |
|
8 |
+- name: AMBIGUOUS-REF | rename remote to be ambiguous |
|
9 |
+ command: git remote rename origin v0.1 |
|
10 |
+ args: |
|
11 |
+ chdir: "{{ checkout_dir }}" |
|
11 | 12 |
|
12 |
-- name: switch to HEAD |
|
13 |
+- name: AMBIGUOUS-REF | switch to HEAD |
|
13 | 14 |
git: |
14 | 15 |
repo: '{{ repo_format1 }}' |
15 | 16 |
dest: '{{ checkout_dir }}' |
16 | 17 |
remote: v0.1 |
17 | 18 |
|
18 |
-- name: rev-parse remote HEAD |
|
19 |
- command: git rev-parse v0.1/HEAD chdir="{{ checkout_dir }}" |
|
19 |
+- name: AMBIGUOUS-REF | rev-parse remote HEAD |
|
20 |
+ command: git rev-parse v0.1/HEAD |
|
21 |
+ args: |
|
22 |
+ chdir: "{{ checkout_dir }}" |
|
20 | 23 |
register: git_remote_head |
21 | 24 |
|
22 |
-- name: rev-parse local HEAD |
|
23 |
- command: git rev-parse HEAD chdir="{{ checkout_dir }}" |
|
25 |
+- name: AMBIGUOUS-REF | rev-parse local HEAD |
|
26 |
+ command: git rev-parse HEAD |
|
27 |
+ args: |
|
28 |
+ chdir: "{{ checkout_dir }}" |
|
24 | 29 |
register: git_local_head |
25 | 30 |
|
26 | 31 |
- assert: |
27 | 32 |
that: git_remote_head.stdout == git_local_head.stdout |
28 | 33 |
|
29 |
-- name: clear checkout_dir |
|
30 |
- file: state=absent path={{ checkout_dir }} |
|
34 |
+- name: AMBIGUOUS-REF | clear checkout_dir |
|
35 |
+ file: |
|
36 |
+ state: absent |
|
37 |
+ path: "{{ checkout_dir }}" |
31 | 38 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,34 @@ |
0 |
+- name: ARCHIVE | Clear checkout_dir |
|
1 |
+ file: |
|
2 |
+ state: absent |
|
3 |
+ path: "{{ checkout_dir }}" |
|
4 |
+ |
|
5 |
+- name: ARCHIVE | Archive repo using various archival format |
|
6 |
+ git: |
|
7 |
+ repo: '{{ repo_format1 }}' |
|
8 |
+ dest: '{{ checkout_dir }}' |
|
9 |
+ archive: '{{ checkout_dir }}/test_role.{{ item }}' |
|
10 |
+ register: git_archive |
|
11 |
+ with_items: "{{ git_archive_extensions[ansible_os_family ~ ansible_distribution_major_version | default('default') ] | default(git_archive_extensions.default) }}" |
|
12 |
+ |
|
13 |
+# The map filter was added in Jinja2 2.7, which is newer than the version on RHEL/CentOS 6, |
|
14 |
+# so we skip this validation on those hosts |
|
15 |
+- name: ARCHIVE | Assert that archives were downloaded |
|
16 |
+ assert: |
|
17 |
+ that: (git_archive.results | map(attribute='changed') | unique | list)[0] |
|
18 |
+ when: |
|
19 |
+ - "ansible_os_family == 'RedHat'" |
|
20 |
+ - ansible_distribution_major_version | version_compare('7', '>=') |
|
21 |
+ |
|
22 |
+- name: ARCHIVE | Check if archive file is created or not |
|
23 |
+ stat: |
|
24 |
+ path: '{{ checkout_dir }}/test_role.{{ item }}' |
|
25 |
+ register: archive_check |
|
26 |
+ with_items: "{{ git_archive_extensions[ansible_os_family ~ ansible_distribution_major_version | default('default') ] | default(git_archive_extensions.default) }}" |
|
27 |
+ |
|
28 |
+- name: ARCHIVE | Assert that archive files exist |
|
29 |
+ assert: |
|
30 |
+ that: (archive_check.results | map(attribute='stat.exists') | unique | list)[0] |
|
31 |
+ when: |
|
32 |
+ - "ansible_os_family == 'RedHat'" |
|
33 |
+ - ansible_distribution_major_version | version_compare('7', '>=') |
... | ... |
@@ -1,91 +1,103 @@ |
1 |
- |
|
2 | 1 |
# test change of repo url |
3 | 2 |
# see https://github.com/ansible/ansible-modules-core/pull/721 |
4 | 3 |
|
5 |
-- name: clear checkout_dir |
|
6 |
- file: state=absent path={{ checkout_dir }} |
|
4 |
+- name: CHANGE-REPO-URL | clear checkout_dir |
|
5 |
+ file: |
|
6 |
+ state: absent |
|
7 |
+ path: "{{ checkout_dir }}" |
|
7 | 8 |
|
8 |
-- name: Clone example git repo |
|
9 |
+- name: CHANGE-REPO-URL | Clone example git repo |
|
9 | 10 |
git: |
10 |
- repo: '{{ repo_update_url_1 }}' |
|
11 |
- dest: '{{ checkout_dir }}' |
|
11 |
+ repo: "{{ repo_update_url_1 }}" |
|
12 |
+ dest: "{{ checkout_dir }}" |
|
12 | 13 |
|
13 |
-- name: Clone repo with changed url to the same place |
|
14 |
+- name: CHANGE-REPO-URL | Clone repo with changed url to the same place |
|
14 | 15 |
git: |
15 |
- repo: '{{ repo_update_url_2 }}' |
|
16 |
- dest: '{{ checkout_dir }}' |
|
16 |
+ repo: "{{ repo_update_url_2 }}" |
|
17 |
+ dest: "{{ checkout_dir }}" |
|
17 | 18 |
register: clone2 |
18 | 19 |
|
19 | 20 |
- assert: |
20 | 21 |
that: "clone2|success" |
21 | 22 |
|
22 |
-- name: check url updated |
|
23 |
+- name: CHANGE-REPO-URL | check url updated |
|
23 | 24 |
shell: git remote show origin | grep Fetch |
24 | 25 |
register: remote_url |
25 | 26 |
args: |
26 |
- chdir: '{{ checkout_dir }}' |
|
27 |
+ chdir: "{{ checkout_dir }}" |
|
27 | 28 |
environment: |
28 | 29 |
LC_ALL: C |
29 | 30 |
|
30 | 31 |
- assert: |
31 |
- that: |
|
32 |
+ that: |
|
32 | 33 |
- "'git-test-new' in remote_url.stdout" |
33 | 34 |
- "'git-test-old' not in remote_url.stdout" |
34 | 35 |
|
35 |
-- name: check for new content in git-test-new |
|
36 |
+- name: CHANGE-REPO-URL | check for new content in git-test-new |
|
36 | 37 |
stat: path={{ checkout_dir }}/newfilename |
37 | 38 |
register: repo_content |
38 | 39 |
|
39 |
-- name: assert presence of new file in repo (i.e. working copy updated) |
|
40 |
+- name: CHANGE-REPO-URL | assert presence of new file in repo (i.e. working copy updated) |
|
40 | 41 |
assert: |
41 | 42 |
that: "repo_content.stat.exists" |
42 | 43 |
|
43 | 44 |
# Make sure 'changed' result is accurate in check mode. |
44 | 45 |
# See https://github.com/ansible/ansible-modules-core/pull/4243 |
45 | 46 |
|
46 |
-- name: clear checkout_dir |
|
47 |
- file: state=absent path={{ checkout_dir }} |
|
47 |
+- name: CHANGE-REPO-URL | clear checkout_dir |
|
48 |
+ file: |
|
49 |
+ state: absent |
|
50 |
+ path: "{{ checkout_dir }}" |
|
48 | 51 |
|
49 |
-- name: clone repo |
|
50 |
- git: repo={{ repo_update_url_1 }} dest={{ checkout_dir }} |
|
52 |
+- name: CHANGE-REPO-URL | clone repo |
|
53 |
+ git: |
|
54 |
+ repo: "{{ repo_update_url_1 }}" |
|
55 |
+ dest: "{{ checkout_dir }}" |
|
51 | 56 |
|
52 |
-- name: clone repo with same url to same destination |
|
53 |
- git: repo={{ repo_update_url_1 }} dest={{ checkout_dir }} |
|
57 |
+- name: CHANGE-REPO-URL | clone repo with same url to same destination |
|
58 |
+ git: |
|
59 |
+ repo: "{{ repo_update_url_1 }}" |
|
60 |
+ dest: "{{ checkout_dir }}" |
|
54 | 61 |
register: checkout_same_url |
55 | 62 |
|
56 |
-- name: check repo not changed |
|
63 |
+- name: CHANGE-REPO-URL | check repo not changed |
|
57 | 64 |
assert: |
58 | 65 |
that: |
59 | 66 |
- not checkout_same_url|changed |
60 | 67 |
|
61 | 68 |
|
62 |
-- name: clone repo with new url to same destination |
|
63 |
- git: repo={{ repo_update_url_2 }} dest={{ checkout_dir }} |
|
69 |
+- name: CHANGE-REPO-URL | clone repo with new url to same destination |
|
70 |
+ git: |
|
71 |
+ repo: "{{ repo_update_url_2 }}" |
|
72 |
+ dest: "{{ checkout_dir }}" |
|
64 | 73 |
register: checkout_new_url |
65 | 74 |
|
66 |
-- name: check repo changed |
|
75 |
+- name: CHANGE-REPO-URL | check repo changed |
|
67 | 76 |
assert: |
68 | 77 |
that: |
69 | 78 |
- checkout_new_url|changed |
70 | 79 |
|
71 | 80 |
|
72 |
-- name: clone repo with new url in check mode |
|
73 |
- git: repo={{ repo_update_url_1 }} dest={{ checkout_dir }} |
|
81 |
+- name: CHANGE-REPO-URL | clone repo with new url in check mode |
|
82 |
+ git: |
|
83 |
+ repo: "{{ repo_update_url_1 }}" |
|
84 |
+ dest: "{{ checkout_dir }}" |
|
74 | 85 |
register: checkout_new_url_check_mode |
75 | 86 |
check_mode: True |
76 | 87 |
|
77 |
-- name: check repo reported changed in check mode |
|
88 |
+- name: CHANGE-REPO-URL | check repo reported changed in check mode |
|
78 | 89 |
assert: |
79 | 90 |
that: |
80 |
- - checkout_new_url_check_mode|changed |
|
81 |
- when: git_version.stdout | version_compare("{{git_version_supporting_ls_remote}}", '>=') |
|
91 |
+ - checkout_new_url_check_mode | changed |
|
92 |
+ when: git_version.stdout | version_compare(git_version_supporting_ls_remote, '>=') |
|
82 | 93 |
|
83 |
-- name: clone repo with new url after check mode |
|
84 |
- git: repo={{ repo_update_url_1 }} dest={{ checkout_dir }} |
|
94 |
+- name: CHANGE-REPO-URL | clone repo with new url after check mode |
|
95 |
+ git: |
|
96 |
+ repo: "{{ repo_update_url_1 }}" |
|
97 |
+ dest: "{{ checkout_dir }}" |
|
85 | 98 |
register: checkout_new_url_after_check_mode |
86 | 99 |
|
87 |
-- name: check repo still changed after check mode |
|
100 |
+- name: CHANGE-REPO-URL | check repo still changed after check mode |
|
88 | 101 |
assert: |
89 | 102 |
that: |
90 | 103 |
- checkout_new_url_after_check_mode|changed |
... | ... |
@@ -93,26 +105,28 @@ |
93 | 93 |
|
94 | 94 |
# Test that checkout by branch works when the branch is not in our current repo but the sha is |
95 | 95 |
|
96 |
-- name: clear checkout_dir |
|
97 |
- file: state=absent path={{ checkout_dir }} |
|
96 |
+- name: CHANGE-REPO-URL | clear checkout_dir |
|
97 |
+ file: |
|
98 |
+ state: absent |
|
99 |
+ path: "{{ checkout_dir }}" |
|
98 | 100 |
|
99 |
-- name: "Clone example git repo that we're going to modify" |
|
101 |
+- name: CHANGE-REPO-URL | "Clone example git repo that we're going to modify" |
|
100 | 102 |
git: |
101 |
- repo: '{{ repo_update_url_1 }}' |
|
102 |
- dest: '{{ checkout_dir }}/repo' |
|
103 |
+ repo: "{{ repo_update_url_1 }}" |
|
104 |
+ dest: "{{ checkout_dir }}/repo" |
|
103 | 105 |
|
104 |
-- name: Clone the repo again - this is what we test |
|
106 |
+- name: CHANGE-REPO-URL | Clone the repo again - this is what we test |
|
105 | 107 |
git: |
106 |
- repo: '{{ checkout_dir }}/repo' |
|
107 |
- dest: '{{ checkout_dir }}/checkout' |
|
108 |
+ repo: "{{ checkout_dir }}/repo" |
|
109 |
+ dest: "{{ checkout_dir }}/checkout" |
|
108 | 110 |
|
109 |
-- name: Add a branch to the repo |
|
111 |
+- name: CHANGE-REPO-URL | Add a branch to the repo |
|
110 | 112 |
command: git branch new-branch |
111 | 113 |
args: |
112 |
- chdir: '{{ checkout_dir }}/repo' |
|
114 |
+ chdir: "{{ checkout_dir }}/repo" |
|
113 | 115 |
|
114 |
-- name: Checkout the new branch in the checkout |
|
116 |
+- name: CHANGE-REPO-URL | Checkout the new branch in the checkout |
|
115 | 117 |
git: |
116 |
- repo: '{{ checkout_dir}}/repo' |
|
118 |
+ repo: "{{ checkout_dir}}/repo" |
|
117 | 119 |
version: 'new-branch' |
118 |
- dest: '{{ checkout_dir }}/checkout' |
|
120 |
+ dest: "{{ checkout_dir }}/checkout" |
... | ... |
@@ -1,5 +1,3 @@ |
1 |
- |
|
2 | 1 |
# test for https://github.com/ansible/ansible-modules-core/issues/527 |
3 | 2 |
# clone a repo, add a tag to the same commit and try to checkout the new commit |
4 | 3 |
|
... | ... |
@@ -7,12 +5,12 @@ |
7 | 7 |
- name: clear checkout_dir |
8 | 8 |
file: |
9 | 9 |
state: absent |
10 |
- path: '{{ checkout_dir }}' |
|
10 |
+ path: "{{ checkout_dir }}" |
|
11 | 11 |
|
12 | 12 |
- name: checkout example repo |
13 | 13 |
git: |
14 |
- repo: '{{ repo_dir }}/format1' |
|
15 |
- dest: '{{ checkout_dir }}' |
|
14 |
+ repo: "{{ repo_dir }}/format1" |
|
15 |
+ dest: "{{ checkout_dir }}" |
|
16 | 16 |
|
17 | 17 |
- name: get tags of head |
18 | 18 |
command: git tag --contains |
... | ... |
@@ -32,8 +30,8 @@ |
32 | 32 |
|
33 | 33 |
- name: update copy with new tag |
34 | 34 |
git: |
35 |
- repo: '{{ repo_dir }}/format1' |
|
36 |
- dest: '{{checkout_dir}}' |
|
35 |
+ repo: "{{ repo_dir }}/format1" |
|
36 |
+ dest: "{{checkout_dir}}" |
|
37 | 37 |
version: newtag |
38 | 38 |
register: update_new_tag |
39 | 39 |
|
... | ... |
@@ -53,4 +51,4 @@ |
53 | 53 |
- name: clear checkout_dir |
54 | 54 |
file: |
55 | 55 |
state: absent |
56 |
- path: '{{ checkout_dir }}' |
|
56 |
+ path: "{{ checkout_dir }}" |
... | ... |
@@ -1,30 +1,30 @@ |
1 |
- |
|
2 | 1 |
# Test the depth option and fetching revisions that were ignored first |
3 | 2 |
|
4 |
-- name: clear checkout_dir |
|
5 |
- file: state=absent path={{ checkout_dir }} |
|
3 |
+- name: DEPTH | clear checkout_dir |
|
4 |
+ file: |
|
5 |
+ state: absent |
|
6 |
+ path: "{{ checkout_dir }}" |
|
6 | 7 |
|
7 |
-- name: Clone example git repo with depth 1 |
|
8 |
+- name: DEPTH | Clone example git repo with depth 1 |
|
8 | 9 |
git: |
9 | 10 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
10 | 11 |
dest: '{{ checkout_dir }}' |
11 | 12 |
depth: 1 |
12 | 13 |
|
13 |
-- name: try to access earlier commit |
|
14 |
+- name: DEPTH | try to access earlier commit |
|
14 | 15 |
command: "git checkout {{git_shallow_head_1.stdout}}" |
15 | 16 |
register: checkout_early |
16 | 17 |
failed_when: False |
17 | 18 |
args: |
18 | 19 |
chdir: '{{ checkout_dir }}' |
19 | 20 |
|
20 |
-- name: make sure the old commit was not fetched |
|
21 |
+- name: DEPTH | make sure the old commit was not fetched |
|
21 | 22 |
assert: |
22 | 23 |
that: 'checkout_early.rc != 0' |
23 |
- when: git_version.stdout | version_compare("{{git_version_supporting_depth}}", '>=') |
|
24 |
+ when: git_version.stdout | version_compare(git_version_supporting_depth, '>=') |
|
24 | 25 |
|
25 | 26 |
# tests https://github.com/ansible/ansible/issues/14954 |
26 |
-- name: fetch repo again with depth=1 |
|
27 |
+- name: DEPTH | fetch repo again with depth=1 |
|
27 | 28 |
git: |
28 | 29 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
29 | 30 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -33,22 +33,22 @@ |
33 | 33 |
|
34 | 34 |
- assert: |
35 | 35 |
that: "not checkout2|changed" |
36 |
- when: git_version.stdout | version_compare("{{git_version_supporting_depth}}", '>=') |
|
36 |
+ when: git_version.stdout | version_compare(git_version_supporting_depth, '>=') |
|
37 | 37 |
|
38 |
-- name: again try to access earlier commit |
|
38 |
+- name: DEPTH | again try to access earlier commit |
|
39 | 39 |
shell: "git checkout {{git_shallow_head_1.stdout}}" |
40 | 40 |
register: checkout_early |
41 | 41 |
failed_when: False |
42 | 42 |
args: |
43 | 43 |
chdir: '{{ checkout_dir }}' |
44 | 44 |
|
45 |
-- name: again make sure the old commit was not fetched |
|
45 |
+- name: DEPTH | again make sure the old commit was not fetched |
|
46 | 46 |
assert: |
47 | 47 |
that: 'checkout_early.rc != 0' |
48 |
- when: git_version.stdout | version_compare("{{git_version_supporting_depth}}", '>=') |
|
48 |
+ when: git_version.stdout | version_compare(git_version_supporting_depth, '>=') |
|
49 | 49 |
|
50 | 50 |
# make sure we are still able to fetch other versions |
51 |
-- name: Clone same repo with older version |
|
51 |
+- name: DEPTH | Clone same repo with older version |
|
52 | 52 |
git: |
53 | 53 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
54 | 54 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -57,20 +57,20 @@ |
57 | 57 |
register: cloneold |
58 | 58 |
|
59 | 59 |
- assert: |
60 |
- that: "cloneold|success" |
|
60 |
+ that: cloneold | success |
|
61 | 61 |
|
62 |
-- name: try to access earlier commit |
|
62 |
+- name: DEPTH | try to access earlier commit |
|
63 | 63 |
shell: "git checkout {{git_shallow_head_1.stdout}}" |
64 | 64 |
args: |
65 | 65 |
chdir: '{{ checkout_dir }}' |
66 | 66 |
|
67 |
-- name: clear checkout_dir |
|
67 |
+- name: DEPTH | clear checkout_dir |
|
68 | 68 |
file: |
69 | 69 |
state: absent |
70 | 70 |
path: "{{ checkout_dir }}" |
71 | 71 |
|
72 | 72 |
# Test for https://github.com/ansible/ansible/issues/21316 |
73 |
-- name: Shallow clone with tag |
|
73 |
+- name: DEPTH | Shallow clone with tag |
|
74 | 74 |
git: |
75 | 75 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
76 | 76 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -79,9 +79,9 @@ |
79 | 79 |
register: cloneold |
80 | 80 |
|
81 | 81 |
- assert: |
82 |
- that: "cloneold|success" |
|
82 |
+ that: cloneold | success |
|
83 | 83 |
|
84 |
-- name: clear checkout_dir |
|
84 |
+- name: DEPTH | clear checkout_dir |
|
85 | 85 |
file: |
86 | 86 |
state: absent |
87 | 87 |
path: "{{ checkout_dir }}" |
... | ... |
@@ -90,14 +90,14 @@ |
90 | 90 |
# Test for https://github.com/ansible/ansible-modules-core/issues/3456 |
91 | 91 |
# clone a repo with depth and version specified |
92 | 92 |
|
93 |
-- name: clone repo with both version and depth specified |
|
93 |
+- name: DEPTH | clone repo with both version and depth specified |
|
94 | 94 |
git: |
95 | 95 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
96 | 96 |
dest: '{{ checkout_dir }}' |
97 | 97 |
depth: 1 |
98 | 98 |
version: master |
99 | 99 |
|
100 |
-- name: run a second time (now fetch, not clone) |
|
100 |
+- name: DEPTH | run a second time (now fetch, not clone) |
|
101 | 101 |
git: |
102 | 102 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
103 | 103 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -105,22 +105,24 @@ |
105 | 105 |
version: master |
106 | 106 |
register: git_fetch |
107 | 107 |
|
108 |
-- name: ensure the fetch succeeded |
|
108 |
+- name: DEPTH | ensure the fetch succeeded |
|
109 | 109 |
assert: |
110 |
- that: git_fetch|success |
|
110 |
+ that: git_fetch | success |
|
111 | 111 |
|
112 | 112 |
|
113 |
-- name: clear checkout_dir |
|
114 |
- file: state=absent path={{ checkout_dir }} |
|
113 |
+- name: DEPTH | clear checkout_dir |
|
114 |
+ file: |
|
115 |
+ state: absent |
|
116 |
+ path: "{{ checkout_dir }}" |
|
115 | 117 |
|
116 |
-- name: clone repo with both version and depth specified |
|
118 |
+- name: DEPTH | clone repo with both version and depth specified |
|
117 | 119 |
git: |
118 | 120 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
119 | 121 |
dest: '{{ checkout_dir }}' |
120 | 122 |
depth: 1 |
121 | 123 |
version: master |
122 | 124 |
|
123 |
-- name: switch to older branch with depth=1 (uses fetch) |
|
125 |
+- name: DEPTH | switch to older branch with depth=1 (uses fetch) |
|
124 | 126 |
git: |
125 | 127 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
126 | 128 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -128,28 +130,30 @@ |
128 | 128 |
version: earlybranch |
129 | 129 |
register: git_fetch |
130 | 130 |
|
131 |
-- name: ensure the fetch succeeded |
|
131 |
+- name: DEPTH | ensure the fetch succeeded |
|
132 | 132 |
assert: |
133 |
- that: git_fetch|success |
|
133 |
+ that: git_fetch | success |
|
134 | 134 |
|
135 |
-- name: clear checkout_dir |
|
136 |
- file: state=absent path={{ checkout_dir }} |
|
135 |
+- name: DEPTH | clear checkout_dir |
|
136 |
+ file: |
|
137 |
+ state: absent |
|
138 |
+ path: "{{ checkout_dir }}" |
|
137 | 139 |
|
138 | 140 |
# test for https://github.com/ansible/ansible-modules-core/issues/3782 |
139 | 141 |
# make sure shallow fetch works when no version is specified |
140 | 142 |
|
141 |
-- name: checkout old repo |
|
143 |
+- name: DEPTH | checkout old repo |
|
142 | 144 |
git: |
143 | 145 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
144 | 146 |
dest: '{{ checkout_dir }}' |
145 | 147 |
depth: 1 |
146 | 148 |
|
147 |
-- name: "update repo" |
|
149 |
+- name: DEPTH | "update repo" |
|
148 | 150 |
shell: echo "3" > a; git commit -a -m "3" |
149 | 151 |
args: |
150 |
- chdir: "{{repo_dir}}/shallow" |
|
152 |
+ chdir: "{{ repo_dir }}/shallow" |
|
151 | 153 |
|
152 |
-- name: fetch updated repo |
|
154 |
+- name: DEPTH | fetch updated repo |
|
153 | 155 |
git: |
154 | 156 |
repo: 'file://{{ repo_dir|expanduser }}/shallow' |
155 | 157 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -157,13 +161,13 @@ |
157 | 157 |
register: git_fetch |
158 | 158 |
ignore_errors: yes |
159 | 159 |
|
160 |
-- name: check update arrived |
|
160 |
+- name: DEPTH | check update arrived |
|
161 | 161 |
assert: |
162 | 162 |
that: |
163 | 163 |
- "{{ lookup('file', checkout_dir+'/a' )}} == 3" |
164 |
- - git_fetch|changed |
|
164 |
+ - git_fetch | changed |
|
165 | 165 |
|
166 |
-- name: clear checkout_dir |
|
166 |
+- name: DEPTH | clear checkout_dir |
|
167 | 167 |
file: |
168 | 168 |
state: absent |
169 | 169 |
path: "{{ checkout_dir }}" |
... | ... |
@@ -1,12 +1,10 @@ |
1 |
- |
|
2 |
-- name: initial checkout |
|
1 |
+- name: FORMATS | initial checkout |
|
3 | 2 |
git: |
4 | 3 |
repo: "{{ repo_format1 }}" |
5 | 4 |
dest: "{{ repo_dir }}/format1" |
6 | 5 |
register: git_result |
7 | 6 |
|
8 |
-- name: verify information about the initial clone |
|
7 |
+- name: FORMATS | verify information about the initial clone |
|
9 | 8 |
assert: |
10 | 9 |
that: |
11 | 10 |
- "'before' in git_result" |
... | ... |
@@ -14,29 +12,29 @@ |
14 | 14 |
- "not git_result.before" |
15 | 15 |
- "git_result.changed" |
16 | 16 |
|
17 |
-- name: repeated checkout |
|
17 |
+- name: FORMATS | repeated checkout |
|
18 | 18 |
git: |
19 | 19 |
repo: "{{ repo_format1 }}" |
20 | 20 |
dest: "{{ repo_dir }}/format1" |
21 | 21 |
register: git_result2 |
22 | 22 |
|
23 |
-- name: check for tags |
|
23 |
+- name: FORMATS | check for tags |
|
24 | 24 |
stat: |
25 | 25 |
path: "{{ repo_dir }}/format1/.git/refs/tags" |
26 | 26 |
register: tags |
27 | 27 |
|
28 |
-- name: check for HEAD |
|
28 |
+- name: FORMATS | check for HEAD |
|
29 | 29 |
stat: |
30 | 30 |
path: "{{ repo_dir }}/format1/.git/HEAD" |
31 | 31 |
register: head |
32 | 32 |
|
33 |
-- name: assert presence of tags/trunk/branches |
|
33 |
+- name: FORMATS | assert presence of tags/trunk/branches |
|
34 | 34 |
assert: |
35 | 35 |
that: |
36 | 36 |
- "tags.stat.isdir" |
37 | 37 |
- "head.stat.isreg" |
38 | 38 |
|
39 |
-- name: verify on a reclone things are marked unchanged |
|
39 |
+- name: FORMATS | verify on a reclone things are marked unchanged |
|
40 | 40 |
assert: |
41 | 41 |
that: |
42 | 42 |
- "not git_result2.changed" |
... | ... |
@@ -1,40 +1,39 @@ |
1 | 1 |
# Test for verification of GnuPG signatures |
2 | 2 |
|
3 |
-- name: Create GnuPG verification workdir |
|
3 |
+- name: GPG-VERIFICATION | Create GnuPG verification workdir |
|
4 | 4 |
tempfile: |
5 | 5 |
state: directory |
6 | 6 |
register: git_gpg_workdir |
7 | 7 |
|
8 |
-- name: Define variables based on workdir |
|
8 |
+- name: GPG-VERIFICATION | Define variables based on workdir |
|
9 | 9 |
set_fact: |
10 | 10 |
git_gpg_keyfile: "{{ git_gpg_workdir.path }}/testkey.asc" |
11 | 11 |
git_gpg_source: "{{ git_gpg_workdir.path }}/source" |
12 | 12 |
git_gpg_dest: "{{ git_gpg_workdir.path }}/dest" |
13 | 13 |
git_gpg_gpghome: "{{ git_gpg_workdir.path }}/gpg" |
14 | 14 |
|
15 |
-- name: Temporary store GnuPG test key |
|
15 |
+- name: GPG-VERIFICATION | Temporary store GnuPG test key |
|
16 | 16 |
copy: |
17 | 17 |
content: "{{ git_gpg_testkey }}" |
18 | 18 |
dest: "{{ git_gpg_keyfile }}" |
19 | 19 |
|
20 |
-- name: Create temporary GNUPGHOME directory |
|
20 |
+- name: GPG-VERIFICATION | Create temporary GNUPGHOME directory |
|
21 | 21 |
file: |
22 | 22 |
path: "{{ git_gpg_gpghome }}" |
23 | 23 |
state: directory |
24 | 24 |
mode: 0700 |
25 | 25 |
|
26 |
-- name: Import GnuPG test key |
|
26 |
+- name: GPG-VERIFICATION | Import GnuPG test key |
|
27 | 27 |
environment: |
28 | 28 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
29 | 29 |
command: gpg --import {{ git_gpg_keyfile }} |
30 | 30 |
|
31 |
-- name: Create local GnuPG signed repository directory |
|
31 |
+- name: GPG-VERIFICATION | Create local GnuPG signed repository directory |
|
32 | 32 |
file: |
33 | 33 |
path: "{{ git_gpg_source }}" |
34 | 34 |
state: directory |
35 | 35 |
|
36 |
-- name: Generate local GnuPG signed repository |
|
36 |
+- name: GPG-VERIFICATION | Generate local GnuPG signed repository |
|
37 | 37 |
environment: |
38 | 38 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
39 | 39 |
shell: | |
... | ... |
@@ -57,19 +56,19 @@ |
57 | 57 |
args: |
58 | 58 |
chdir: "{{ git_gpg_source }}" |
59 | 59 |
|
60 |
-- name: Get hash of an unsigned commit |
|
60 |
+- name: GPG-VERIFICATION | Get hash of an unsigned commit |
|
61 | 61 |
command: git show-ref --hash --verify refs/tags/lightweight_tag/unsigned_commit |
62 | 62 |
args: |
63 | 63 |
chdir: "{{ git_gpg_source }}" |
64 | 64 |
register: git_gpg_unsigned_commit |
65 | 65 |
|
66 |
-- name: Get hash of a signed commit |
|
66 |
+- name: GPG-VERIFICATION | Get hash of a signed commit |
|
67 | 67 |
command: git show-ref --hash --verify refs/tags/lightweight_tag/signed_commit |
68 | 68 |
args: |
69 | 69 |
chdir: "{{ git_gpg_source }}" |
70 | 70 |
register: git_gpg_signed_commit |
71 | 71 |
|
72 |
-- name: Clone repo and verify signed HEAD |
|
72 |
+- name: GPG-VERIFICATION | Clone repo and verify signed HEAD |
|
73 | 73 |
environment: |
74 | 74 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
75 | 75 |
git: |
... | ... |
@@ -77,7 +76,7 @@ |
77 | 77 |
dest: "{{ git_gpg_dest }}" |
78 | 78 |
verify_commit: yes |
79 | 79 |
|
80 |
-- name: Clone repo and verify a signed lightweight tag |
|
80 |
+- name: GPG-VERIFICATION | Clone repo and verify a signed lightweight tag |
|
81 | 81 |
environment: |
82 | 82 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
83 | 83 |
git: |
... | ... |
@@ -86,7 +85,7 @@ |
86 | 86 |
version: lightweight_tag/signed_commit |
87 | 87 |
verify_commit: yes |
88 | 88 |
|
89 |
-- name: Clone repo and verify an unsigned lightweight tag (should fail) |
|
89 |
+- name: GPG-VERIFICATION | Clone repo and verify an unsigned lightweight tag (should fail) |
|
90 | 90 |
environment: |
91 | 91 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
92 | 92 |
git: |
... | ... |
@@ -97,13 +96,13 @@ |
97 | 97 |
register: git_verify |
98 | 98 |
ignore_errors: yes |
99 | 99 |
|
100 |
-- name: Check that unsigned lightweight tag verification failed |
|
100 |
+- name: GPG-VERIFICATION | Check that unsigned lightweight tag verification failed |
|
101 | 101 |
assert: |
102 | 102 |
that: |
103 | 103 |
- git_verify|failed |
104 | 104 |
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+") |
105 | 105 |
|
106 |
-- name: Clone repo and verify a signed commit |
|
106 |
+- name: GPG-VERIFICATION | Clone repo and verify a signed commit |
|
107 | 107 |
environment: |
108 | 108 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
109 | 109 |
git: |
... | ... |
@@ -112,7 +111,7 @@ |
112 | 112 |
version: "{{ git_gpg_signed_commit.stdout }}" |
113 | 113 |
verify_commit: yes |
114 | 114 |
|
115 |
-- name: Clone repo and verify an unsigned commit |
|
115 |
+- name: GPG-VERIFICATION | Clone repo and verify an unsigned commit |
|
116 | 116 |
environment: |
117 | 117 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
118 | 118 |
git: |
... | ... |
@@ -123,13 +122,13 @@ |
123 | 123 |
register: git_verify |
124 | 124 |
ignore_errors: yes |
125 | 125 |
|
126 |
-- name: Check that unsigned commit verification failed |
|
126 |
+- name: GPG-VERIFICATION | Check that unsigned commit verification failed |
|
127 | 127 |
assert: |
128 | 128 |
that: |
129 | 129 |
- git_verify|failed |
130 | 130 |
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+") |
131 | 131 |
|
132 |
-- name: Clone repo and verify a signed annotated tag |
|
132 |
+- name: GPG-VERIFICATION | Clone repo and verify a signed annotated tag |
|
133 | 133 |
environment: |
134 | 134 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
135 | 135 |
git: |
... | ... |
@@ -138,7 +137,7 @@ |
138 | 138 |
version: signed_annotated_tag |
139 | 139 |
verify_commit: yes |
140 | 140 |
|
141 |
-- name: Clone repo and verify an unsigned annotated tag (should fail) |
|
141 |
+- name: GPG-VERIFICATION | Clone repo and verify an unsigned annotated tag (should fail) |
|
142 | 142 |
environment: |
143 | 143 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
144 | 144 |
git: |
... | ... |
@@ -149,13 +148,13 @@ |
149 | 149 |
register: git_verify |
150 | 150 |
ignore_errors: yes |
151 | 151 |
|
152 |
-- name: Check that unsigned annotated tag verification failed |
|
152 |
+- name: GPG-VERIFICATION | Check that unsigned annotated tag verification failed |
|
153 | 153 |
assert: |
154 | 154 |
that: |
155 | 155 |
- git_verify|failed |
156 | 156 |
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+") |
157 | 157 |
|
158 |
-- name: Clone repo and verify a signed branch |
|
158 |
+- name: GPG-VERIFICATION | Clone repo and verify a signed branch |
|
159 | 159 |
environment: |
160 | 160 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
161 | 161 |
git: |
... | ... |
@@ -164,7 +163,7 @@ |
164 | 164 |
version: some_branch/signed_tip |
165 | 165 |
verify_commit: yes |
166 | 166 |
|
167 |
-- name: Clone repo and verify an unsigned branch (should fail) |
|
167 |
+- name: GPG-VERIFICATION | Clone repo and verify an unsigned branch (should fail) |
|
168 | 168 |
environment: |
169 | 169 |
- GNUPGHOME: "{{ git_gpg_gpghome }}" |
170 | 170 |
git: |
... | ... |
@@ -175,13 +174,13 @@ |
175 | 175 |
register: git_verify |
176 | 176 |
ignore_errors: yes |
177 | 177 |
|
178 |
-- name: Check that unsigned branch verification failed |
|
178 |
+- name: GPG-VERIFICATION | Check that unsigned branch verification failed |
|
179 | 179 |
assert: |
180 | 180 |
that: |
181 | 181 |
- git_verify|failed |
182 | 182 |
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+") |
183 | 183 |
|
184 |
-- name: Remove GnuPG verification workdir |
|
184 |
+- name: GPG-VERIFICATION | Remove GnuPG verification workdir |
|
185 | 185 |
file: |
186 | 186 |
path: "{{ git_gpg_workdir.path }}" |
187 | 187 |
state: absent |
... | ... |
@@ -1,39 +1,37 @@ |
1 |
- |
|
2 | 1 |
# test for https://github.com/ansible/ansible-modules-core/pull/5505 |
3 |
-- name: prepare old git repo |
|
2 |
+- name: LOCALMODS | prepare old git repo |
|
4 | 3 |
shell: rm -rf localmods; mkdir localmods; cd localmods; git init; echo "1" > a; git add a; git commit -m "1" |
5 | 4 |
args: |
6 | 5 |
chdir: "{{repo_dir}}" |
7 | 6 |
|
8 |
-- name: checkout old repo |
|
7 |
+- name: LOCALMODS | checkout old repo |
|
9 | 8 |
git: |
10 | 9 |
repo: '{{ repo_dir }}/localmods' |
11 | 10 |
dest: '{{ checkout_dir }}' |
12 | 11 |
|
13 |
-- name: "update repo" |
|
12 |
+- name: LOCALMODS | "update repo" |
|
14 | 13 |
shell: echo "2" > a; git commit -a -m "2" |
15 | 14 |
args: |
16 | 15 |
chdir: "{{repo_dir}}/localmods" |
17 | 16 |
|
18 |
-- name: "add local mods" |
|
17 |
+- name: LOCALMODS | "add local mods" |
|
19 | 18 |
shell: echo "3" > a |
20 | 19 |
args: |
21 | 20 |
chdir: "{{ checkout_dir }}" |
22 | 21 |
|
23 |
-- name: fetch with local mods without force (should fail) |
|
22 |
+- name: LOCALMODS | fetch with local mods without force (should fail) |
|
24 | 23 |
git: |
25 | 24 |
repo: '{{ repo_dir }}/localmods' |
26 | 25 |
dest: '{{ checkout_dir }}' |
27 | 26 |
register: git_fetch |
28 | 27 |
ignore_errors: yes |
29 | 28 |
|
30 |
-- name: check fetch with localmods failed |
|
29 |
+- name: LOCALMODS | check fetch with localmods failed |
|
31 | 30 |
assert: |
32 | 31 |
that: |
33 | 32 |
- git_fetch|failed |
34 | 33 |
|
35 |
-- name: fetch with local mods with force |
|
34 |
+- name: LOCALMODS | fetch with local mods with force |
|
36 | 35 |
git: |
37 | 36 |
repo: '{{ repo_dir }}/localmods' |
38 | 37 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -41,38 +39,38 @@ |
41 | 41 |
register: git_fetch_force |
42 | 42 |
ignore_errors: yes |
43 | 43 |
|
44 |
-- name: check update arrived |
|
44 |
+- name: LOCALMODS | check update arrived |
|
45 | 45 |
assert: |
46 | 46 |
that: |
47 | 47 |
- "{{ lookup('file', checkout_dir+'/a' )}} == 2" |
48 | 48 |
- git_fetch_force|changed |
49 | 49 |
|
50 |
-- name: clear checkout_dir |
|
50 |
+- name: LOCALMODS | clear checkout_dir |
|
51 | 51 |
file: state=absent path={{ checkout_dir }} |
52 | 52 |
|
53 | 53 |
# localmods and shallow clone |
54 |
-- name: prepare old git repo |
|
54 |
+- name: LOCALMODS | prepare old git repo |
|
55 | 55 |
shell: rm -rf localmods; mkdir localmods; cd localmods; git init; echo "1" > a; git add a; git commit -m "1" |
56 | 56 |
args: |
57 | 57 |
chdir: "{{repo_dir}}" |
58 | 58 |
|
59 |
-- name: checkout old repo |
|
59 |
+- name: LOCALMODS | checkout old repo |
|
60 | 60 |
git: |
61 | 61 |
repo: '{{ repo_dir }}/localmods' |
62 | 62 |
dest: '{{ checkout_dir }}' |
63 | 63 |
depth: 1 |
64 | 64 |
|
65 |
-- name: "update repo" |
|
65 |
+- name: LOCALMODS | "update repo" |
|
66 | 66 |
shell: echo "2" > a; git commit -a -m "2" |
67 | 67 |
args: |
68 | 68 |
chdir: "{{repo_dir}}/localmods" |
69 | 69 |
|
70 |
-- name: "add local mods" |
|
70 |
+- name: LOCALMODS | "add local mods" |
|
71 | 71 |
shell: echo "3" > a |
72 | 72 |
args: |
73 | 73 |
chdir: "{{ checkout_dir }}" |
74 | 74 |
|
75 |
-- name: fetch with local mods without force (should fail) |
|
75 |
+- name: LOCALMODS | fetch with local mods without force (should fail) |
|
76 | 76 |
git: |
77 | 77 |
repo: '{{ repo_dir }}/localmods' |
78 | 78 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -80,12 +78,12 @@ |
80 | 80 |
register: git_fetch |
81 | 81 |
ignore_errors: yes |
82 | 82 |
|
83 |
-- name: check fetch with localmods failed |
|
83 |
+- name: LOCALMODS | check fetch with localmods failed |
|
84 | 84 |
assert: |
85 | 85 |
that: |
86 | 86 |
- git_fetch|failed |
87 | 87 |
|
88 |
-- name: fetch with local mods with force |
|
88 |
+- name: LOCALMODS | fetch with local mods with force |
|
89 | 89 |
git: |
90 | 90 |
repo: '{{ repo_dir }}/localmods' |
91 | 91 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -94,11 +92,11 @@ |
94 | 94 |
register: git_fetch_force |
95 | 95 |
ignore_errors: yes |
96 | 96 |
|
97 |
-- name: check update arrived |
|
97 |
+- name: LOCALMODS | check update arrived |
|
98 | 98 |
assert: |
99 | 99 |
that: |
100 | 100 |
- "{{ lookup('file', checkout_dir+'/a' )}} == 2" |
101 | 101 |
- git_fetch_force|changed |
102 | 102 |
|
103 |
-- name: clear checkout_dir |
|
103 |
+- name: LOCALMODS | clear checkout_dir |
|
104 | 104 |
file: state=absent path={{ checkout_dir }} |
... | ... |
@@ -16,22 +16,23 @@ |
16 | 16 |
# You should have received a copy of the GNU General Public License |
17 | 17 |
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
|
19 |
-- include: setup.yml |
|
20 |
-- include: setup-local-repos.yml |
|
19 |
+- include_tasks: setup.yml |
|
20 |
+- include_tasks: setup-local-repos.yml |
|
21 | 21 |
|
22 |
-- include: formats.yml |
|
23 |
-- include: missing_hostkey.yml |
|
24 |
-- include: no-destination.yml |
|
25 |
-- include: specific-revision.yml |
|
26 |
-- include: submodules.yml |
|
27 |
-- include: change-repo-url.yml |
|
28 |
-- include: depth.yml |
|
29 |
-- include: checkout-new-tag.yml |
|
30 |
-- include: gpg-verification.yml |
|
31 |
- when: > |
|
32 |
- not gpg_version.stderr and |
|
33 |
- gpg_version.stdout and |
|
34 |
- git_version.stdout | version_compare("2.1.0", '>=') |
|
35 |
-- include: localmods.yml |
|
36 |
-- include: reset-origin.yml |
|
37 |
-- include: ambiguous-ref.yml |
|
22 |
+- include_tasks: formats.yml |
|
23 |
+- include_tasks: missing_hostkey.yml |
|
24 |
+- include_tasks: no-destination.yml |
|
25 |
+- include_tasks: specific-revision.yml |
|
26 |
+- include_tasks: submodules.yml |
|
27 |
+- include_tasks: change-repo-url.yml |
|
28 |
+- include_tasks: depth.yml |
|
29 |
+- include_tasks: checkout-new-tag.yml |
|
30 |
+- include_tasks: gpg-verification.yml |
|
31 |
+ when: |
|
32 |
+ - not gpg_version.stderr |
|
33 |
+ - gpg_version.stdout |
|
34 |
+ - git_version.stdout | version_compare("2.1.0", '>=') |
|
35 |
+- include_tasks: localmods.yml |
|
36 |
+- include_tasks: reset-origin.yml |
|
37 |
+- include_tasks: ambiguous-ref.yml |
|
38 |
+- include_tasks: archive.yml |
... | ... |
@@ -1,6 +1,4 @@ |
1 |
- |
|
2 |
-- name: checkout ssh://git@github.com repo without accept_hostkey (expected fail) |
|
1 |
+- name: MISSING-HOSTKEY | checkout ssh://git@github.com repo without accept_hostkey (expected fail) |
|
3 | 2 |
git: |
4 | 3 |
repo: '{{ repo_format2 }}' |
5 | 4 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -10,9 +8,9 @@ |
10 | 10 |
|
11 | 11 |
- assert: |
12 | 12 |
that: |
13 |
- - 'git_result.failed' |
|
13 |
+ - git_result | failed |
|
14 | 14 |
|
15 |
-- name: checkout git@github.com repo with accept_hostkey (expected pass) |
|
15 |
+- name: MISSING-HOSTKEY | checkout git@github.com repo with accept_hostkey (expected pass) |
|
16 | 16 |
git: |
17 | 17 |
repo: '{{ repo_format2 }}' |
18 | 18 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -24,16 +22,16 @@ |
24 | 24 |
|
25 | 25 |
- assert: |
26 | 26 |
that: |
27 |
- - 'git_result.changed' |
|
27 |
+ - git_result | changed |
|
28 | 28 |
when: github_ssh_private_key is defined |
29 | 29 |
|
30 |
-- name: clear checkout_dir |
|
30 |
+- name: MISSING-HOSTKEY | clear checkout_dir |
|
31 | 31 |
file: |
32 | 32 |
state: absent |
33 | 33 |
path: '{{ checkout_dir }}' |
34 | 34 |
when: github_ssh_private_key is defined |
35 | 35 |
|
36 |
-- name: checkout ssh://git@github.com repo with accept_hostkey (expected pass) |
|
36 |
+- name: MISSING-HOSTKEY | checkout ssh://git@github.com repo with accept_hostkey (expected pass) |
|
37 | 37 |
git: |
38 | 38 |
repo: '{{ repo_format3 }}' |
39 | 39 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -46,5 +44,5 @@ |
46 | 46 |
|
47 | 47 |
- assert: |
48 | 48 |
that: |
49 |
- - 'git_result.changed' |
|
49 |
+ - git_result | changed |
|
50 | 50 |
when: github_ssh_private_key is defined |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
# Test a non-updating repo query with no destination specified |
2 | 2 |
|
3 |
-- name: get info on a repo without updating and with no destination specified |
|
3 |
+- name: NO-DESTINATION | get info on a repo without updating and with no destination specified |
|
4 | 4 |
git: |
5 | 5 |
repo: '{{ repo_dir }}/minimal' |
6 | 6 |
update: no |
... | ... |
@@ -11,4 +10,4 @@ |
11 | 11 |
|
12 | 12 |
- assert: |
13 | 13 |
that: |
14 |
- - 'git_result.changed' |
|
14 |
+ - git_result | changed |
... | ... |
@@ -1,6 +1,4 @@ |
1 |
- |
|
2 |
-- name: Clean up the directories |
|
1 |
+- name: RESET-ORIGIN | Clean up the directories |
|
3 | 2 |
file: |
4 | 3 |
state: absent |
5 | 4 |
path: "{{ item }}" |
... | ... |
@@ -8,17 +6,17 @@ |
8 | 8 |
- "{{ repo_dir }}/origin" |
9 | 9 |
- "{{ checkout_dir }}" |
10 | 10 |
|
11 |
-- name: Create a directory |
|
11 |
+- name: RESET-ORIGIN | Create a directory |
|
12 | 12 |
file: |
13 | 13 |
name: "{{ repo_dir }}/origin" |
14 | 14 |
state: directory |
15 | 15 |
|
16 |
-- name: Initialise the repo with a file named origin,see github.com/ansible/ansible/pull/22502 |
|
16 |
+- name: RESET-ORIGIN | Initialise the repo with a file named origin,see github.com/ansible/ansible/pull/22502 |
|
17 | 17 |
shell: git init; echo "PR 22502" > origin; git add origin; git commit -m "PR 22502" |
18 | 18 |
args: |
19 | 19 |
chdir: "{{ repo_dir }}/origin" |
20 | 20 |
|
21 |
-- name: Clone a git repo with file named origin |
|
21 |
+- name: RESET-ORIGIN | Clone a git repo with file named origin |
|
22 | 22 |
git: |
23 | 23 |
repo: "{{ repo_dir }}/origin" |
24 | 24 |
dest: "{{ checkout_dir }}" |
... | ... |
@@ -1,28 +1,26 @@ |
1 |
- |
|
2 |
-- name: create dirs |
|
1 |
+- name: SETUP-LOCAL-REPOS | create dirs |
|
3 | 2 |
file: |
4 |
- name: "{{item}}" |
|
3 |
+ name: "{{ item }}" |
|
5 | 4 |
state: directory |
6 | 5 |
with_items: |
7 |
- - "{{repo_dir}}/minimal" |
|
8 |
- - "{{repo_dir}}/shallow" |
|
6 |
+ - "{{ repo_dir }}/minimal" |
|
7 |
+ - "{{ repo_dir }}/shallow" |
|
9 | 8 |
|
10 |
-- name: prepare minimal git repo |
|
9 |
+- name: SETUP-LOCAL-REPOS | prepare minimal git repo |
|
11 | 10 |
shell: git init; echo "1" > a; git add a; git commit -m "1" |
12 | 11 |
args: |
13 |
- chdir: "{{repo_dir}}/minimal" |
|
12 |
+ chdir: "{{ repo_dir }}/minimal" |
|
14 | 13 |
|
15 |
-- name: prepare git repo for shallow clone |
|
14 |
+- name: SETUP-LOCAL-REPOS | prepare git repo for shallow clone |
|
16 | 15 |
shell: | |
17 | 16 |
git init; |
18 | 17 |
echo "1" > a; git add a; git commit -m "1"; git tag earlytag; git branch earlybranch; |
19 | 18 |
echo "2" > a; git add a; git commit -m "2"; |
20 | 19 |
args: |
21 |
- chdir: "{{repo_dir}}/shallow" |
|
20 |
+ chdir: "{{ repo_dir }}/shallow" |
|
22 | 21 |
|
23 |
-- name: set old hash var for shallow test |
|
22 |
+- name: SETUP-LOCAL-REPOS | set old hash var for shallow test |
|
24 | 23 |
command: 'git rev-parse HEAD~1' |
25 | 24 |
register: git_shallow_head_1 |
26 | 25 |
args: |
27 |
- chdir: "{{repo_dir}}/shallow" |
|
26 |
+ chdir: "{{ repo_dir }}/shallow" |
... | ... |
@@ -1,31 +1,31 @@ |
1 |
- |
|
2 |
-- name: clean out the output_dir |
|
1 |
+- name: SETUP | clean out the output_dir |
|
3 | 2 |
file: |
4 | 3 |
path: "{{ output_dir }}" |
5 | 4 |
state: absent |
6 | 5 |
|
7 |
-- name: create clean output_dir |
|
6 |
+- name: SETUP | create clean output_dir |
|
8 | 7 |
file: |
9 | 8 |
path: "{{ output_dir }}" |
10 | 9 |
state: directory |
11 | 10 |
|
12 |
-- name: verify that git is installed so this test can continue |
|
11 |
+- name: SETUP | verify that git is installed so this test can continue |
|
13 | 12 |
shell: which git |
14 | 13 |
|
15 |
-- name: get git version, only newer than {{git_version_supporting_depth}} has fixed git depth |
|
14 |
+- name: SETUP | get git version, only newer than {{git_version_supporting_depth}} has fixed git depth |
|
16 | 15 |
shell: git --version | grep 'git version' | sed 's/git version //' |
17 | 16 |
register: git_version |
18 | 17 |
|
19 |
-- name: get gpg version |
|
18 |
+- name: SETUP | get gpg version |
|
20 | 19 |
shell: gpg --version 2>1 | head -1 | sed -e 's/gpg (GnuPG) //' |
21 | 20 |
register: gpg_version |
22 | 21 |
|
23 |
-- name: set git global user.email if not already set |
|
22 |
+- name: SETUP | set git global user.email if not already set |
|
24 | 23 |
shell: git config --global user.email || git config --global user.email "noreply@example.com" |
25 | 24 |
|
26 |
-- name: set git global user.name if not already set |
|
25 |
+- name: SETUP | set git global user.name if not already set |
|
27 | 26 |
shell: git config --global user.name || git config --global user.name "Ansible Test Runner" |
28 | 27 |
|
29 |
-- name: create repo_dir |
|
30 |
- file: path={{repo_dir}} state=directory |
|
28 |
+- name: SETUP | create repo_dir |
|
29 |
+ file: |
|
30 |
+ path: "{{ repo_dir }}" |
|
31 |
+ state: directory |
... | ... |
@@ -1,19 +1,17 @@ |
1 |
- |
|
2 | 1 |
# Test that a specific revision can be checked out |
3 | 2 |
|
4 |
-- name: clear checkout_dir |
|
3 |
+- name: SPECIFIC-REVISION | clear checkout_dir |
|
5 | 4 |
file: |
6 | 5 |
state: absent |
7 | 6 |
path: '{{ checkout_dir }}' |
8 | 7 |
|
9 |
-- name: clone to specific revision |
|
8 |
+- name: SPECIFIC-REVISION | clone to specific revision |
|
10 | 9 |
git: |
11 | 10 |
repo: "{{ repo_dir }}/format1" |
12 | 11 |
dest: "{{ checkout_dir }}" |
13 | 12 |
version: df4612ba925fbc1b3c51cbb006f51a0443bd2ce9 |
14 | 13 |
|
15 |
-- name: check HEAD after clone to revision |
|
14 |
+- name: SPECIFIC-REVISION | check HEAD after clone to revision |
|
16 | 15 |
command: git rev-parse HEAD |
17 | 16 |
args: |
18 | 17 |
chdir: "{{ checkout_dir }}" |
... | ... |
@@ -23,7 +21,7 @@ |
23 | 23 |
that: |
24 | 24 |
- 'git_result.stdout == "df4612ba925fbc1b3c51cbb006f51a0443bd2ce9"' |
25 | 25 |
|
26 |
-- name: update to specific revision |
|
26 |
+- name: SPECIFIC-REVISION | update to specific revision |
|
27 | 27 |
git: |
28 | 28 |
repo: "{{ repo_dir }}/format1" |
29 | 29 |
dest: "{{ checkout_dir }}" |
... | ... |
@@ -32,9 +30,9 @@ |
32 | 32 |
|
33 | 33 |
- assert: |
34 | 34 |
that: |
35 |
- - 'git_result.changed' |
|
35 |
+ - git_result | changed |
|
36 | 36 |
|
37 |
-- name: check HEAD after update to revision |
|
37 |
+- name: SPECIFIC-REVISION | check HEAD after update to revision |
|
38 | 38 |
command: git rev-parse HEAD |
39 | 39 |
args: |
40 | 40 |
chdir: "{{ checkout_dir }}" |
... | ... |
@@ -46,7 +44,7 @@ |
46 | 46 |
|
47 | 47 |
# Test a revision not available under refs/heads/ or refs/tags/ |
48 | 48 |
|
49 |
-- name: attempt to get unavailable revision |
|
49 |
+- name: SPECIFIC-REVISION | attempt to get unavailable revision |
|
50 | 50 |
git: |
51 | 51 |
repo: "{{ repo_dir }}/format1" |
52 | 52 |
dest: "{{ checkout_dir }}" |
... | ... |
@@ -56,18 +54,18 @@ |
56 | 56 |
|
57 | 57 |
- assert: |
58 | 58 |
that: |
59 |
- - 'git_result.failed' |
|
59 |
+ - git_result | failed |
|
60 | 60 |
|
61 | 61 |
# Same as the previous test, but this time we specify which ref |
62 | 62 |
# contains the SHA1 |
63 |
-- name: update to revision by specifying the refspec |
|
63 |
+- name: SPECIFIC-REVISION | update to revision by specifying the refspec |
|
64 | 64 |
git: |
65 | 65 |
repo: https://github.com/ansible/ansible-examples.git |
66 | 66 |
dest: '{{ checkout_dir }}' |
67 | 67 |
version: 5473e343e33255f2da0b160f53135c56921d875c |
68 | 68 |
refspec: refs/pull/7/merge |
69 | 69 |
|
70 |
-- name: check HEAD after update with refspec |
|
70 |
+- name: SPECIFIC-REVISION | check HEAD after update with refspec |
|
71 | 71 |
command: git rev-parse HEAD |
72 | 72 |
args: |
73 | 73 |
chdir: "{{ checkout_dir }}" |
... | ... |
@@ -78,12 +76,12 @@ |
78 | 78 |
- 'git_result.stdout == "5473e343e33255f2da0b160f53135c56921d875c"' |
79 | 79 |
|
80 | 80 |
# try out combination of refspec and depth |
81 |
-- name: clear checkout_dir |
|
81 |
+- name: SPECIFIC-REVISION | clear checkout_dir |
|
82 | 82 |
file: |
83 | 83 |
state: absent |
84 |
- path: '{{ checkout_dir }}' |
|
84 |
+ path: "{{ checkout_dir }}" |
|
85 | 85 |
|
86 |
-- name: update to revision by specifying the refspec with depth=1 |
|
86 |
+- name: SPECIFIC-REVISION | update to revision by specifying the refspec with depth=1 |
|
87 | 87 |
git: |
88 | 88 |
repo: https://github.com/ansible/ansible-examples.git |
89 | 89 |
dest: '{{ checkout_dir }}' |
... | ... |
@@ -91,7 +89,7 @@ |
91 | 91 |
refspec: refs/pull/7/merge |
92 | 92 |
depth: 1 |
93 | 93 |
|
94 |
-- name: check HEAD after update with refspec |
|
94 |
+- name: SPECIFIC-REVISION | check HEAD after update with refspec |
|
95 | 95 |
command: git rev-parse HEAD |
96 | 96 |
args: |
97 | 97 |
chdir: "{{ checkout_dir }}" |
... | ... |
@@ -101,33 +99,33 @@ |
101 | 101 |
that: |
102 | 102 |
- 'git_result.stdout == "5473e343e33255f2da0b160f53135c56921d875c"' |
103 | 103 |
|
104 |
-- name: try to access other commit |
|
104 |
+- name: SPECIFIC-REVISION | try to access other commit |
|
105 | 105 |
shell: git checkout 0ce1096 |
106 | 106 |
register: checkout_shallow |
107 | 107 |
failed_when: False |
108 | 108 |
args: |
109 |
- chdir: '{{ checkout_dir }}' |
|
109 |
+ chdir: "{{ checkout_dir }}" |
|
110 | 110 |
|
111 |
-- name: "make sure the old commit was not fetched, task is 'forced success'" |
|
111 |
+- name: SPECIFIC-REVISION | "make sure the old commit was not fetched, task is 'forced success'" |
|
112 | 112 |
assert: |
113 | 113 |
that: |
114 |
- - 'checkout_shallow.rc != 0' |
|
115 |
- - checkout_shallow|success |
|
116 |
- when: git_version.stdout | version_compare("{{git_version_supporting_depth}}", '>=') |
|
114 |
+ - checkout_shallow.rc != 0 |
|
115 |
+ - checkout_shallow | success |
|
116 |
+ when: git_version.stdout | version_compare(git_version_supporting_depth, '>=') |
|
117 | 117 |
|
118 |
-- name: clear checkout_dir |
|
118 |
+- name: SPECIFIC-REVISION | clear checkout_dir |
|
119 | 119 |
file: |
120 | 120 |
state: absent |
121 |
- path: '{{ checkout_dir }}' |
|
121 |
+ path: "{{ checkout_dir }}" |
|
122 | 122 |
|
123 |
-- name: clone to revision by specifying the refspec |
|
123 |
+- name: SPECIFIC-REVISION | clone to revision by specifying the refspec |
|
124 | 124 |
git: |
125 | 125 |
repo: https://github.com/ansible/ansible-examples.git |
126 |
- dest: '{{ checkout_dir }}' |
|
126 |
+ dest: "{{ checkout_dir }}" |
|
127 | 127 |
version: 5473e343e33255f2da0b160f53135c56921d875c |
128 | 128 |
refspec: refs/pull/7/merge |
129 | 129 |
|
130 |
-- name: check HEAD after update with refspec |
|
130 |
+- name: SPECIFIC-REVISION | check HEAD after update with refspec |
|
131 | 131 |
command: git rev-parse HEAD |
132 | 132 |
args: |
133 | 133 |
chdir: "{{ checkout_dir }}" |
... | ... |
@@ -139,76 +137,91 @@ |
139 | 139 |
|
140 | 140 |
# Test that a forced shallow checkout referincing branch only always fetches latest head |
141 | 141 |
|
142 |
-- name: clear checkout_dir |
|
143 |
- file: state=absent path={{ item }} |
|
142 |
+- name: SPECIFIC-REVISION | clear checkout_dir |
|
143 |
+ file: |
|
144 |
+ state: absent |
|
145 |
+ path: "{{ item }}" |
|
144 | 146 |
with_items: |
145 | 147 |
- "{{ checkout_dir }}" |
146 | 148 |
- "{{ checkout_dir }}.copy" |
147 | 149 |
|
148 |
-- name: create original repo dir |
|
149 |
- file: state=directory path="{{checkout_dir}}" |
|
150 |
+- name: SPECIFIC-REVISION | create original repo dir |
|
151 |
+ file: |
|
152 |
+ state: directory |
|
153 |
+ path: "{{ checkout_dir }}" |
|
150 | 154 |
|
151 |
-- name: prepare origina repo |
|
155 |
+- name: SPECIFIC-REVISION | prepare origina repo |
|
152 | 156 |
shell: git init; echo "1" > a; git add a; git commit -m "1" |
153 | 157 |
args: |
154 |
- chdir: "{{checkout_dir}}" |
|
158 |
+ chdir: "{{ checkout_dir }}" |
|
155 | 159 |
|
156 |
-- name: clone example repo locally |
|
157 |
- git: |
|
160 |
+- name: SPECIFIC-REVISION | clone example repo locally |
|
161 |
+ git: |
|
158 | 162 |
repo: "{{ checkout_dir }}" |
159 |
- dest: "{{checkout_dir}}.copy" |
|
163 |
+ dest: "{{ checkout_dir }}.copy" |
|
160 | 164 |
|
161 |
-- name: create branch in original |
|
162 |
- command: git checkout -b test/branch chdir="{{checkout_dir}}" |
|
165 |
+- name: SPECIFIC-REVISION | create branch in original |
|
166 |
+ command: git checkout -b test/branch |
|
167 |
+ args: |
|
168 |
+ chdir: "{{ checkout_dir }}" |
|
163 | 169 |
|
164 |
-- name: get commit for HEAD on new branch |
|
165 |
- command: git rev-parse HEAD chdir="{{checkout_dir}}.copy" |
|
170 |
+- name: SPECIFIC-REVISION | get commit for HEAD on new branch |
|
171 |
+ command: git rev-parse HEAD |
|
172 |
+ args: |
|
173 |
+ chdir: "{{ checkout_dir }}.copy" |
|
166 | 174 |
register: originaltip0 |
167 | 175 |
|
168 |
-- name: shallow force checkout new branch in copy |
|
169 |
- git: |
|
170 |
- repo: "{{checkout_dir}}" |
|
171 |
- dest: "{{checkout_dir}}.copy" |
|
172 |
- version: test/branch |
|
173 |
- depth: 1 |
|
176 |
+- name: SPECIFIC-REVISION | shallow force checkout new branch in copy |
|
177 |
+ git: |
|
178 |
+ repo: "{{ checkout_dir }}" |
|
179 |
+ dest: "{{ checkout_dir }}.copy" |
|
180 |
+ version: test/branch |
|
181 |
+ depth: 1 |
|
174 | 182 |
force: yes |
175 | 183 |
|
176 |
-- name: create new commit in original |
|
184 |
+- name: SPECIFIC-REVISION | create new commit in original |
|
177 | 185 |
shell: git init; echo "2" > b; git add b; git commit -m "2" |
178 | 186 |
args: |
179 |
- chdir: "{{checkout_dir}}" |
|
187 |
+ chdir: "{{ checkout_dir }}" |
|
180 | 188 |
|
181 |
-- name: get commit for new HEAD on original branch |
|
182 |
- command: git rev-parse HEAD chdir="{{checkout_dir}}" |
|
189 |
+- name: SPECIFIC-REVISION | get commit for new HEAD on original branch |
|
190 |
+ command: git rev-parse HEAD |
|
191 |
+ args: |
|
192 |
+ chdir: "{{ checkout_dir }}" |
|
183 | 193 |
register: originaltip1 |
184 | 194 |
|
185 |
-- name: get commit for HEAD on new branch |
|
186 |
- command: git rev-parse HEAD chdir="{{checkout_dir}}.copy" |
|
195 |
+- name: SPECIFIC-REVISION | get commit for HEAD on new branch |
|
196 |
+ command: git rev-parse HEAD |
|
197 |
+ args: |
|
198 |
+ chdir: "{{ checkout_dir }}.copy" |
|
187 | 199 |
register: newtip |
188 | 200 |
|
189 |
-- name: assert that copy is still pointing at previous tip |
|
201 |
+- name: SPECIFIC-REVISION | assert that copy is still pointing at previous tip |
|
190 | 202 |
assert: |
191 | 203 |
that: |
192 |
- - "newtip.stdout == originaltip0.stdout" |
|
204 |
+ - newtip.stdout == originaltip0.stdout |
|
193 | 205 |
|
194 |
-- name: create a local modification in the copy |
|
206 |
+- name: SPECIFIC-REVISION | create a local modification in the copy |
|
195 | 207 |
shell: echo "3" > c |
196 | 208 |
args: |
197 | 209 |
chdir: "{{ checkout_dir }}.copy" |
198 | 210 |
|
199 |
-- name: shallow force checkout new branch in copy (again) |
|
200 |
- git: |
|
201 |
- repo: "{{checkout_dir}}" |
|
202 |
- dest: "{{checkout_dir}}.copy" |
|
211 |
+- name: SPECIFIC-REVISION | shallow force checkout new branch in copy (again) |
|
212 |
+ git: |
|
213 |
+ repo: "{{ checkout_dir }}" |
|
214 |
+ dest: "{{ checkout_dir }}.copy" |
|
203 | 215 |
version: test/branch |
204 |
- depth: 1 |
|
216 |
+ depth: 1 |
|
205 | 217 |
force: yes |
206 | 218 |
|
207 |
-- name: get commit for HEAD on new branch |
|
208 |
- command: git rev-parse HEAD chdir="{{checkout_dir}}.copy" |
|
219 |
+- name: SPECIFIC-REVISION | get commit for HEAD on new branch |
|
220 |
+ command: git rev-parse HEAD |
|
221 |
+ args: |
|
222 |
+ chdir: "{{ checkout_dir }}.copy" |
|
209 | 223 |
register: newtip |
210 | 224 |
|
211 |
-- name: make sure copy tip is not pointing at previous sha and that new tips match |
|
225 |
+- name: SPECIFIC-REVISION | make sure copy tip is not pointing at previous sha and that new tips match |
|
212 | 226 |
assert: |
213 | 227 |
that: |
214 |
- - "newtip.stdout != originaltip0.stdout and newtip.stdout == originaltip1.stdout" |
|
228 |
+ - newtip.stdout != originaltip0.stdout |
|
229 |
+ - newtip.stdout == originaltip1.stdout |
... | ... |
@@ -1,5 +1,3 @@ |
1 |
- |
|
2 | 1 |
# |
3 | 2 |
# Submodule tests |
4 | 3 |
# |
... | ... |
@@ -16,50 +14,54 @@ |
16 | 16 |
# Repository III for a second submodule (repo_submodule2) |
17 | 17 |
# Has 1 file checked in |
18 | 18 |
|
19 |
-- name: clear checkout_dir |
|
20 |
- file: state=absent path={{ checkout_dir }} |
|
19 |
+- name: SUBMODULES | clear checkout_dir |
|
20 |
+ file: |
|
21 |
+ state: absent |
|
22 |
+ path: "{{ checkout_dir }}" |
|
21 | 23 |
|
22 |
-- name: Test that clone without recursive does not retrieve submodules |
|
24 |
+- name: SUBMODULES | Test that clone without recursive does not retrieve submodules |
|
23 | 25 |
git: |
24 |
- repo: '{{ repo_submodules }}' |
|
25 |
- dest: '{{ checkout_dir }}' |
|
26 |
+ repo: "{{ repo_submodules }}" |
|
27 |
+ dest: "{{ checkout_dir }}" |
|
26 | 28 |
recursive: no |
27 | 29 |
|
28 | 30 |
- command: 'ls -1a {{ checkout_dir }}/submodule1' |
29 | 31 |
register: submodule1 |
30 | 32 |
|
31 | 33 |
- assert: |
32 |
- that: '{{ submodule1.stdout_lines|length }} == 2' |
|
34 |
+ that: '{{ submodule1.stdout_lines | length }} == 2' |
|
33 | 35 |
|
34 |
-- name: clear checkout_dir |
|
35 |
- file: state=absent path={{ checkout_dir }} |
|
36 |
+- name: SUBMODULES | clear checkout_dir |
|
37 |
+ file: |
|
38 |
+ state: absent |
|
39 |
+ path: "{{ checkout_dir }}" |
|
36 | 40 |
|
37 | 41 |
|
38 |
-- name: Test that clone with recursive retrieves submodules |
|
42 |
+- name: SUBMODULES | Test that clone with recursive retrieves submodules |
|
39 | 43 |
git: |
40 |
- repo: '{{ repo_submodules }}' |
|
41 |
- dest: '{{ checkout_dir }}' |
|
44 |
+ repo: "{{ repo_submodules }}" |
|
45 |
+ dest: "{{ checkout_dir }}" |
|
42 | 46 |
recursive: yes |
43 | 47 |
|
44 | 48 |
- command: 'ls -1a {{ checkout_dir }}/submodule1' |
45 | 49 |
register: submodule1 |
46 | 50 |
|
47 | 51 |
- assert: |
48 |
- that: '{{ submodule1.stdout_lines|length }} == 4' |
|
52 |
+ that: '{{ submodule1.stdout_lines | length }} == 4' |
|
49 | 53 |
|
50 |
-- name: Copy the checkout so we can run several different tests on it |
|
54 |
+- name: SUBMODULES | Copy the checkout so we can run several different tests on it |
|
51 | 55 |
command: 'cp -pr {{ checkout_dir }} {{ checkout_dir }}.bak' |
52 | 56 |
|
53 | 57 |
|
54 | 58 |
|
55 |
-- name: Test that update without recursive does not change submodules |
|
59 |
+- name: SUBMODULES | Test that update without recursive does not change submodules |
|
56 | 60 |
command: 'git config --replace-all remote.origin.url {{ repo_submodules_newer }}' |
57 | 61 |
args: |
58 | 62 |
chdir: '{{ checkout_dir }}' |
59 | 63 |
|
60 | 64 |
- git: |
61 |
- repo: '{{ repo_submodules_newer }}' |
|
62 |
- dest: '{{ checkout_dir }}' |
|
65 |
+ repo: "{{ repo_submodules_newer }}" |
|
66 |
+ dest: "{{ checkout_dir }}" |
|
63 | 67 |
recursive: no |
64 | 68 |
update: yes |
65 | 69 |
track_submodules: yes |
... | ... |
@@ -68,31 +70,33 @@ |
68 | 68 |
register: submodule1 |
69 | 69 |
|
70 | 70 |
- stat: |
71 |
- path: '{{ checkout_dir }}/submodule2' |
|
71 |
+ path: "{{ checkout_dir }}/submodule2" |
|
72 | 72 |
register: submodule2 |
73 | 73 |
|
74 |
-- command: 'ls -1a {{ checkout_dir }}/submodule2' |
|
74 |
+- command: ls -1a {{ checkout_dir }}/submodule2 |
|
75 | 75 |
register: submodule2 |
76 | 76 |
|
77 | 77 |
- assert: |
78 | 78 |
that: '{{ submodule1.stdout_lines|length }} == 4' |
79 |
+ |
|
79 | 80 |
- assert: |
80 | 81 |
that: '{{ submodule2.stdout_lines|length }} == 2' |
81 | 82 |
|
82 | 83 |
|
83 |
- |
|
84 |
-- name: Restore checkout to prior state |
|
85 |
- file: state=absent path={{ checkout_dir }} |
|
84 |
+- name: SUBMODULES | Restore checkout to prior state |
|
85 |
+ file: |
|
86 |
+ state: absent |
|
87 |
+ path: "{{ checkout_dir }}" |
|
86 | 88 |
- command: 'cp -pr {{ checkout_dir }}.bak {{ checkout_dir }}' |
87 | 89 |
|
88 |
-- name: Test that update with recursive updated existing submodules |
|
90 |
+- name: SUBMODULES | Test that update with recursive updated existing submodules |
|
89 | 91 |
command: 'git config --replace-all remote.origin.url {{ repo_submodules_newer }}' |
90 | 92 |
args: |
91 |
- chdir: '{{ checkout_dir }}' |
|
93 |
+ chdir: "{{ checkout_dir }}" |
|
92 | 94 |
|
93 | 95 |
- git: |
94 |
- repo: '{{ repo_submodules_newer }}' |
|
95 |
- dest: '{{ checkout_dir }}' |
|
96 |
+ repo: "{{ repo_submodules_newer }}" |
|
97 |
+ dest: "{{ checkout_dir }}" |
|
96 | 98 |
update: yes |
97 | 99 |
recursive: yes |
98 | 100 |
track_submodules: yes |
... | ... |
@@ -104,7 +108,7 @@ |
104 | 104 |
that: '{{ submodule1.stdout_lines|length }} == 5' |
105 | 105 |
|
106 | 106 |
|
107 |
-- name: Test that update with recursive found new submodules |
|
107 |
+- name: SUBMODULES | Test that update with recursive found new submodules |
|
108 | 108 |
command: 'ls -1a {{ checkout_dir }}/submodule2' |
109 | 109 |
register: submodule2 |
110 | 110 |
|
... | ... |
@@ -1,4 +1,13 @@ |
1 |
+git_archive_extensions: |
|
2 |
+ default: |
|
3 |
+ - tar.gz |
|
4 |
+ - tar |
|
5 |
+ - tgz |
|
6 |
+ - zip |
|
7 |
+ RedHat6: |
|
8 |
+ - tar |
|
9 |
+ - zip |
|
10 |
+ |
|
1 | 11 |
|
2 | 12 |
checkout_dir: '{{ output_dir }}/git' |
3 | 13 |
repo_dir: '{{ output_dir }}/local_repos' |
... | ... |
@@ -21,7 +30,7 @@ git_version_supporting_ls_remote: 1.7.5 |
21 | 21 |
# github_ssh_private_key: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa" |
22 | 22 |
git_gpg_testkey: | |
23 | 23 |
-----BEGIN PGP PRIVATE KEY BLOCK----- |
24 |
- |
|
24 |
+ |
|
25 | 25 |
lQOYBFlkmX0BCACtE81Xj/351nnvwnAWMf8ZUP9B1YOPe9ohqNsCQY1DxODVJc9y |
26 | 26 |
ljCoh9fTdoHXuaUMUFistozxCMP81RuZxfbfsGePnl8OAOgWT5Sln6yEG45oClJ0 |
27 | 27 |
RmJJZdDT1lF3VaVwK9NQ5E1oqmk1IOjISi7iFa9TmMn1h7ISP/p+/xtMxQhzUXt8 |
... | ... |
@@ -52,7 +61,7 @@ git_gpg_testkey: | |
52 | 52 |
=tV71 |
53 | 53 |
-----END PGP PRIVATE KEY BLOCK----- |
54 | 54 |
-----BEGIN PGP PUBLIC KEY BLOCK----- |
55 |
- |
|
55 |
+ |
|
56 | 56 |
mQENBFlkmX0BCACtE81Xj/351nnvwnAWMf8ZUP9B1YOPe9ohqNsCQY1DxODVJc9y |
57 | 57 |
ljCoh9fTdoHXuaUMUFistozxCMP81RuZxfbfsGePnl8OAOgWT5Sln6yEG45oClJ0 |
58 | 58 |
RmJJZdDT1lF3VaVwK9NQ5E1oqmk1IOjISi7iFa9TmMn1h7ISP/p+/xtMxQhzUXt8 |