我有一个circleci构建的以下config.yml,它使用了aws-ecr和aws-ecs orbs。
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@0.0.2
aws-ecs: circleci/aws-ecs@0.0.3
workflows:
build-deploy:
jobs:
- aws-ecr/build_and_push_image:
account-url: "myaccount.amazonaws.com"
repo: "my/repo"
region: us-east-1
tag: "${CIRCLE_BRANCH}"
filters:
branches:
only: mybranch问题是这个代码库包含一个.gitmodules文件,它拉入一个私有子模块。我似乎想不出如何覆盖/扩展orb来另外运行circleci等效于
git submodule update --init
我曾尝试将此代码添加到dockerfile中,但随后我收到
Permission denied (publickey).
fatal: Could not read from remote repository.注意: dockerfile在本地构建良好,因为本地docker会自动插入我的git密钥。
我还尝试将orb作业重新配置为步骤,即
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@0.0.2
aws-ecs: circleci/aws-ecs@0.0.3
workflows:
build-deploy:
jobs:
- lb_build_and_push_image:
steps:
- add_ssh_keys:
fingerprints:
- "my:fin:ger:print"
- aws-ecr/build_and_push_image:
account-url: "account.amazonaws.com"
repo: "my/repo-backend"
region: us-east-1
tag: "${CIRCLE_BRANCH}"
filters:
branches:
only: mybranch...where指纹来自ssh签出密钥中的“用户密钥”。我已经尝试了各种配置的作业/步骤。
模式总是失败,通常的消息是:
Error: ERROR IN CONFIG FILE:
[#/workflows/build-deploy/jobs/0] 0 subschemas matched instead of one
1. [#/workflows/build-deploy/jobs/0] expected type: String, found: Mapping有没有人有关于如何继续进行的建议,正确的配置可能是什么,或者只是关于如何在故障排除中前进的一般性建议?任何有见地的人都非常感谢。
发布于 2019-05-03 04:23:42
这是最终的解决方案。较新版本的aws-ecr orb提供了步骤命令
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@4.0.1
aws-ecs: circleci/aws-ecs@0.0.3
aws-cli: circleci/aws-cli@0.1.1
jobs:
build_and_push_image:
docker:
- image: circleci/python:3.7.1
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule init
git submodule update --remote
- setup_remote_docker
- aws-ecr/build-image:
repo: "my/repo"
tag: "${CIRCLE_BRANCH}"
- aws-cli/install
- aws-ecr/ecr-login
- aws-ecr/push-image:
repo: "my/repo"
tag: "${CIRCLE_BRANCH}"然而,这确实依赖于aws orb的更新,如果有其他方法来解决这个问题,我会很感兴趣,假设这些步骤没有公开为命令
https://stackoverflow.com/questions/55956832
复制相似问题