让 Gitea 支持 Drone 持续集成工具
简介
Drone 是一个现代的持续集成工具
Drone by Harness™ is a modern Continuous Integration platform that empowers busy teams to automate their build, test and release workflows using a powerful, cloud native pipeline engine.
这几天心血来潮, 在自己的服务器上部署了一个Drone
, 配合很久以前自己搭建的Gitea
私有 git 仓库一起使用
让我们开始吧!
在 gitea 上创建 OAuth2 Application
记下生成的client id
和client key
, 后面要用
部署 Drone
我使用了 drone 推荐的容器部署方式, 官方直接用了docker run
, 我改用docker-compose
, 并且把drone
和 drone-runner-docker
放到了一起
|
|
上面的环境变量我就直接贴出官网的解释了
- drone
DRONE_GITEA_CLIENT_ID
Required string value provides your Gitea oauth Client ID.
DRONE_GITEA_CLIENT_SECRET
Required string value provides your Gitea oauth Client Secret.
DRONE_GITEA_SERVER
Required string value provides your Gitea server address. For example https://gitea.company.com, note the http(s) otherwise you’ll see an error with “unsupported protocol scheme” from Gitea.
DRONE_GIT_ALWAYS_AUTH
Optional boolean value configures Drone to authenticate when cloning public repositories.
DRONE_RPC_SECRET
Required string value provides the shared secret generated in the previous step. This is used to authenticate the rpc connection between the server and runners. The server and runner must be provided the same secret value.
DRONE_SERVER_HOST
Required string value provides your external hostname or IP address. If using an IP address you may include the port. For example drone.company.com.
DRONE_SERVER_PROTO
Required string value provides your external protocol scheme. This value should be set to http or https. This field defaults to https if you configure ssl or acme.
- drone-runner-docker
DRONE_RPC_HOST
provides the hostname (and optional port) of your Drone server. The runner connects to the server at the host address to receive pipelines for execution.
DRONE_RPC_PROTO
provides the protocol used to connect to your Drone server. The value must be either http or https.
DRONE_RPC_SECRET
provides the shared secret used to authenticate with your Drone server. This must match the secret defined in your Drone server configuration.
启用 drone-runner-exec
drone-runner-exec 用于在宿主机直接执行脚本, 需要独立安装
|
|
/etc/drone-runner-exec/config
:
|
|
|
|
测试
创建一个新的golang
项目test-drone
main.go
:
|
|
编写.drone.yml
文件
|
|