我想为ECS部署创建一个管道。
所以我的..gitlab ci.yml文件是这样的:
stages:
- build
- test
- review
- deploy
- production
- cleanup
variables:
AUTO_DEVOPS_PLATFORM_TARGET: ECS
CI_AWS_ECS_CLUSTER: shopservice
CI_AWS_ECS_SERVICE: sample-app-service
CI_AWS_ECS_TASK_DEFINITION: first-run-task-definition:1
AWS_REGION: us-west-2
include:
- template: Jobs/Build.gitlab-ci.yml
- template: Jobs/Deploy/ECS.gitlab-ci.yml但在production_ecs舞台上,我的管道失败了。我犯了一个错误,因为:
Using docker image sha256:9920fa2b45873efd675cf992d7130e8a691133fd51ec88b2765d977f82695263 for registry.gitlab.com/gitlab-org/cloud-deploy/aws-ecs:latest with digest registry.gitlab.com/gitlab-org/cloud-deploy/aws-ecs@sha256:c833e508b00451a09639e96fb7551f62abb4f75ba1d31f88b4dc8299c608e0dd ...
22$ ecs update-task-definition
23Unable to locate credentials. You can configure credentials by running "aws configure".
25
Cleaning up project directory and file based variables
00:01
27ERROR: Job failed: exit code 1我为什么要犯这个错误?如何在ECS上配置was?
发布于 2022-01-23 22:59:37
您需要将凭据(AWS_ACCESS_KEY_ID、AWS_SECRET_ACCESS_KEY)作为环境变量传递,并将区域设置为环境变量AWS_DEFAULT_REGION。您可以通过进入您的项目(或组)并导航到Settings > CI/CD来设置它们。
您可以在这里找到ecs部署的文档:https://docs.gitlab.com/ee/ci/cloud_deployment/#deploy-your-application-to-the-aws-elastic-container-service-ecs
并在这里配置aws (在模板和GitLab AWS映像中使用):https://docs.gitlab.com/ee/ci/cloud_deployment/#run-aws-commands-from-gitlab-cicd
https://stackoverflow.com/questions/70827042
复制相似问题