2020-02-28 23:59:09 +01:00
|
|
|
---
|
|
|
|
- name: build basic collection based on current directory
|
2020-05-20 22:44:01 +02:00
|
|
|
command: ansible-galaxy collection build {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}/scratch/ansible_test/my_collection'
|
|
|
|
register: build_current_dir
|
|
|
|
|
|
|
|
- name: get result of build basic collection on current directory
|
|
|
|
stat:
|
|
|
|
path: '{{ galaxy_dir }}/scratch/ansible_test/my_collection/ansible_test-my_collection-1.0.0.tar.gz'
|
|
|
|
register: build_current_dir_actual
|
|
|
|
|
|
|
|
- name: assert build basic collection based on current directory
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- '"Created collection for ansible_test.my_collection" in build_current_dir.stdout'
|
|
|
|
- build_current_dir_actual.stat.exists
|
|
|
|
|
|
|
|
- name: build basic collection based on relative dir
|
2020-05-20 22:44:01 +02:00
|
|
|
command: ansible-galaxy collection build scratch/ansible_test/my_collection {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
register: build_relative_dir
|
|
|
|
|
|
|
|
- name: get result of build basic collection based on relative dir
|
|
|
|
stat:
|
|
|
|
path: '{{ galaxy_dir }}/ansible_test-my_collection-1.0.0.tar.gz'
|
|
|
|
register: build_relative_dir_actual
|
|
|
|
|
|
|
|
- name: assert build basic collection based on relative dir
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- '"Created collection for ansible_test.my_collection" in build_relative_dir.stdout'
|
|
|
|
- build_relative_dir_actual.stat.exists
|
|
|
|
|
|
|
|
- name: fail to build existing collection without force
|
2020-05-20 22:44:01 +02:00
|
|
|
command: ansible-galaxy collection build scratch/ansible_test/my_collection {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
ignore_errors: yes
|
|
|
|
register: build_existing_no_force
|
|
|
|
|
|
|
|
- name: build existing collection with force
|
2020-05-20 22:44:01 +02:00
|
|
|
command: ansible-galaxy collection build scratch/ansible_test/my_collection --force {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
register: build_existing_force
|
|
|
|
|
|
|
|
- name: assert build existing collection
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- '"use --force to re-create the collection artifact" in build_existing_no_force.stderr'
|
|
|
|
- '"Created collection for ansible_test.my_collection" in build_existing_force.stdout'
|
2020-09-01 17:51:35 +02:00
|
|
|
|
|
|
|
- name: build collection containing ignored files
|
|
|
|
command: ansible-galaxy collection build
|
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}/scratch/ansible_test/ignore'
|
|
|
|
|
|
|
|
- name: list the created tar contents
|
|
|
|
command: tar -tf {{ galaxy_dir }}/scratch/ansible_test/ignore/ansible_test-ignore-1.0.0.tar.gz
|
|
|
|
args:
|
|
|
|
warn: false
|
|
|
|
register: tar_output
|
|
|
|
|
|
|
|
- name: assert ignored files are not present in the archive
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- item not in tar_output.stdout_lines
|
|
|
|
loop: '{{ collection_ignored_files }}'
|
|
|
|
|
|
|
|
- name: assert ignored directories are not present in the archive
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- item not in tar_output.stdout_lines
|
|
|
|
loop: '{{ collection_ignored_directories }}'
|