|
82 | 82 | register: tfapply |
83 | 83 | when: not do_not_terraform |
84 | 84 |
|
85 | | - - name: "{{ item.env }} | Login and pull image" |
| 85 | + - name: Retag and promote ECS image (release pipelines only) |
| 86 | + when: pr_number is not defined or pr_number == "" |
86 | 87 | vars: |
87 | | - REG: "{{ item.account }}.dkr.ecr.eu-west-2.amazonaws.com" |
| 88 | + PTL_REG: "{{ PTL_ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com" |
| 89 | + PROD_REG: "{{ PROD_ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com" |
88 | 90 | IMG: "{{ service_id }}_{{ ecs_service[0].name }}" |
89 | 91 | TAG: "{{ build_label }}" |
| 92 | + NEW: "ecs-{{ build_label }}" |
90 | 93 | shell: | |
91 | 94 | aws ecr get-login-password --region eu-west-2 \ |
92 | | - | docker login --username AWS --password-stdin {{ REG }} |
| 95 | + | docker login --username AWS --password-stdin {{ PTL_REG }} |
93 | 96 |
|
94 | | - docker pull {{ REG }}/{{ IMG }}:{{ TAG }} |
95 | | - args: |
96 | | - executable: /bin/bash |
97 | | - loop: |
98 | | - - { env: "PTL", account: "{{ PTL_ACCOUNT_ID }}" } |
99 | | - - { env: "PROD", account: "{{ PROD_ACCOUNT_ID }}" } |
100 | | - loop_control: |
101 | | - label: "{{ item.env }}" |
102 | | - |
103 | | - - name: "{{ item.env }} | Retag and push image" |
104 | | - vars: |
105 | | - REG: "{{ item.account }}.dkr.ecr.eu-west-2.amazonaws.com" |
106 | | - IMG: "{{ service_id }}_{{ ecs_service[0].name }}" |
107 | | - TAG: "{{ build_label }}" |
108 | | - NEW: "ecs-{{ build_label }}" |
109 | | - shell: | |
110 | | - docker tag {{ REG }}/{{ IMG }}:{{ TAG }} {{ REG }}/{{ IMG }}:{{ NEW }} |
111 | | - docker push {{ REG }}/{{ IMG }}:{{ NEW }} |
| 97 | + docker pull {{ PTL_REG }}/{{ IMG }}:{{ TAG }} |
| 98 | + docker tag {{ PTL_REG }}/{{ IMG }}:{{ TAG }} {{ PTL_REG }}/{{ IMG }}:{{ NEW }} |
| 99 | + docker push {{ PTL_REG }}/{{ IMG }}:{{ NEW }} |
| 100 | +
|
| 101 | + aws ecr get-login-password --region eu-west-2 \ |
| 102 | + | docker login --username AWS --password-stdin {{ PROD_REG }} |
| 103 | +
|
| 104 | + docker tag {{ PTL_REG }}/{{ IMG }}:{{ NEW }} {{ PROD_REG }}/{{ IMG }}:{{ NEW }} |
| 105 | + docker push {{ PROD_REG }}/{{ IMG }}:{{ NEW }} |
112 | 106 | args: |
113 | 107 | executable: /bin/bash |
114 | | - loop: |
115 | | - - { env: "PTL", account: "{{ PTL_ACCOUNT_ID }}" } |
116 | | - - { env: "PROD", account: "{{ PROD_ACCOUNT_ID }}" } |
117 | | - loop_control: |
118 | | - label: "{{ item.env }}" |
119 | 108 |
|
120 | 109 | rescue: |
121 | 110 | - name: output plan |
|
0 commit comments