You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.9 KiB
68 lines
1.9 KiB
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
volumes:
|
|
- name: gopath
|
|
host:
|
|
path: /usr/local/path/gopath
|
|
|
|
steps:
|
|
- name: golang-build
|
|
image: golang
|
|
volumes:
|
|
- name: gopath
|
|
path: /go
|
|
commands:
|
|
- export GOPROXY=https://goproxy.cn
|
|
- go mod init test-drone
|
|
- go mod tidy
|
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test-drone
|
|
when:
|
|
target: [ "" ]
|
|
|
|
- name: docker-push
|
|
image: plugins/docker
|
|
settings:
|
|
username: tjqmhu
|
|
password: tjqm4912
|
|
repo: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone
|
|
dockerfile: Dockerfile
|
|
registry: https://registry.cn-hangzhou.aliyuncs.com
|
|
tags: ${DRONE_BUILD_NUMBER}
|
|
when:
|
|
target: [ "" ]
|
|
|
|
- name: rancher-deploy
|
|
image: dubc/drone-rancher-stack-v1
|
|
url: https://121.40.194.123:8443/
|
|
stack: app-staging
|
|
accesskey: token-qqrhk
|
|
secretkey: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
|
|
pull: true
|
|
# image: pelotech/drone-rancher # drone-rancher插件,利用此插件来启动rancher
|
|
# settings:
|
|
# url: 'http://121.40.194.123:8082/v3'
|
|
# access_key: token-qqrhk
|
|
# secret_key: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
|
|
# service: registry.cn-hangzhou.aliyuncs.com
|
|
# docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} # 镜像地址及版本号
|
|
# start_first: false
|
|
# confirm: true
|
|
# timeout: 301
|
|
|
|
# ## 使用参数推送稳定镜像
|
|
# - name: deployment-replace-prod
|
|
# image: repository.241210.com/repository/base/kubectl:4
|
|
# commands:
|
|
# - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
|
|
# when:
|
|
# target: [ "pre","prod" ]
|
|
#
|
|
# - name: deploy-prod
|
|
# image: repository.241210.com/repository/base/kubectl:4
|
|
# commands:
|
|
# - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
|
|
# when:
|
|
# target: [ "pre","prod" ]
|