Skip to content

Commit 09d0254

Browse files
committed
aws ecr tagging updates
1 parent 9092836 commit 09d0254

File tree

1 file changed

+27
-9
lines changed
  • ansible/roles/deploy-ecs-proxies-retag/tasks

1 file changed

+27
-9
lines changed

ansible/roles/deploy-ecs-proxies-retag/tasks/main.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,62 @@
1515
debug:
1616
var: repo_names
1717

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+
1823
- name: Debug pulling image
1924
debug:
2025
msg: "Pulling {{ ecr_registry }}/{{ item }}:{{ build_label }}"
21-
with_items: "{{ repo_names }}"
26+
loop: "{{ repo_names }}"
27+
loop_control:
28+
label: "{{ item }}"
2229

23-
- name: Pull existing image {{ item }}:{{ build_label }}
30+
- name: Pull existing image
2431
ansible.builtin.command:
2532
cmd: >
2633
docker pull {{ ecr_registry }}/{{ item }}:{{ build_label }}
27-
with_items: "{{ repo_names }}"
34+
loop: "{{ repo_names }}"
35+
loop_control:
36+
label: "{{ item }}"
2837
register: pull_results
2938

3039
- name: Debug retagging image
3140
debug:
3241
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 }}"
3445
when: item.rc == 0
3546

36-
- name: Retag image {{ item.item }}:{{ build_label }} → ecs-{{ build_label }}
47+
- name: Retag image
3748
ansible.builtin.command:
3849
cmd: >
3950
docker tag
4051
{{ ecr_registry }}/{{ item.item }}:{{ build_label }}
4152
{{ 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 }}"
4356
when: item.rc == 0
4457

4558
- name: Debug pushing image
4659
debug:
4760
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 }}"
4964
when: item.rc == 0
5065

51-
- name: Push new tag ecs-{{ build_label }} for {{ item.item }}
66+
- name: Push new tag
5267
ansible.builtin.command:
5368
cmd: >
5469
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 }}"
5673
when: item.rc == 0
5774

5875

76+

0 commit comments

Comments
 (0)