|
15 | 15 | debug: |
16 | 16 | var: repo_names |
17 | 17 |
|
| 18 | +- name: Login to ECR |
| 19 | + command: > |
| 20 | + {{ aws_cmd }} ecr get-login-password --region {{ aws_region }} |
| 21 | + | docker login --username AWS --password-stdin {{ ecr_registry }} |
| 22 | +
|
18 | 23 | - name: Debug pulling image |
19 | 24 | debug: |
20 | 25 | msg: "Pulling {{ ecr_registry }}/{{ item }}:{{ build_label }}" |
21 | | - with_items: "{{ repo_names }}" |
| 26 | + loop: "{{ repo_names }}" |
| 27 | + loop_control: |
| 28 | + label: "{{ item }}" |
22 | 29 |
|
23 | | -- name: Pull existing image {{ item }}:{{ build_label }} |
| 30 | +- name: Pull existing image |
24 | 31 | ansible.builtin.command: |
25 | 32 | cmd: > |
26 | 33 | docker pull {{ ecr_registry }}/{{ item }}:{{ build_label }} |
27 | | - with_items: "{{ repo_names }}" |
| 34 | + loop: "{{ repo_names }}" |
| 35 | + loop_control: |
| 36 | + label: "{{ item }}" |
28 | 37 | register: pull_results |
29 | 38 |
|
30 | 39 | - name: Debug retagging image |
31 | 40 | debug: |
32 | 41 | msg: "Retagging {{ item.item }}:{{ build_label }} → ecs-{{ build_label }}" |
33 | | - with_items: "{{ pull_results.results }}" |
| 42 | + loop: "{{ pull_results.results }}" |
| 43 | + loop_control: |
| 44 | + label: "{{ item.item }}" |
34 | 45 | when: item.rc == 0 |
35 | 46 |
|
36 | | -- name: Retag image {{ item.item }}:{{ build_label }} → ecs-{{ build_label }} |
| 47 | +- name: Retag image |
37 | 48 | ansible.builtin.command: |
38 | 49 | cmd: > |
39 | 50 | docker tag |
40 | 51 | {{ ecr_registry }}/{{ item.item }}:{{ build_label }} |
41 | 52 | {{ ecr_registry }}/{{ item.item }}:ecs-{{ build_label }} |
42 | | - with_items: "{{ pull_results.results }}" |
| 53 | + loop: "{{ pull_results.results }}" |
| 54 | + loop_control: |
| 55 | + label: "{{ item.item }}" |
43 | 56 | when: item.rc == 0 |
44 | 57 |
|
45 | 58 | - name: Debug pushing image |
46 | 59 | debug: |
47 | 60 | msg: "Pushing ecs-{{ build_label }} for {{ item.item }}" |
48 | | - with_items: "{{ pull_results.results }}" |
| 61 | + loop: "{{ pull_results.results }}" |
| 62 | + loop_control: |
| 63 | + label: "{{ item.item }}" |
49 | 64 | when: item.rc == 0 |
50 | 65 |
|
51 | | -- name: Push new tag ecs-{{ build_label }} for {{ item.item }} |
| 66 | +- name: Push new tag |
52 | 67 | ansible.builtin.command: |
53 | 68 | cmd: > |
54 | 69 | docker push {{ ecr_registry }}/{{ item.item }}:ecs-{{ build_label }} |
55 | | - with_items: "{{ pull_results.results }}" |
| 70 | + loop: "{{ pull_results.results }}" |
| 71 | + loop_control: |
| 72 | + label: "{{ item.item }}" |
56 | 73 | when: item.rc == 0 |
57 | 74 |
|
58 | 75 |
|
| 76 | + |
0 commit comments