Circleci:使用 AWS ECR orb 的私有 git 子模块

Circleci: Private git subdmodule with AWS ECR orb

我有以下 config.yml 用于 circleci 构建,效果很好 它使用 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

问题是这个 repo 包含一个 .gitmodules 文件,它引入了一个私有子模块。 我似乎无法弄清楚如何 override/extend orb 到 运行 另外 circleci 相当于

git submodule update --init

我尝试将其添加到 docker 文件中,但后来我得到

Permission denied (publickey).

fatal: Could not read from remote repository.

注意:docker文件在本地构建良好,因为本地 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

...其中指纹来自 ssh 结帐密钥中的 'user key'。 我尝试了 jobs/steps 的各种配置。

并且架构总是失败并显示以下消息:

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

是否有人对如何继续、正确的配置可能是什么有任何指示,或者只是关于如何继续进行故障排除的一般指示? 非常感谢任何见解。

这是最终的解决方案。较新版本的 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 的更新,如果有另一种方法可以解决这个问题,我会很感兴趣,假设这些步骤没有作为命令公开