Debian Codegraph @

test/integration/targets/ansible-galaxy-collection/tasks/virtual_direct_requests.yml

raw
1 - environment:
2 ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
3 vars:
4 scm_path: "{{ galaxy_dir }}/scms"
5 metadata:
6 collection1: |-
7 name: collection1
8 version: "1.0.0"
9 dependencies:
10 test_prereleases.collection2: '*'
11 collection2: |
12 name: collection2
13 version: "1.0.0-dev0"
14 dependencies: {}
15 namespace_boilerplate: |-
16 namespace: test_prereleases
17 readme: README.md
18 authors:
19 - "ansible-core"
20 description: test prerelease priority with virtual collections
21 license:
22 - GPL-2.0-or-later
23 license_file: ''
24 tags: []
25 repository: https://github.com/ansible/ansible
26 documentation: https://github.com/ansible/ansible
27 homepage: https://github.com/ansible/ansible
28 issues: https://github.com/ansible/ansible
29 build_ignore: []
30 block:
31 - name: Initialize git repository
32 command: 'git init {{ scm_path }}/test_prereleases'
33
34 - name: Configure committer for the repo
35 shell: git config user.email [email protected] && git config user.name ansible-test
36 args:
37 chdir: "{{ scm_path }}/test_prereleases"
38
39 - name: Add collections to the repo
40 file:
41 path: "{{ scm_path }}/test_prereleases/{{ item }}"
42 state: directory
43 loop:
44 - collection1
45 - collection2
46
47 - name: Add collection metadata
48 copy:
49 dest: "{{ scm_path }}/test_prereleases/{{ item }}/galaxy.yml"
50 content: "{{ metadata[item] + '\n' + metadata['namespace_boilerplate'] }}"
51 loop:
52 - collection1
53 - collection2
54
55 - name: Save the changes
56 shell: git add . && git commit -m "Add collections to test installing a git repo directly takes priority over indirect Galaxy dep"
57 args:
58 chdir: '{{ scm_path }}/test_prereleases'
59
60 - name: Validate the dependency also exists on Galaxy before test
61 command: "ansible-galaxy collection install test_prereleases.collection2"
62 register: prereq
63 failed_when: '"test_prereleases.collection2:1.0.0 was installed successfully" not in prereq.stdout'
64
65 - name: Install collections from source
66 command: "ansible-galaxy collection install git+file://{{ scm_path }}/test_prereleases"
67 register: prioritize_direct_req
68
69 - assert:
70 that:
71 - '"test_prereleases.collection2:1.0.0-dev0 was installed successfully" in prioritize_direct_req.stdout'
72
73 always:
74 - name: Clean up test repos
75 file:
76 path: "{{ scm_path }}"
77 state: absent