无人机 CI 个秘密未填充

Drone CI secrets not populating

我正在尝试将 docker 图像推送到 Drone 0.8.5 中的私有注册表中,当我将用户名和密码硬编码到管道中时它可以工作,但是我尝试在注册表中添加两个注册表详细信息选项卡并作为机密。

注册表管道

docker-registry-push:
  image: plugins/docker
  repo: registry.domain.com:5000/app
  registry: registry.domain.com:5000
  insecure: true
  pull: true

失败 no basic auth credentials

我终于尝试了变量替换。 (使用 $REGISTRY_USERNAME 和 $$REGISTRY_USERNAME 变量。全部导致错误 msg="Error authenticating: exit status 1"

docker-registry-push:
  image: plugins/docker
  repo: registry.domain.com:5000/app
  registry: registry.domain.com:5000
  secrets:
    - source: registry_username
      target: username
    - source: registry_password
      target: password
  insecure: true
  pull: true

再次尝试

docker-registry-push:
  image: plugins/docker
  repo: registry.domain.com:5000/app
  registry: registry.domain.com:5000
  username: ${REGISTRY_USERNAME}  
  password: ${REGISTRY_PASSWORD}
  secrets: [ registry_username, registry_password ]
  insecure: true
  pull: true

真是令人沮丧。在此之后,我还需要通过正确的方法为 Rancher accesskey secretkey 添加秘密。

我已经阅读了其他主题和无人机文档,但仍然感到困惑。

提前致谢。

这里是管理无人机秘钥http://docs.drone.io/manage-secrets/#pull-requests

此外,您可能想考虑在您的构建中使用 Dockerfile 中的 .netrc,这样您的凭据就会嵌入到您的 docker 图像中

秘密需要通过名称为 docker_usernamedocker_password.

的环境注入到 docker 容器中

您的 .drone.yml 文件应如下所示:

pipeline:
  docker:
    image: plugins/docker
    repo: username/app
    registry: registry.domain.com:5000
    insecure: true
    pull: true
    secrets:
      - source: registry_username
        target: docker_username
      - source: registry_password
        target: docker_password

有关更多配置选项,请参阅 drone plugin docs