Browse Source

drone pull1

master
zhipeng.hu 3 years ago
parent
commit
e52c7c26ef
  1. 62
      .drone.yml
  2. 2
      main.go

62
.drone.yml

@ -9,30 +9,30 @@ volumes:
path: /usr/local/path/gopath path: /usr/local/path/gopath
steps: 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: 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 # - name: rancher-deploy
# # drone-rancher插件,利用此插件来启动rancher # # drone-rancher插件,利用此插件来启动rancher
@ -46,13 +46,13 @@ steps:
# # 为了使rancher能拉取到私有镜像, 需要在rancher控制面板"基础架构->镜像库"添加这个私有镜像库 # # 为了使rancher能拉取到私有镜像, 需要在rancher控制面板"基础架构->镜像库"添加这个私有镜像库
# docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:20 # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:20
- name: run
image: pelotech/drone-rancher
url: https://121.40.194.123:8443
access_key: token-j24z5
secret_key: fwbzktwzs4kqf8p4pzsfn92thzms76vrglghh2khmdxkr6svm57796
service: default/test-drone
docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:20
# - name: run
# image: pelotech/drone-rancher
# url: https://121.40.194.123:8443
# access_key: token-j24z5
# secret_key: fwbzktwzs4kqf8p4pzsfn92thzms76vrglghh2khmdxkr6svm57796
# service: default/test-drone
# docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:20
# - name: rancher-deploy # - name: rancher-deploy
# image: peloton/drone-rancher # image: peloton/drone-rancher

2
main.go

@ -12,7 +12,7 @@ func main() {
r.GET("/", func(c *gin.Context) { r.GET("/", func(c *gin.Context) {
// 通过请求上下文对象Context, 直接往客户端返回一个json // 通过请求上下文对象Context, 直接往客户端返回一个json
c.JSON(200, gin.H{ c.JSON(200, gin.H{
"message": "pong",
"message": "pong1",
}) })
}) })

Loading…
Cancel
Save