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

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

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

问题

以下是翻译好的部分:

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

这是 config.yaml 的内容:

version: 2.1

orbs:
  aws-ecr: circleci/aws-ecr@8.2.1
  aws-ecs: circleci/aws-ecs@3.2.0

jobs:
  dev-ecr-push-go-image:
    executor: aws-ecr/default
    steps:

workflows:
  ci_workflow:
    jobs:
    - aws-ecr/build-and-push-image:
        name: dev-ecr-push-go-image
        registry-id: DEV_AWS_ECR_REGISTRY_ID
        aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
        aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
        public-registry: false
        push-image: true
        dockerfile: ./docker/deploy/go/Dockerfile
        repo: 'development/app'
        tag: '${CIRCLE_SHA1}'

    - aws-ecr/build-and-push-image:
        name: dev-ecr-push-nginx-image
        registry-id: DEV_AWS_ECR_REGISTRY_ID
        aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
        aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
        public-registry: false
        push-image: true
        dockerfile: ./docker/deploy/nginx/Dockerfile
        repo: 'development/nginx'
        tag: '${CIRCLE_SHA1}'

    - aws-ecs/deploy-service-update:
        name: dev-ecs-deploy
        aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
        aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
        cluster: 'development'
        container-image-name-updates: 'container=nginx,tag=${CIRCLE_SHA1},container=app,tag=${CIRCLE_SHA1}'
        family: 'development'
        service-name: 'development'
        requires:
        - dev-ecr-push-go-image
        - 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.

version: 2.1

orbs:
  aws-ecr: circleci/aws-ecr@8.2.1
  aws-ecs: circleci/aws-ecs@3.2.0


jobs:
  dev-ecr-push-go-image:
    executor: aws-ecr/default
    steps:


workflows:
  ci_workflow:
    jobs:
    - aws-ecr/build-and-push-image:
                name: dev-ecr-push-go-image
        registry-id: DEV_AWS_ECR_REGISTRY_ID
        aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
        aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
        public-registry: false
        push-image: true
        dockerfile: ./docker/deploy/go/Dockerfile
        repo: 'development/app'
        tag: '${CIRCLE_SHA1}'

    - aws-ecr/build-and-push-image:
        name: dev-ecr-push-nginx-image
        registry-id: DEV_AWS_ECR_REGISTRY_ID
        aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
        aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
        public-registry: false
        push-image: true
        dockerfile: ./docker/deploy/nginx/Dockerfile
        repo: 'development/nginx'
        tag: '${CIRCLE_SHA1}'
    - aws-ecs/deploy-service-update:
        name: dev-ecs-deploy
        aws-access-key-id: DEV_AWS_ACCESS_KEY_ID
        aws-secret-access-key: DEV_AWS_SECRET_ACCESS_KEY
        cluster: 'development'
        container-image-name-updates: 'container=nginx,tag=${CIRCLE_SHA1},container=app,tag=${CIRCLE_SHA1}'
        family: 'development'
        service-name: 'development'
        requires:
        - dev-ecr-push-go-image
        - 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:

确定