Fix publish charm job
When there are no charms as artifacts in gate pipeline, the publish charm variable charm_channels is not defaulted to empty dictionary. Set charm_channels default value to empty dictionary wherever the variable is used. Change-Id: I4fda23b2f103f168b85635bf1d9786cf62d845fb
This commit is contained in:
parent
7503f5cdba
commit
7a3ccdb004
@ -30,7 +30,12 @@
|
|||||||
chdir: "{{ zuul.project.src_dir }}"
|
chdir: "{{ zuul.project.src_dir }}"
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
shell: |
|
shell: |
|
||||||
ls *.charm | cut -d"." -f 1
|
charms=$(ls *.charm | cut -d"." -f 1)
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo $charms | tr ' ' '\n'
|
||||||
|
fi
|
||||||
register: built_charms
|
register: built_charms
|
||||||
|
|
||||||
- name: Prepare charm channel dict for downloaded charms
|
- name: Prepare charm channel dict for downloaded charms
|
||||||
@ -41,13 +46,13 @@
|
|||||||
|
|
||||||
- name: Print charm channel dict
|
- name: Print charm channel dict
|
||||||
debug:
|
debug:
|
||||||
msg: "Charms to be published: {{ charm_channels }}"
|
msg: "Charms to be published: {{ charm_channels | default({}) }}"
|
||||||
|
|
||||||
- name: Publish charms in a loop
|
- name: Publish charms in a loop
|
||||||
include_tasks: "publish.yaml"
|
include_tasks: "publish.yaml"
|
||||||
vars:
|
vars:
|
||||||
charm_build_name: "{{ channel.key }}"
|
charm_build_name: "{{ channel.key }}"
|
||||||
publish_channel: "{{ channel.value }}"
|
publish_channel: "{{ channel.value }}"
|
||||||
loop: "{{ charm_channels|dict2items }}"
|
loop: "{{ charm_channels | default({}) | dict2items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: channel
|
loop_var: channel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user