Skip to content

Commit f2e76cc

Browse files
committed
ecr lifecycle file removed duplicate code
1 parent 7fcfa61 commit f2e76cc

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

ansible/roles/build-ecs-proxies/tasks/build-container.yml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@
3232
cmd: "docker push {{ image_name }}"
3333
when: build_result.rc == 0
3434

35-
- name: List contents of playbook_dir
36-
ansible.builtin.command: >
37-
ls -al {{ playbook_dir }}
38-
register: ls_playbook
39-
40-
- name: Show playbook_dir contents
41-
debug:
42-
var: ls_playbook.stdout
43-
4435
- name: Get existing lifecycle policy JSON for {{ service_id }}_{{ item }}
4536
ansible.builtin.command: >
4637
{{ aws_cmd }} ecr get-lifecycle-policy
@@ -65,45 +56,6 @@
6556
existing_policy_json: {}
6657
when: existing_policy_json is not defined
6758

68-
- name: Read lifecycle policy from the shared file
69-
ansible.builtin.slurp:
70-
src: "{{ playbook_dir }}/../ecr-lifecycle/ecr_lifecycle.json"
71-
register: desired_policy_raw
72-
73-
- name: Decode lifecycle policy file
74-
set_fact:
75-
desired_policy_json: "{{ desired_policy_raw.content | b64decode | from_json }}"
76-
77-
- name: Apply lifecycle policy to ecr {{ service_id }}_{{ item }} if different
78-
ansible.builtin.command: >
79-
{{ aws_cmd }} ecr put-lifecycle-policy
80-
--repository-name {{ service_id }}_{{ item }}
81-
--lifecycle-policy-text file://{{ playbook_dir }}/../ecr-lifecycle/ecr_lifecycle.json
82-
when:
83-
- existing_policy_json != desired_policy_json- name: Get existing lifecycle policy JSON for {{ service_id }}_{{ item }}
84-
ansible.builtin.command: >
85-
{{ aws_cmd }} ecr get-lifecycle-policy
86-
--repository-name {{ service_id }}_{{ item }}
87-
--query 'lifecyclePolicyText'
88-
--output text
89-
register: existing_policy_raw
90-
failed_when: false
91-
changed_when: false
92-
93-
- name: Parse existing lifecycle policy JSON if present
94-
set_fact:
95-
existing_policy_json: "{{ existing_policy_raw.stdout | from_json }}"
96-
when:
97-
- existing_policy_raw.stdout is defined
98-
- existing_policy_raw.stdout != ""
99-
- existing_policy_raw.stdout != "None"
100-
- existing_policy_raw.stdout != "null"
101-
102-
- name: Ensure existing_policy_json always exists
103-
set_fact:
104-
existing_policy_json: {}
105-
when: existing_policy_json is not defined
106-
10759
- name: Read lifecycle policy from the shared file
10860
ansible.builtin.slurp:
10961
src: "{{ playbook_dir }}/ecr-lifecycle/ecr_lifecycle.json"

0 commit comments

Comments
 (0)