如何将 Drone runner 与 Gitlab 一起使用且 DRONE_RUNNER_CAPACITY > 1?

问题描述 投票:0回答:1

我正在尝试将 Drone 服务器(版本 2.17)及其 docker runner(版本 1.8)与 GitLab(版本 16.0)一起使用。

我使用以下配置:

services:
  drone:
    image: drone/drone:2.17
    container_name: drone-srv
    restart: always
    ports:
      - "5100:80"
    volumes:
      - /var/lib/drone:/data
    environment:
      DRONE_GITLAB_SERVER: <server>
      DRONE_GITLAB_CLIENT_ID: <client_id>
      DRONE_GITLAB_CLIENT_SECRET: <secret>
      DRONE_GITLAB_SKIP_VERIFY: "true"
      DRONE_RPC_SECRET: <secret>
      DRONE_SERVER_HOST: <host>
      DRONE_SERVER_PROTO: https
      DRONE_USER_CREATE: username:admin,admin:true
      DOCKER_API_VERSION: 1.39
  runner:
    image: drone/drone-runner-docker:1.8
    container_name: drone-runner
    restart: always
    ports:
      - "5110:3000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      DRONE_RPC_PROTO: https
      DRONE_RPC_HOST: <host>
      DRONE_RPC_SECRET: <secret>
      DRONE_RUNNER_CAPACITY: 5
      DRONE_RUNNER_NAME: drone-docker-runner-1
      DRONE_RUNNER_ENVIRON: GIT_SSL_NO_VERIFY:false     

问题在于 DRONE_RUNNER_CAPACITY > 1(即 DRONE_RUNNER_CAPACITY = 5,如上例所示)会使运行程序无法通过 GitLab OAuth 流程。结果,管道被卡住,我在运行程序日志中收到大量消息,如下所示:

time="2023-06-20T07:27:05Z" level=error msg="cannot get stage details" error="The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client." stage.id=7170 stage.name="..." stage.number=1 thread=5

据我了解,问题是多个无人机运行线程正在使用相同的授权并以某种方式相互干扰。结果,只有一个线程实际工作,其他线程因上述授权错误而失败,因此陷入困境。

那么我怎样才能让它发挥作用呢?

与 DRONE_RUNNER_CAPACITY=1 完全相同的配置可以完美运行。但是,我想增加一次运行多个管道的容量。

oauth gitlab drone.io
1个回答
0
投票

看看这个问题 https://github.com/harness/gitness/issues/3260

drone_server 添加环境变量的临时解决方案

DRONE_GIT_USERNAME=robot_username/oauth2 DRONE_GIT_PASSWORD=机器人密码/个人令牌

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