跳到主要内容

Gitea

Woodpecker 内置支持 Gitea。要启用 Gitea,您应该使用以下环境变量配置 Woodpecker 容器:

WOODPECKER_GITEA=true
WOODPECKER_GITEA_URL=YOUR_GITEA_URL
WOODPECKER_GITEA_CLIENT=YOUR_GITEA_CLIENT
WOODPECKER_GITEA_SECRET=YOUR_GITEA_CLIENT_SECRET

Gitea 与容器在同一主机上

如果您在容器内也在同一主机上运行 Gitea,请确保代理可以访问它。 代理尝试使用 Gitea 通过其 API 报告的 URL 进行克隆。为了简化连接,您应该将 Woodpecker 代理添加到与 Gitea 相同的 docker 网络中。 否则,通信应该通过 docker0 网关(通常是 172.17.0.1)。

要配置 Docker 网络,如果网络名称是 gitea,请按如下方式配置:

docker-compose.yaml
 services:
[...]
woodpecker-agent:
[...]
environment:
- [...]
+ - WOODPECKER_BACKEND_DOCKER_NETWORK=gitea

注册

向 Gitea 注册您的应用程序以创建您的客户端 ID 和密钥。您可以在 Gitea 的 OAuth 应用程序设置中找到 https://gitea.<host>/user/settings/。非常重要的是,授权回调 URL 必须与您的 http(s) 方案和主机名完全匹配,路径为 https://<host>/authorize

如果您在与 Gitea 实例相同的主机上运行 Woodpecker CI 服务器,您可能还需要从 Gitea v1.16 开始允许本地连接。否则 webhooks 将失败。将以下行添加到您的 Gitea 配置中(通常在 /etc/gitea/conf/app.ini 中)。

[webhook]
ALLOWED_HOST_LIST=external,loopback

有关参考,请参阅 Configuration Cheat Sheet

gitea oauth setup

注意

确保您的 Gitea 配置允许使用固定的页面长度 50 请求 API。最大页面大小的默认值是 50,但如果您设置的值低于 50,一些 Woodpecker 功能将无法正常工作。另请参阅 Configuration Cheat Sheet

Configuration

This is a full list of configuration options. Please note that many of these options use default configuration values that should work for the majority of installations.


GITEA

  • Name: WOODPECKER_GITEA
  • Default: false

Enables the Gitea driver.


GITEA_URL

  • Name: WOODPECKER_GITEA_URL
  • Default: https://try.gitea.io

Configures the Gitea server address.


GITEA_CLIENT

  • Name: WOODPECKER_GITEA_CLIENT
  • Default: none

Configures the Gitea OAuth client id. This is used to authorize access.


GITEA_CLIENT_FILE

  • Name: WOODPECKER_GITEA_CLIENT_FILE
  • Default: none

Read the value for WOODPECKER_GITEA_CLIENT from the specified filepath


GITEA_SECRET

  • Name: WOODPECKER_GITEA_SECRET
  • Default: none

Configures the Gitea OAuth client secret. This is used to authorize access.


GITEA_SECRET_FILE

  • Name: WOODPECKER_GITEA_SECRET_FILE
  • Default: none

Read the value for WOODPECKER_GITEA_SECRET from the specified filepath


GITEA_SKIP_VERIFY

  • Name: WOODPECKER_GITEA_SKIP_VERIFY
  • Default: false

Configure if SSL verification should be skipped.