Skip to content

Commit 2035cfe

Browse files
committed
ecs retag ansible role release
1 parent 36a9023 commit 2035cfe

File tree

6 files changed

+59
-3
lines changed

6 files changed

+59
-3
lines changed

ansible/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ create-build-env-vars: guard-build_label guard-out_dir
4545
deploy-ecs-proxies: guard-account guard-build_label guard-service_id guard-APIGEE_ENVIRONMENT guard-PROXY_VARS_FILE
4646
@poetry run ansible-playbook -i local deploy-ecs-proxies.yml
4747

48+
deploy-ecs-proxies-retag: guard-build_label guard-service_id guard-CONTAINER_VARS_FILE
49+
@poetry run ansible-playbook -i local deploy-ecs-proxies-retag.yml
50+
4851
deploy-apigee-proxy: guard-FULLY_QUALIFIED_SERVICE_NAME guard-SERVICE_BASE_PATH guard-APIGEE_ENVIRONMENT guard-APIGEE_ORGANIZATION guard-APIGEE_ACCESS_TOKEN guard-PROXY_DIR guard-PING
4952
@poetry run ansible-playbook -i local deploy-apigee-proxy.yml
5053

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- name: deploy ecs proxies retag
2+
hosts: 127.0.0.1
3+
connection: local
4+
gather_facts: no
5+
6+
pre_tasks:
7+
- name: include container vars
8+
include_vars:
9+
file: "{{ lookup('env', 'CONTAINER_VARS_FILE') | expandvars | expanduser | realpath }}"
10+
11+
roles:
12+
- setup-facts
13+
- deploy-ecs-proxies-retag

ansible/deploy-ecs-proxies.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@
4545

4646
roles:
4747
- setup-facts
48-
- deploy-ecs-proxies-retag
4948
- deploy-ecs-proxies

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,16 @@
4646
{{ aws_cmd }} ecr put-lifecycle-policy
4747
--repository-name {{ item }}
4848
--lifecycle-policy-text '{{ desired_policy_json | to_json }}'
49-
with_items: "{{ new_repos }}"
49+
50+
# ORIGINAL (commented out for testing)
51+
# with_items: "{{ new_repos }}"
52+
53+
# TEST: apply to a specific existing repo
54+
with_items:
55+
- canary_canary-api
56+
5057
register: lifecycle_update
5158
ignore_errors: yes
52-
# when: new_repos UNCOMMENT
5359

5460
- name: ecr login
5561
shell: "eval $({{ aws_cmd }} ecr get-login --no-include-email)"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
parameters:
2+
- name: 'container_vars'
3+
type: string
4+
default: 'ecs-proxies-containers.yml'
5+
6+
- name: 'env_vars_dir'
7+
type: string
8+
default: './'
9+
10+
- name: 'utils_dir'
11+
type: string
12+
default: 'utils'
13+
14+
steps:
15+
- bash: |
16+
set -e
17+
source "${{ parameters.env_vars_dir }}/.build_env_vars"
18+
19+
export CONTAINER_VARS_FILE="$(realpath ${{ parameters.container_vars }})"
20+
21+
make --no-print-directory -C ${{ parameters.utils_dir }}/ansible deploy-ecs-proxies-retag
22+
displayName: "Retag ECS proxies"

azure/templates/deploy-service.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,19 @@ steps:
197197
profile: "$(DEPLOY_ROLE)"
198198
aws_account: "${{ parameters.aws_account }}"
199199

200+
- bash: |
201+
set -e
202+
203+
source $(SERVICE_DIR)/.build_env_vars
204+
205+
export ASSUMED_VERSION=$(echo $SERVICE_ARTIFACT_NAME | grep -E -o "v[0-9]+\.[0-9]+\.[0-9]+-?[a-z]*" || true | tail -1)
206+
export DEPLOYED_VERSION=${ASSUMED_VERSION:-${{ parameters.fully_qualified_service_name }}}
207+
208+
make --no-print-directory -C $(UTILS_DIR)/ansible deploy-ecs-proxies-retag
209+
210+
displayName: Retag ECS image
211+
condition: and(succeeded(), ne(variables['DEPLOY_ROLE'], ''))
212+
200213
- bash: |
201214
set -e
202215
proxy_vars_file="$(PROXY_VARS_FILE)"

0 commit comments

Comments
 (0)