Debian Codegraph @

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

raw
1 - name: Initialize git repositories
2 command: 'git init {{ scm_path }}/{{ item }}'
3 loop:
4 - namespace_1
5 - namespace_2
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 - 'namespace_1.collection_1'
13 - 'namespace_2.collection_2'
14
15 - name: Add collection_2 as a dependency of collection_1
16 lineinfile:
17 path: '{{ scm_path }}/namespace_1/collection_1/galaxy.yml'
18 regexp: '^dependencies'
19 line: "dependencies: {'git+file://{{ scm_path }}/namespace_2/.git#collection_2/': '*'}"
20
21 - name: Add collection_1 as a dependency on collection_2
22 lineinfile:
23 path: '{{ scm_path }}/namespace_2/collection_2/galaxy.yml'
24 regexp: '^dependencies'
25 # NOTE: The committish is set to `HEAD` here because Git's default has
26 # NOTE: changed to `main` and it behaves differently in
27 # NOTE: different envs with different Git versions.
28 line: >-
29 dependencies:
30 {'git+file://{{ scm_path }}/namespace_1/.git#collection_1/': 'HEAD'}
31
32 - name: Commit the changes
33 shell: git add ./; git commit -m 'add collection'
34 args:
35 chdir: '{{ scm_path }}/{{ item }}'
36 loop:
37 - namespace_1
38 - namespace_2