upload-artifactory: fix variable misspelling
Also adds a check that makes sure the instance the artifact is to be uploaded to is actually defined. Change-Id: Ie80fa9869e49566dc39e815c10146d45724f5744
This commit is contained in:
parent
8d90e3d4cb
commit
2477bb6d4d
@ -1,3 +1,8 @@
|
|||||||
|
- name: Fail if artifactory instance is not defined
|
||||||
|
fail:
|
||||||
|
msg: "Instance {{ zj_artifact.instance }} is not defined."
|
||||||
|
when: zj_artifact.instance not in upload_artifactory_instances
|
||||||
|
|
||||||
- name: Make sure artifact exists on the executor
|
- name: Make sure artifact exists on the executor
|
||||||
stat:
|
stat:
|
||||||
path: "{{ _undocumented_test_work_dir_ | default(zuul.executor.work_root) }}\
|
path: "{{ _undocumented_test_work_dir_ | default(zuul.executor.work_root) }}\
|
||||||
@ -25,36 +30,36 @@
|
|||||||
request_header: "{{ request_header | combine(zj_artifact.headers|default({})) }}"
|
request_header: "{{ request_header | combine(zj_artifact.headers|default({})) }}"
|
||||||
|
|
||||||
- name: Add api key to header
|
- name: Add api key to header
|
||||||
when: "'api_key' in upload_artifactory_instance[zj_artifact.instance]"
|
when: "'api_key' in upload_artifactory_instances[zj_artifact.instance]"
|
||||||
no_log: true
|
no_log: true
|
||||||
set_fact:
|
set_fact:
|
||||||
request_header: "{{ request_header |
|
request_header: "{{ request_header |
|
||||||
combine({'X-JFrog-Art-Api': upload_artifactory_instance[zj_artifact.instance].api_key}) }}"
|
combine({'X-JFrog-Art-Api': upload_artifactory_instances[zj_artifact.instance].api_key}) }}"
|
||||||
|
|
||||||
- name: Set artifactory password
|
- name: Set artifactory password
|
||||||
no_log: true
|
no_log: true
|
||||||
set_fact:
|
set_fact:
|
||||||
_artifactory_password: "{{ upload_artifactory_instance[zj_artifact.instance].password }}"
|
_artifactory_password: "{{ upload_artifactory_instances[zj_artifact.instance].password }}"
|
||||||
when:
|
when:
|
||||||
- "'api_key' not in upload_artifactory_instance[zj_artifact.instance]"
|
- "'api_key' not in upload_artifactory_instances[zj_artifact.instance]"
|
||||||
- "'password' in upload_artifactory_instance[zj_artifact.instance]"
|
- "'password' in upload_artifactory_instances[zj_artifact.instance]"
|
||||||
|
|
||||||
- name: Set artifactory url fact
|
- name: Set artifactory url fact
|
||||||
set_fact:
|
set_fact:
|
||||||
_artifactory_url: "{{ upload_artifactory_instance[zj_artifact.instance].transport | default('https') }}://\
|
_artifactory_url: "{{ upload_artifactory_instances[zj_artifact.instance].transport | default('https') }}://\
|
||||||
{{ upload_artifactory_instance[zj_artifact.instance].fqdn }}\
|
{{ upload_artifactory_instances[zj_artifact.instance].fqdn }}\
|
||||||
/artifactory/{{ zj_artifact.dest }}"
|
/artifactory/{{ zj_artifact.dest }}"
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uri:
|
uri:
|
||||||
user: "{{ upload_artifactory_instance[zj_artifact.instance].user }}"
|
user: "{{ upload_artifactory_instances[zj_artifact.instance].user }}"
|
||||||
password: "{{ _artifactory_password | default(omit) }}"
|
password: "{{ _artifactory_password | default(omit) }}"
|
||||||
url: "{{ _artifactory_url }}"
|
url: "{{ _artifactory_url }}"
|
||||||
src: "{{ _undocumented_test_work_dir_ | default(zuul.executor.work_root) }}/artifacts/{{ zj_artifact.src }}"
|
src: "{{ _undocumented_test_work_dir_ | default(zuul.executor.work_root) }}/artifacts/{{ zj_artifact.src }}"
|
||||||
headers: "{{ request_header }}"
|
headers: "{{ request_header }}"
|
||||||
status_code: 201
|
status_code: 201
|
||||||
method: PUT
|
method: PUT
|
||||||
force_basic_auth: "{{ upload_artifactory_instance[zj_artifact.instance].force_basic_auth |
|
force_basic_auth: "{{ upload_artifactory_instances[zj_artifact.instance].force_basic_auth |
|
||||||
default(false) | bool }}"
|
default(false) | bool }}"
|
||||||
remote_src: yes # To not unecessarily copy artifact to a tempfile
|
remote_src: yes # To not unecessarily copy artifact to a tempfile
|
||||||
delegate_to: "{{ _undocumented_test_worker_node_ | default('localhost') }}"
|
delegate_to: "{{ _undocumented_test_worker_node_ | default('localhost') }}"
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
- name: Set artifactory instances fact
|
- name: Set artifactory instances fact
|
||||||
set_fact:
|
set_fact:
|
||||||
cacheable: true
|
cacheable: true
|
||||||
upload_artifactory_instance:
|
upload_artifactory_instances:
|
||||||
localhost_password:
|
localhost_password:
|
||||||
fqdn: localhost:8081
|
fqdn: localhost:8081
|
||||||
transport: http
|
transport: http
|
||||||
|
Loading…
Reference in New Issue
Block a user