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.
|
|
|
kind: pipeline
|
|
|
|
name: golang-docker-ci
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: 执行代码检查
|
|
|
|
image: golang:latest
|
|
|
|
commands:
|
|
|
|
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
|
|
- golangci-lint run
|
|
|
|
|
|
|
|
- name: 编译二进制文件
|
|
|
|
image: golang:latest
|
|
|
|
environment:
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: amd64
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
# 编译生成二进制文件,我这儿叫 go-app,酌情修改
|
|
|
|
commands:
|
|
|
|
- go build -o go-app
|
|
|
|
|
|
|
|
- name: 打包Docker镜像并推送
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
registry: 需要推送的Docker私服服务器地址
|
|
|
|
repo: 需要打包的镜像名称
|
|
|
|
use_cache: true
|
|
|
|
username: 私服登录用户名
|
|
|
|
password: 私服登录密码
|
|
|
|
auto_tag: true # 自动打tag
|
|
|
|
# 也可以用下面这个手动指定
|
|
|
|
# tags:
|
|
|
|
# - latest
|
|
|
|
# - 0.0.1
|
|
|
|
when:
|
|
|
|
event: push
|
|
|
|
branch: master
|
|
|
|
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: notify
|
|
|
|
image: kaynewang/drone-wechat-robot
|
|
|
|
settings:
|
|
|
|
msgtype: markdown
|
|
|
|
key: 10b43cda-16ec-40a1-9367-dd1e67489cc7
|
|
|
|
content: >
|
|
|
|
{{#success build.status}}
|
|
|
|
第 {{build.number}} 次构建已完成,状态:构建成功
|
|
|
|
{{else}}
|
|
|
|
第 {{build.number}} 次构建已完成,状态:构建失败
|
|
|
|
{{/success}}
|
|
|
|
提交记录:{{commit.author}} - {{commit.message}}
|