介绍
在k8s集群中,通过drone与bitbucket server集成实现软件开发的持续集成与构建。
软件清单
- drone (v1.0.0-rc.5)
- bitbucket server (v6.2.0)
部署
通过helm进行部署 https://github.com/helm/charts/tree/master/stable/drone
drone环境变量参考 https://docs.drone.io/installation/bitbucket-server/kubernetes/
# drone-bitbucket-values.yaml
# helm install stable/drone -f drone-bitbucket-values.yaml --name drone-bitbucket --namespace drone-bitbucket --version v2.0.0-rc.9
# values.yaml
# https://github.com/helm/charts/blob/master/stable/drone/values.yaml
service:
type: NodePort
ingress:
enabled: true
hosts:
- drone-bitbucket.antio.top
## Drone Ingress TLS configuration secrets
## Must be manually created in the namespace
##
tls:
- secretName: drone-bitbucket-tls
hosts:
- drone-bitbucket.antio.top
sourceControl:
## your source control provider: github,gitlab,gitea,gogs,bitbucketCloud,bitbucketServer
provider: "bitbucketServer"
## secret containing your source control provider secrets, keys provided below.
## if left blank will assume a secret based on the release name of the chart.
# 在k8s中创建名为drone-bitbucket-source-control的secret,key、value分别对应consumerKey,privateKey,passwordKey的值
secret: drone-bitbucket-source-control
## Fill in the correct values for your chosen source control provider
## Any key in this list with the suffix `Key` will be fetched from the
## secret named above, if not provided the secret it will be created as
## `<fullName>-source-control` using for the key "ClientSecretKey" and
# "clientSecretValue" for the value. Be awere to not leak shis file with your password
# github:
# clientID:
# clientSecretKey: clientSecret
# clientSecretValue:
# server: https://github.com
# gitlab:
# clientID:
# clientSecretKey: clientSecret
# clientSecretValue:
# server:
# gitea:
# server:
# gogs:
# server:
# bitbucketCloud:
# clientID:
# clientSecretKey: clientSecret
# clientSecretValue:
bitbucketServer:
server: "https://bitbucket.antio.top"
# consumerKey配置为OauthKey,存于drone-bitbucket-source-control中
consumerKey: consumerKey
# 一般为 /etc/bitbucket/key.pem,存于drone-bitbucket-source-control中
privateKey: privateKey
# username更改为你的bitbucket用户名,字符串
username: "username"
# username对应创建的bitbucket token,存于drone-bitbucket-source-control中
passwordKey: passwordKey
bitbucketCloud:
# 此三项必须添加,chart模板中bitbucketServer的这三项配置被对应到了bitbucketCloud,应该会在后续版本中修复,当前chart版本v2.0.0-rc.9
consumerKey: consumerKey
privateKey: privateKey
passwordKey: passwordKey
server:
protocol: https
host: "drone-bitbucket.antio.top"
env:
DRONE_DEBUG: "false"
DRONE_DATABASE_DRIVER: "sqlite3"
DRONE_DATABASE_DATASOURCE: "/var/lib/drone/drone.sqlite"
## Drone requires some environment variables to bootstrap the
## git service or it won't start up.
## Uncomment this and add your own custom configuration.
DRONE_SERVER_HOST: "drone-bitbucket.antio.top"
persistence:
enabled: true
storageClass: "nfs-client"