离线 git clone Drone CI 使用代理作为 Nexus

问题描述

我正在跑步:

  • kubernetes 上的无人机服务器
  • 和drone-kubernetes-runner 将运行器动态配置为pod。

经过调查,我发现每个运行程序的 Pod YAML 都使用图像 drone/git 定义了第一步“git clone”。

我在离线环境中运行管道。我必须指定 nexus.company.local/drone/git 而不是 drone/git 以避免从公共注册表中获取

我到处搜索,但没有办法。 甚至 image_pull_secrets 对于我可以定义的明确步骤也很有价值。 对于像“克隆”步骤这样的隐式步骤没有价值

enter image description here

解决方法

您可以禁用自动克隆并添加一个明确的步骤,使用 nexus 镜像原点指定您自己的图像。

例如:

kind: pipeline

clone:
  disable: true

steps:
  - name: clone
    image: nexus.company.local/drone/git

,
DRONE_RUNNER_CLONE_IMAGE=nexus.company.local/drone/git

参考:https://docs.drone.io/runner/docker/configuration/reference/drone-runner-clone-image/