mirror of https://github.com/ansible/ansible.git
Fix build_ignore when installing a collection from source (#75547)
* Make individual dirs that should exist instead of using shutil.copytree * Test build_ignore when installing collections in git repos * changelog * Fix assertion Fix git directory * Fix nested content while building the collection dir Test installing a collection from a git repo and artifact have the same result Refactor to use variablespull/75680/head
parent
d6dededab8
commit
f38a97cece
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-galaxy - Fix a bug with build_ignore when installing collections from source (https://github.com/ansible/ansible/issues/75528).
|
@ -1,7 +1,7 @@
|
||||
- name: delete installed collections
|
||||
file:
|
||||
state: "{{ item }}"
|
||||
path: "{{ galaxy_dir }}/ansible_collections"
|
||||
state: absent
|
||||
path: "{{ item }}"
|
||||
loop:
|
||||
- absent
|
||||
- directory
|
||||
- "{{ install_path }}"
|
||||
- "{{ alt_install_path }}"
|
||||
|
@ -1,27 +1,70 @@
|
||||
- name: Initialize a git repo
|
||||
command: 'git init {{ galaxy_dir }}/development/ansible_test'
|
||||
command: 'git init {{ test_repo_path }}'
|
||||
|
||||
- stat:
|
||||
path: "{{ galaxy_dir }}/development/ansible_test"
|
||||
path: "{{ test_repo_path }}"
|
||||
|
||||
- name: Add a couple collections to the repository
|
||||
command: 'ansible-galaxy collection init {{ item }}'
|
||||
args:
|
||||
chdir: '{{ galaxy_dir }}/development'
|
||||
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: '{{ galaxy_dir }}/development/ansible_test/collection_1/galaxy.yml'
|
||||
path: '{{ test_repo_path }}/collection_1/galaxy.yml'
|
||||
regexp: '^dependencies'
|
||||
line: "dependencies: {'git+file://{{ galaxy_dir }}/development/ansible_test/.git#collection_2/': '*'}"
|
||||
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: '{{ galaxy_dir }}/development/ansible_test'
|
||||
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 }}"
|
||||
|
@ -1,2 +1,2 @@
|
||||
collections:
|
||||
- name: git+file://{{ galaxy_dir }}/development/amazon.aws/.git
|
||||
- name: git+file://{{ scm_path }}/amazon.aws/.git
|
||||
|
@ -1,3 +1,3 @@
|
||||
collections:
|
||||
- name: file://{{ galaxy_dir }}/development/amazon.aws/.git
|
||||
- name: file://{{ scm_path }}/amazon.aws/.git
|
||||
type: git
|
||||
|
@ -1,3 +1,3 @@
|
||||
collections:
|
||||
# should not work: git prefix or type is required
|
||||
- name: file://{{ galaxy_dir }}/development/amazon.aws/.git
|
||||
- name: file://{{ scm_path }}/amazon.aws/.git
|
||||
|
@ -1,4 +1,4 @@
|
||||
collections:
|
||||
# should not work: source is expected to be a galaxy server name or URL
|
||||
- source: git+file://{{ galaxy_dir }}/development/amazon.aws/.git
|
||||
- source: git+file://{{ scm_path }}/amazon.aws/.git
|
||||
name: ansible.nope
|
||||
|
@ -1,5 +1,5 @@
|
||||
collections:
|
||||
# should not work: source is expected to be a galaxy server name or URL
|
||||
- source: git+file://{{ galaxy_dir }}/development/amazon.aws/.git
|
||||
- source: git+file://{{ scm_path }}/amazon.aws/.git
|
||||
name: ansible.nope
|
||||
type: git
|
||||
|
@ -1,3 +1,3 @@
|
||||
collections:
|
||||
# should not work: source is expected to be a galaxy server name or URL
|
||||
- source: git+file://{{ galaxy_dir }}/development/amazon.aws/.git
|
||||
- source: git+file://{{ scm_path }}/amazon.aws/.git
|
||||
|
@ -0,0 +1,4 @@
|
||||
install_path: "{{ galaxy_dir }}/collections/ansible_collections"
|
||||
alt_install_path: "{{ galaxy_dir }}/other_collections/ansible_collections"
|
||||
scm_path: "{{ galaxy_dir }}/development"
|
||||
test_repo_path: "{{ galaxy_dir }}/development/ansible_test"
|
Loading…
Reference in New Issue