无人机CI秘密没有填充

问题描述 投票:2回答:2

我正在尝试将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添加秘密。

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

提前致谢。

docker drone drone.io docker-secrets
2个回答
1
投票

秘密需要通过名为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


0
投票

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

另外,你可能想考虑在你的构建中使用.netrc中的Dockerfile,所以你的凭证被嵌入你的docker图像中

© www.soinside.com 2019 - 2024. All rights reserved.