Skip to content

Commit 6ca0e00

Browse files
committed
배포테스트 7차
1 parent 550e337 commit 6ca0e00

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

.github/workflows/deploy-purchase-to-ecs.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,37 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424

25-
# --- 사전 진단 ---
2625
- name: Assert AWS_ROLE_TO_ASSUME is set
2726
run: |
2827
test -n "${{ secrets.AWS_ROLE_TO_ASSUME }}" || { echo "Missing secret: AWS_ROLE_TO_ASSUME"; exit 1; }
29-
echo "Secret is set (value hidden)"
3028
31-
- name: Check OIDC availability
32-
run: |
33-
if [ -z "${ACTIONS_ID_TOKEN_REQUEST_URL}" ]; then
34-
echo "No OIDC token available. Add 'permissions: id-token: write'."; exit 1;
35-
fi
36-
echo "OIDC token endpoint detected"
37-
38-
# --- OIDC로 AWS 자격 구성 ---
3929
- name: Configure AWS credentials (OIDC)
4030
uses: aws-actions/configure-aws-credentials@v4
4131
with:
4232
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
4333
aws-region: ${{ env.AWS_REGION }}
4434

4535
- name: Verify assumed identity
36+
run: aws sts get-caller-identity
37+
38+
# --- 여기서 task-def 파일의 컨테이너 이름을 출력/검증 ---
39+
- name: Show task definition & container names
4640
run: |
47-
aws sts get-caller-identity
48-
acct=$(aws sts get-caller-identity --query Account --output text)
49-
[ "$acct" = "782683897698" ] || { echo "Assumed wrong account: $acct" && exit 1; }
41+
echo "---- task-def path ----"
42+
ls -la .github/ecs
43+
echo "---- names ----"
44+
jq -r '.containerDefinitions[].name' .github/ecs/task-definition.json
45+
46+
- name: Assert container name matches
47+
run: |
48+
name=$(jq -r '.containerDefinitions[0].name' .github/ecs/task-definition.json)
49+
echo "taskdef: $name / expected: $CONTAINER_NAME"
50+
test "$name" = "$CONTAINER_NAME" || (echo "Mismatch! Fix container name in task-definition.json or CONTAINER_NAME env." && exit 1)
5051
51-
# --- ECR 로그인 & 빌드/푸시 ---
5252
- name: Login to Amazon ECR
5353
id: login-ecr
5454
uses: aws-actions/amazon-ecr-login@v2
5555

56-
- name: Assert ECR registry output
57-
run: |
58-
test -n "${{ steps.login-ecr.outputs.registry }}" || { echo "ECR registry output is empty. Check login-ecr step id."; exit 1; }
59-
6056
- uses: docker/setup-buildx-action@v3
6157

6258
- name: Build & Push to ECR
@@ -68,11 +64,7 @@ jobs:
6864
tags: |
6965
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
7066
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:latest
71-
labels: |
72-
org.opencontainers.image.revision=${{ github.sha }}
73-
org.opencontainers.image.source=${{ github.repository }}
7467
75-
# --- ECS 태스크 정의 렌더 & 배포 ---
7668
- name: Set image output
7769
id: image
7870
run: |

0 commit comments

Comments
 (0)