2020-02-28 23:59:09 +01:00
|
|
|
---
|
|
|
|
- name: fail to publish with no token - {{ test_name }}
|
2020-05-20 22:44:01 +02:00
|
|
|
command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_server }} {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
register: fail_no_token
|
|
|
|
failed_when: '"HTTP Code: 401" not in fail_no_token.stderr'
|
2020-06-17 23:06:07 +02:00
|
|
|
when: not is_pulp
|
2020-02-28 23:59:09 +01:00
|
|
|
|
|
|
|
- name: fail to publish with invalid token - {{ test_name }}
|
2020-05-20 22:44:01 +02:00
|
|
|
command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_server }} --token fail {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
register: fail_invalid_token
|
|
|
|
failed_when: '"HTTP Code: 401" not in fail_invalid_token.stderr'
|
2020-06-17 23:06:07 +02:00
|
|
|
when: not is_pulp
|
2020-02-28 23:59:09 +01:00
|
|
|
|
|
|
|
- name: publish collection - {{ test_name }}
|
2020-07-01 22:20:03 +02:00
|
|
|
command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_name }} {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
2020-06-17 23:06:07 +02:00
|
|
|
register: fallaxy_publish_collection
|
|
|
|
when: not is_pulp
|
|
|
|
|
|
|
|
- name: publish collection - {{ test_name }}
|
|
|
|
command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_name }} {{ galaxy_verbosity }}
|
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
register: pulp_publish_collection
|
|
|
|
when: is_pulp
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
publish_collection: '{{ pulp_publish_collection if pulp_publish_collection is not skipped else fallaxy_publish_collection }}'
|
2020-02-28 23:59:09 +01:00
|
|
|
|
|
|
|
- name: get result of publish collection - {{ test_name }}
|
|
|
|
uri:
|
2020-07-01 22:20:03 +02:00
|
|
|
url: '{{ test_server }}{{ vX }}collections/ansible_test/my_collection/versions/1.0.0/'
|
2020-02-28 23:59:09 +01:00
|
|
|
return_content: yes
|
2020-07-01 22:20:03 +02:00
|
|
|
user: '{{ pulp_user }}'
|
|
|
|
password: '{{ pulp_password }}'
|
|
|
|
force_basic_auth: true
|
2020-02-28 23:59:09 +01:00
|
|
|
register: publish_collection_actual
|
|
|
|
|
|
|
|
- name: assert publish collection - {{ test_name }}
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- '"Collection has been successfully published and imported to the Galaxy server" in publish_collection.stdout'
|
2020-06-17 23:06:07 +02:00
|
|
|
- publish_collection_actual.json.collection.name == 'my_collection'
|
|
|
|
- publish_collection_actual.json.namespace.name == 'ansible_test'
|
|
|
|
- publish_collection_actual.json.version == '1.0.0'
|
2020-02-28 23:59:09 +01:00
|
|
|
|
|
|
|
- name: fail to publish existing collection version - {{ test_name }}
|
2020-07-01 22:20:03 +02:00
|
|
|
command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_name }} {{ galaxy_verbosity }}
|
2020-02-28 23:59:09 +01:00
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
register: fail_publish_existing
|
|
|
|
failed_when: '"Artifact already exists" not in fail_publish_existing.stderr'
|
2020-06-17 23:06:07 +02:00
|
|
|
when: not is_pulp
|
|
|
|
|
|
|
|
- name: fail to publish existing collection version - {{ test_name }}
|
|
|
|
command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_name }} {{ galaxy_verbosity }}
|
|
|
|
args:
|
|
|
|
chdir: '{{ galaxy_dir }}'
|
|
|
|
register: fail_publish_existing
|
|
|
|
failed_when: fail_publish_existing is not failed
|
|
|
|
when: is_pulp
|
2020-02-28 23:59:09 +01:00
|
|
|
|
|
|
|
- name: reset published collections - {{ test_name }}
|
|
|
|
uri:
|
|
|
|
url: '{{ test_server }}custom/reset/'
|
|
|
|
method: POST
|
2020-06-17 23:06:07 +02:00
|
|
|
when: not is_pulp
|
|
|
|
|
|
|
|
- name: reset published collections - {{ test_name }}
|
|
|
|
include_tasks: pulp.yml
|
|
|
|
when: is_pulp
|