4ed66807a0
We have to be careful about avoiding outer loop loop_var conflicts in ansible. Because the zuul-jobs roles are meant to be reconsumed elsewhere we should not use 'item' loopvars and instead set them to something a bit more unique. We use a zj_ prefix to try and be unique to this repo and document this convention. Change-Id: I20b9327a914890e9eafcb2b36dc8c23fb472bc8f
18 lines
602 B
YAML
18 lines
602 B
YAML
- name: Verify repository names
|
|
when: |
|
|
docker_credentials.repository is defined
|
|
and not zj_image.repository | regex_search(docker_credentials.repository)
|
|
loop: "{{ docker_images }}"
|
|
loop_control:
|
|
loop_var: zj_image
|
|
fail:
|
|
msg: "{{ zj_image.repository }} not permitted by {{ docker_credentials.repository }}"
|
|
- name: Log in to dockerhub
|
|
command: "docker login -u {{ docker_credentials.username }} -p {{ docker_credentials.password }}"
|
|
no_log: true
|
|
- name: Upload image to dockerhub
|
|
loop: "{{ docker_images }}"
|
|
loop_control:
|
|
loop_var: image
|
|
include_tasks: push.yaml
|