Debian Codegraph @

test/integration/targets/ansible-galaxy-collection-scm/tasks/setup_multi_collection_repo.yml

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