如何使用CircleCI的ecs orbs来执行depends_on的实际工作票务。

huangapple go评论89阅读模式
英文:

How to use CircleCI's ecs orbs to do actual ticketing of depends_on

问题

以下是翻译好的部分:

我目前正在使用 CircleCI 和 ECS orbs 进行部署。

这是 config.yaml 的内容:

  1. version: 2.1
  2. orbs:
  3. aws-ecr: circleci/aws-ecr@8.2.1
  4. aws-ecs: circleci/aws-ecs@3.2.0
  5. jobs:
  6. dev-ecr-push-go-image:
  7. executor: aws-ecr/default
  8. steps:
  9. workflows:
  10. ci_workflow:
  11. jobs:
  12. - aws-ecr/build-and-push-image:
  13. name: dev-ecr-push-go-image
  14. registry-id: DEV_AWS_ECR_REGISTRY_ID
  15. aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
  16. aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
  17. public-registry: false
  18. push-image: true
  19. dockerfile: ./docker/deploy/go/Dockerfile
  20. repo: 'development/app'
  21. tag: '${CIRCLE_SHA1}'
  22. - aws-ecr/build-and-push-image:
  23. name: dev-ecr-push-nginx-image
  24. registry-id: DEV_AWS_ECR_REGISTRY_ID
  25. aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
  26. aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
  27. public-registry: false
  28. push-image: true
  29. dockerfile: ./docker/deploy/nginx/Dockerfile
  30. repo: 'development/nginx'
  31. tag: '${CIRCLE_SHA1}'
  32. - aws-ecs/deploy-service-update:
  33. name: dev-ecs-deploy
  34. aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
  35. aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
  36. cluster: 'development'
  37. container-image-name-updates: 'container=nginx,tag=${CIRCLE_SHA1},container=app,tag=${CIRCLE_SHA1}'
  38. family: 'development'
  39. service-name: 'development'
  40. requires:
  41. - dev-ecr-push-go-image
  42. - dev-ecr-push-nginx-image

当我创建一个任务时,我希望在启动 go 容器后启动 nginx 容器。这可以很容易地通过使用 docker-compose 实现,我已确认它也可以在 ECS 任务定义上实现。您可以参考以下链接:https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html

但是,在 CircleCI 中实现 dependsOn 的最佳方法是什么?我查看了 orbs 文档,但没有找到解决方案。您可以参考以下链接:https://circleci.com/developer/ja/orbs/orb/circleci/aws-ecs

英文:

I am currently deploying with CircleCI using ECS orbs.

Here are the contents of config.yaml.

  1. version: 2.1
  2. orbs:
  3. aws-ecr: circleci/aws-ecr@8.2.1
  4. aws-ecs: circleci/aws-ecs@3.2.0
  5. jobs:
  6. dev-ecr-push-go-image:
  7. executor: aws-ecr/default
  8. steps:
  9. workflows:
  10. ci_workflow:
  11. jobs:
  12. - aws-ecr/build-and-push-image:
  13.                 name: dev-ecr-push-go-image
  14. registry-id: DEV_AWS_ECR_REGISTRY_ID
  15. aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
  16. aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
  17. public-registry: false
  18. push-image: true
  19. dockerfile: ./docker/deploy/go/Dockerfile
  20. repo: 'development/app'
  21. tag: '${CIRCLE_SHA1}'
  22. - aws-ecr/build-and-push-image:
  23. name: dev-ecr-push-nginx-image
  24. registry-id: DEV_AWS_ECR_REGISTRY_ID
  25. aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
  26. aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
  27. public-registry: false
  28. push-image: true
  29. dockerfile: ./docker/deploy/nginx/Dockerfile
  30. repo: 'development/nginx'
  31. tag: '${CIRCLE_SHA1}'
  32. - aws-ecs/deploy-service-update:
  33. name: dev-ecs-deploy
  34. aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
  35. aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
  36. cluster: 'development'
  37. container-image-name-updates: 'container=nginx,tag=${CIRCLE_SHA1},container=app,tag=${CIRCLE_SHA1}'
  38. family: 'development'
  39. service-name: 'development'
  40. requires:
  41. - dev-ecr-push-go-image
  42. - dev-ecr-push-nginx-image

When I create a task, I want the nginx container to be started after the go container is started.
This can be done easily with docker-compose, and I have confirmed that it can also be done with task definitions on the ECS side.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html

But what is the best way to achieve dependsOn with CircleCI?
I checked the orbs documentation but could not find a solution.
https://circleci.com/developer/ja/orbs/orb/circleci/aws-ecs

答案1

得分: 0

以下是您要翻译的内容:

这是我的task_definition.json中的配置错误。
我忘记设置要与“links”一起启动的容器的顺序。

英文:

It was a configuration error in my task_definition.json.
I forgot to set the order of containers to be launched with "links".

huangapple
  • 本文由 发表于 2023年7月13日 12:49:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76676022.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定