Skip to content

Commit db99915

Browse files
Use team-prefixed names for ECR and ECS in CI workflows (#96)
## Summary docker-build and ecs-deploy workflows used the bare repo name for ECR repos and ECS services. With team-prefixed naming, they need `{team}-{repo_name}`. Both get the team from the CI broker output (already resolved via GitHub API). ## Test plan - [ ] Merge, retrigger test app CI — docker build should push to `testteam-platform-test-app` ECR repo
1 parent f543242 commit db99915

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,27 @@ jobs:
7979

8080
- name: Determine image tags
8181
id: tags
82+
env:
83+
TEAM: ${{ steps.broker.outputs.team }}
84+
REPO_NAME: ${{ github.event.repository.name }}
85+
REF_NAME: ${{ github.ref_name }}
86+
REF: ${{ github.ref }}
87+
REGISTRY: ${{ steps.ecr.outputs.registry }}
8288
run: |
83-
REPO="${{ steps.ecr.outputs.registry }}/${{ github.event.repository.name }}"
89+
REPO="${REGISTRY}/${TEAM}-${REPO_NAME}"
8490
SHA_TAG="sha-${GITHUB_SHA::8}"
8591
echo "primary_tag=${SHA_TAG}" >> "$GITHUB_OUTPUT"
8692
echo "repo=${REPO}" >> "$GITHUB_OUTPUT"
8793
8894
TAGS="${REPO}:${SHA_TAG}"
8995
90-
if [ "${{ github.ref_name }}" = "main" ] || [ "${{ github.ref_name }}" = "master" ]; then
96+
if [ "${REF_NAME}" = "main" ] || [ "${REF_NAME}" = "master" ]; then
9197
DATE_TAG="main-$(date -u +%Y%m%d-%H%M)"
9298
TAGS="${TAGS},${REPO}:${DATE_TAG},${REPO}:latest"
9399
fi
94100
95-
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
96-
TAGS="${TAGS},${REPO}:${{ github.ref_name }}"
101+
if echo "${REF}" | grep -q '^refs/tags/v'; then
102+
TAGS="${TAGS},${REPO}:${REF_NAME}"
97103
fi
98104
99105
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"

.github/workflows/ecs-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ jobs:
6868

6969
- name: Deploy to ECS
7070
env:
71-
SERVICE: ${{ inputs.service_name || github.event.repository.name }}
71+
SERVICE: ${{ inputs.service_name || format('{0}-{1}', steps.broker.outputs.team, github.event.repository.name) }}
7272
CLUSTER: ${{ inputs.cluster_name }}
7373
run: sh .platform/scripts/ecs-deploy.sh

0 commit comments

Comments
 (0)