blob: e733a8459a44f220ecbf3b7d36812490200d72fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
- name: Initialize a git repo
command: 'git init {{ test_repo_path }}'
- stat:
path: "{{ test_repo_path }}"
- name: Add a couple collections to the repository
command: 'ansible-galaxy collection init {{ item }}'
args:
chdir: '{{ scm_path }}'
loop:
- 'ansible_test.collection_1'
- 'ansible_test.collection_2'
- name: Preserve the (empty) docs directory for the SCM collection
file:
path: '{{ test_repo_path }}/{{ item }}/docs/README.md'
state: touch
loop:
- collection_1
- collection_2
- name: Preserve the (empty) roles directory for the SCM collection
file:
path: '{{ test_repo_path }}/{{ item }}/roles/README.md'
state: touch
loop:
- collection_1
- collection_2
- name: create extra files and folders to test build_ignore
file:
path: '{{ test_repo_path }}/collection_1/{{ item.name }}'
state: '{{ item.state }}'
loop:
- name: foo.txt
state: touch
- name: foobar
state: directory
- name: foobar/qux
state: directory
- name: foobar/qux/bar
state: touch
- name: foobar/baz.txt
state: touch
- name: Add collection_2 as a dependency of collection_1
lineinfile:
path: '{{ test_repo_path }}/collection_1/galaxy.yml'
regexp: '^dependencies'
line: "dependencies: {'git+file://{{ test_repo_path }}/.git#collection_2/': '*'}"
- name: Ignore a directory and files
lineinfile:
path: '{{ test_repo_path }}/collection_1/galaxy.yml'
regexp: '^build_ignore'
line: "build_ignore: ['foo.txt', 'foobar/*']"
- name: Commit the changes
command: '{{ item }}'
args:
chdir: '{{ test_repo_path }}'
loop:
- git add ./
- git commit -m 'add collections'
- name: Build the actual artifact for ansible_test.collection_1 for comparison
command: "ansible-galaxy collection build ansible_test/collection_1 --output-path {{ galaxy_dir }}"
args:
chdir: "{{ scm_path }}"
|