Skip to content

Commit c8b6912

Browse files
authored
Merge pull request #637 from CodeNow/add-login-in-for-pulling-image
Add pulling of image if not present
2 parents 341f4ce + c55b485 commit c8b6912

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

ansible/roles/builder/tasks/main.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,23 @@
163163
- name: login to registry
164164
tags: deploy
165165
become: yes
166-
when: build_image and push_image
167-
command: docker login -u {{ registry_username }} -p {{ registry_token }} {{ registry_host }}
166+
when: (build_image and push_image) or (not build_image)
167+
command: docker login -u {{ registry_username }} -p {{ registry_token }} -e "info@runnable.com" {{ registry_host }}
168168

169169
- name: push docker image
170170
tags: deploy
171171
become: yes
172172
when: build_image and push_image
173173
command: docker push {{ container_image }}:{{ container_tag }}
174174

175+
- name: pull docker image
176+
tags: deploy
177+
become: yes
178+
when: not build_image
179+
command: docker pull {{ container_image }}:{{ container_tag }}
180+
175181
- name: logout of registry
176182
tags: deploy
177183
become: yes
178-
when: build_image and push_image
184+
when: (build_image and push_image) or (not build_image)
179185
command: docker logout

0 commit comments

Comments
 (0)