実現したいこと
・Githubへのプッシュ時に、CircleCI を使用して、Amazon Elastic Container Registry (ECR) をら Amazon Elastic Container Service (ECS) にデプロイを行いたい
・Amazon Elastic Container Registry (ECR) へのイメージの登録はできるが、ECSデプロイ時にエラーが発生する
前提
AWS ECR・ECSの各設定名は以下の通りです。
〇ECR ・リポジトリ名:[アプリ名]-repository 〇ECS ・クラスター名:[アプリ名]-cluster ・サービス名:[アプリ名]-service ・タスク定義:[アプリ名]-definition(例:[アプリ名]-definition:27) ・コンテナ名:[アプリ名]-container ・イメージ:[アカウントID].dkr.ecr.ap-northeast-1.amazonaws.com/[アプリ名]-repository:latest ※[アプリ名]は共通です。
発生している問題・エラーメッセージ
An error occurred (ClientException) when calling the DescribeTaskDefinition operation: Unable to describe task definition. Exited with code exit status 254 CircleCI received exit code 254
なお、family: '${MY_APP_PREFIX}-service''
をfamily: '${MY_APP_PREFIX}-definition'
に変更した場合は、definitionエラーは発生しませんが、今度は以下のエラーが発生します。
#!/bin/bash -eo pipefail set -o noglob # These variables are evaluated so the config file may contain and pass in environment variables to the parameters. ECS_PARAM_FAMILY=$(eval echo "$ECS_PARAM_FAMILY") ECS_PARAM_CLUSTER_NAME=$(eval echo "$ECS_PARAM_CLUSTER_NAME") ECS_PARAM_SERVICE_NAME=$(eval echo "$ECS_PARAM_SERVICE_NAME") ECS_PARAM_PROFILE_NAME=$(eval echo "$ECS_PARAM_PROFILE_NAME") if [ -z "${ECS_PARAM_SERVICE_NAME}" ]; then ECS_PARAM_SERVICE_NAME="$ECS_PARAM_FAMILY" fi if [ "$ECS_PARAM_FORCE_NEW_DEPLOY" == "1" ]; then set -- "$@" --force-new-deployment fi if [ -n "${ECS_PARAM_PROFILE_NAME}" ]; then set -- "$@" --profile "${ECS_PARAM_PROFILE_NAME}" fi if [ "$ECS_PARAM_ENABLE_CIRCUIT_BREAKER" == "1" ]; then set -- "$@" --deployment-configuration "deploymentCircuitBreaker={enable=true,rollback=true}" fi DEPLOYED_REVISION=$(aws ecs update-service \ --cluster "$ECS_PARAM_CLUSTER_NAME" \ --service "${ECS_PARAM_SERVICE_NAME}" \ --task-definition "${CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN}" \ --output text \ --query service.taskDefinition \ "$@") echo "export CCI_ORB_AWS_ECS_DEPLOYED_REVISION='${DEPLOYED_REVISION}'" >> "$BASH_ENV" An error occurred (ServiceNotFoundException) when calling the UpdateService operation: Exited with code exit status 254 CircleCI received exit code 254
該当のソースコード
yml:config.yml
1version: '2.1' 2 3orbs: 4 aws-ecr: circleci/aws-ecr@8.1 5 aws-ecs: circleci/aws-ecs@3.2 6 7workflows: 8 build-and-deploy: 9 jobs: 10 - aws-ecr/build-and-push-image: 11 repo: "${AWS_RESOURCE_NAME_PREFIX}-repository" 12 tag: 'latest' 13 path: . 14 15 - aws-ecs/deploy-service-update: 16 requires: 17 - aws-ecr/build-and-push-image 18 cluster: '${MY_APP_PREFIX}-cluster' 19 family: '${MY_APP_PREFIX}-service' 20 container-image-name-updates: "container=${AWS_RESOURCE_NAME_PREFIX}-container,image-and-tag=${AWS_ECR_REGISTRY_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${AWS_RESOURCE_NAME_PREFIX}-repository:latest"
試したこと
・公式ドキュメントの通読
https://circleci.com/docs/ja/ecs-ecr/
https://circleci.com/developer/ja/orbs/orb/circleci/aws-ecs
・関連記事の通読
https://qiita.com/saki-engineering/items/d35ea75e95ffa77e307a
https://zenn.dev/hibriiiiidge/books/49ee4063b10cec1df1a2/viewer/29c36a
https://engineers.weddingpark.co.jp/aws-ecs-circleci/
・ChatGPTの活用
回答1件
あなたの回答
tips
プレビュー