chore(docker): upgrade drone and dockerfile

This commit is contained in:
Bo-Yi Wu
2019-03-01 08:53:17 +08:00
parent eac91dc0af
commit ded8530d8e
16 changed files with 727 additions and 256 deletions
-65
View File
@@ -1,65 +0,0 @@
version: '{build}'
image: 'Visual Studio 2017'
platform: x64
clone_folder: 'c:\go\src\github.com\appleboy\drone-jenkins'
max_jobs: 1
environment:
GOPATH: c:\go
docker_username:
secure: em/TNLUXxG19O/HvbvfJuQ==
docker_password:
secure: Yo9FJJqihaNz5q8T4Jz8tQ==
branches:
only:
- master
install:
- ps: |
docker version
go version
- ps: |
$env:Path = "c:\go\bin;$env:Path"
build_script:
- ps: |
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
go build -ldflags "-X main.Version=$env:APPVEYOR_REPO_COMMIT -X main.BuildNum=$env:APPVEYOR_BUILD_VERSION" -a -o release/drone-jenkins.exe
} else {
$version = $env:APPVEYOR_REPO_TAG_NAME
go build -ldflags "-X main.Version=$version -X main.BuildNum=$env:APPVEYOR_BUILD_VERSION" -a -o release/drone-jenkins.exe
}
docker pull microsoft/nanoserver:10.0.14393.1884
docker build -f Dockerfile.windows -t appleboy/drone-jenkins:windows-amd64 .
test_script:
- ps: |
docker run --rm appleboy/drone-jenkins:windows-amd64 --version
deploy_script:
- ps: |
$ErrorActionPreference = 'Stop';
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) {
Write-Host Nothing to deploy.
} else {
echo $env:DOCKER_PASSWORD | docker login --username $env:DOCKER_USERNAME --password-stdin
if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) {
$major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.split('.')
docker push appleboy/drone-jenkins:windows-amd64
docker tag appleboy/drone-jenkins:windows-amd64 appleboy/drone-jenkins:$major.$minor.$patch-windows-amd64
docker push appleboy/drone-jenkins:$major.$minor.$patch-windows-amd64
docker tag appleboy/drone-jenkins:windows-amd64 appleboy/drone-jenkins:$major.$minor-windows-amd64
docker push appleboy/drone-jenkins:$major.$minor-windows-amd64
docker tag appleboy/drone-jenkins:windows-amd64 appleboy/drone-jenkins:$major-windows-amd64
docker push appleboy/drone-jenkins:$major-windows-amd64
} else {
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
docker push appleboy/drone-jenkins:windows-amd64
}
}
}
+16
View File
@@ -0,0 +1,16 @@
local pipeline = import 'pipeline.libsonnet';
local name = 'drone-jenkins';
[
pipeline.test,
pipeline.build(name, 'linux', 'amd64'),
pipeline.build(name, 'linux', 'arm64'),
pipeline.build(name, 'linux', 'arm'),
pipeline.release,
pipeline.notifications(depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
'release-binary',
]),
]
+357 -133
View File
@@ -1,155 +1,379 @@
workspace:
base: /go
path: src/github.com/appleboy/drone-jenkins
---
kind: pipeline
name: testing
clone:
git:
image: plugins/git
depth: 50
tags: true
platform:
os: linux
arch: amd64
pipeline:
lint:
image: golang:1.11
pull: true
group: test
commands:
- make vet
- make lint
- make test-vendor
- make misspell-check
steps:
- name: vet
pull: always
image: golang:1.12
commands:
- make vet
environment:
GO111MODULE: on
volumes:
- name: gopath
path: /go
test:
image: golang:1.11
pull: true
group: test
commands:
- make test
- make coverage
- name: misspell
pull: always
image: golang:1.12
commands:
- make misspell-check
environment:
GO111MODULE: on
volumes:
- name: gopath
path: /go
build_linux_amd64_with_module:
image: golang:1.11
pull: true
group: build
environment:
GO111MODULE: "on"
commands:
- make build_linux_amd64
- name: test
pull: always
image: golang:1.12
commands:
- make test
- make coverage
environment:
GO111MODULE: on
WEBHOOK_ID:
from_secret: webhook_id
WEBHOOK_TOKEN:
from_secret: webhook_token
volumes:
- name: gopath
path: /go
build_linux_amd64:
image: golang:1.11
pull: true
group: build
commands:
- make build_linux_amd64
- name: codecov
pull: always
image: robertstettner/drone-codecov
settings:
token:
from_secret: codecov_token
build_linux_i386:
image: golang:1.11
pull: true
group: build
commands:
- make build_linux_i386
volumes:
- name: gopath
temp: {}
build_linux_arm64:
image: golang:1.11
pull: true
group: build
commands:
- make build_linux_arm64
---
kind: pipeline
name: linux-amd64
build_linux_arm:
image: golang:1.11
pull: true
group: build
commands:
- make build_linux_arm
platform:
os: linux
arch: amd64
codecov:
image: robertstettner/drone-codecov
secrets: [ codecov_token ]
when:
event: [ push, pull_request ]
status: [ success ]
steps:
- name: build-push
pull: always
image: golang:1.12
commands:
- "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-jenkins"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
release:
image: golang:1.11
pull: true
commands:
- make release
when:
event: [ tag ]
local: false
- name: build-tag
pull: always
image: golang:1.12
commands:
- "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-jenkins"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
release_tag:
image: plugins/github-release
secrets: [ github_release_api_key ]
group: release
files:
- dist/release/*
when:
event: [ tag ]
local: false
- name: executable
pull: always
image: golang:1.12
commands:
- ./release/linux/amd64/drone-jenkins --help
publish_linux_amd64:
image: plugins/docker:17.12
group: release
pull: true
repo: ${DRONE_REPO}
secrets: [ docker_username, docker_password ]
- name: dryrun
pull: always
image: plugins/docker:linux-amd64
settings:
cache_from: appleboy/drone-jenkins
dockerfile: docker/Dockerfile.linux.amd64
dry_run: true
repo: appleboy/drone-jenkins
tags: linux-amd64
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-amd64
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
when:
event: [ push, tag ]
local: false
cache_from: appleboy/drone-jenkins
daemon_off: false
dockerfile: docker/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: appleboy/drone-jenkins
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
publish_alpine:
image: plugins/docker:17.12
group: release
pull: true
dockerfile: Dockerfile.alpine
secrets: [ docker_username, docker_password ]
auto_tag: true
auto_tag_suffix: linux-alpine
repo: ${DRONE_REPO}
when:
event: [ push, tag ]
local: false
trigger:
ref:
- refs/heads/master
- "refs/pull/**"
- "refs/tags/**"
publish_linux_i386:
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password ]
group: release
repo: ${DRONE_REPO}
auto_tag: true
auto_tag_suffix: linux-i386
dockerfile: Dockerfile.i386
when:
event: [ push, tag ]
local: false
depends_on:
- testing
publish_linux_arm64:
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password ]
group: release
repo: ${DRONE_REPO}
---
kind: pipeline
name: linux-arm64
platform:
os: linux
arch: arm64
steps:
- name: build-push
pull: always
image: golang:1.12
commands:
- "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-jenkins"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.12
commands:
- "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-jenkins"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.12
commands:
- ./release/linux/arm64/drone-jenkins --help
- name: dryrun
pull: always
image: plugins/docker:linux-arm64
settings:
cache_from: appleboy/drone-jenkins
dockerfile: docker/Dockerfile.linux.arm64
dry_run: true
repo: appleboy/drone-jenkins
tags: linux-arm64
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm64
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
dockerfile: Dockerfile.arm64
when:
event: [ push, tag ]
local: false
cache_from: appleboy/drone-jenkins
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm64
password:
from_secret: docker_password
repo: appleboy/drone-jenkins
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
publish_linux_arm:
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password ]
group: release
repo: ${DRONE_REPO}
trigger:
ref:
- refs/heads/master
- "refs/pull/**"
- "refs/tags/**"
depends_on:
- testing
---
kind: pipeline
name: linux-arm
platform:
os: linux
arch: arm
steps:
- name: build-push
pull: always
image: golang:1.12
commands:
- "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-jenkins"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.12
commands:
- "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-jenkins"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.12
commands:
- ./release/linux/arm/drone-jenkins --help
- name: dryrun
pull: always
image: plugins/docker:linux-arm
settings:
cache_from: appleboy/drone-jenkins
dockerfile: docker/Dockerfile.linux.arm
dry_run: true
repo: appleboy/drone-jenkins
tags: linux-arm
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm
settings:
auto_tag: true
auto_tag_suffix: linux-arm
dockerfile: Dockerfile.arm
when:
event: [ push, tag ]
local: false
cache_from: appleboy/drone-jenkins
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: appleboy/drone-jenkins
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/pull/**"
- "refs/tags/**"
depends_on:
- testing
---
kind: pipeline
name: release-binary
platform:
os: linux
arch: amd64
steps:
- name: build-all-binary
pull: always
image: golang:1.12
commands:
- make release
environment:
GO111MODULE: on
when:
event:
- tag
- name: deploy-all-binary
pull: always
image: plugins/github-release
settings:
api_key:
from_secret: github_release_api_key
files:
- "dist/release/*"
when:
event:
- tag
trigger:
ref:
- "refs/tags/**"
depends_on:
- testing
---
kind: pipeline
name: notifications
platform:
os: linux
arch: amd64
steps:
- name: manifest
pull: always
image: plugins/manifest
settings:
ignore_missing: true
password:
from_secret: docker_password
spec: docker/manifest.tmpl
username:
from_secret: docker_username
- name: microbadger
pull: always
image: plugins/webhook:1
settings:
url:
from_secret: microbadger_url
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64
- linux-arm64
- linux-arm
- release-binary
...
+25
View File
@@ -0,0 +1,25 @@
ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 1
warningCode = 1
[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.error-return]
[rule.error-strings]
[rule.error-naming]
[rule.exported]
[rule.if-return]
[rule.increment-decrement]
[rule.var-naming]
[rule.var-declaration]
[rule.package-comments]
[rule.range]
[rule.receiver-naming]
[rule.time-naming]
[rule.unexported-return]
[rule.indent-error-flow]
[rule.errorf]
-13
View File
@@ -1,13 +0,0 @@
FROM alpine:3.8
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
org.label-schema.name="Drone Jenkins" \
org.label-schema.vendor="Bo-Yi Wu" \
org.label-schema.schema-version="1.0"
RUN apk add -U --no-cache ca-certificates && \
rm -rf /var/cache/apk/*
ADD release/linux/amd64/drone-jenkins /bin/
ENTRYPOINT ["/bin/drone-jenkins"]
-10
View File
@@ -1,10 +0,0 @@
FROM plugins/base:multiarch
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
org.label-schema.name="Drone Jenkins" \
org.label-schema.vendor="Bo-Yi Wu" \
org.label-schema.schema-version="1.0"
ADD release/linux/i386/drone-jenkins /bin/
ENTRYPOINT ["/bin/drone-jenkins"]
+10 -27
View File
@@ -8,8 +8,7 @@ DEPLOY_ACCOUNT := appleboy
DEPLOY_IMAGE := $(EXECUTABLE)
TARGETS ?= linux darwin windows
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
PACKAGES ?= $(shell $(GO) list ./...)
SOURCES ?= $(shell find . -name "*.go" -type f)
TAGS ?=
LDFLAGS ?= -X 'main.Version=$(VERSION)'
@@ -30,58 +29,42 @@ endif
all: build
fmt:
$(GOFMT) -w $(GOFILES)
$(GOFMT) -w $(SOURCES)
vet:
$(GO) vet $(PACKAGES)
lint:
@which golint > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/golang/lint/golint; \
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mgechev/revive; \
fi
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
revive -config .revive.toml ./... || exit 1
.PHONY: misspell-check
misspell-check:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -error $(GOFILES)
misspell -error $(SOURCES)
.PHONY: misspell
misspell:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -w $(GOFILES)
misspell -w $(SOURCES)
.PHONY: fmt-check
fmt-check:
@diff=$$($(GOFMT) -d $(GOFILES)); \
@diff=$$($(GOFMT) -d $(SOURCES)); \
if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \
echo "$${diff}"; \
exit 1; \
fi;
.PHONY: test-vendor
test-vendor:
@hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/kardianos/govendor; \
fi
govendor list +unused | tee "$(TMPDIR)/wc-gitea-unused"
[ $$(cat "$(TMPDIR)/wc-gitea-unused" | wc -l) -eq 0 ] || echo "Warning: /!\\ Some vendor are not used /!\\"
govendor list +outside | tee "$(TMPDIR)/wc-gitea-outside"
[ $$(cat "$(TMPDIR)/wc-gitea-outside" | wc -l) -eq 0 ] || exit 1
govendor status || exit 1
test: fmt-check
for PKG in $(PACKAGES); do $(GO) test -v -cover -coverprofile $$GOPATH/src/$$PKG/coverage.txt $$PKG || exit 1; done;
html:
$(GO) tool cover -html=coverage.txt
@$(GO) test -v -cover -coverprofile coverage.txt $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
install: $(SOURCES)
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
@@ -100,7 +83,7 @@ release-build:
@which gox > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mitchellh/gox; \
fi
gox -os="$(TARGETS)" -arch="amd64 386" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"
gox -os="$(TARGETS)" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"
release-copy:
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
+9 -4
View File
@@ -1,4 +1,4 @@
<img src="logo.png">
<img src="images/logo.png">
# drone-jenkins
@@ -46,9 +46,14 @@ docker: Error response from daemon: Container command
There are three ways to trigger jenkins jobs.
* [usage from binary](#usage-from-binary)
* [usage from docker](#usage-from-docker)
* [usage from drone ci](#usage-from-drone-ci)
- [drone-jenkins](#drone-jenkins)
- [Build or Download a binary](#build-or-download-a-binary)
- [Docker](#docker)
- [Usage](#usage)
- [Usage from binary](#usage-from-binary)
- [Usage from docker](#usage-from-docker)
- [Usage from drone ci](#usage-from-drone-ci)
- [Testing](#testing)
<a name="usage-from-binary"></a>
### Usage from binary
+1 -1
View File
@@ -1,4 +1,4 @@
FROM plugins/base:multiarch
FROM plugins/base:linux-amd64
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
org.label-schema.name="Drone Jenkins" \
@@ -1,4 +1,4 @@
FROM plugins/base:multiarch
FROM plugins/base:linux-arm
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
org.label-schema.name="Drone Jenkins" \
@@ -1,4 +1,4 @@
FROM plugins/base:multiarch
FROM plugins/base:linux-arm64
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
org.label-schema.name="Drone Jenkins" \
@@ -1,4 +1,4 @@
FROM microsoft/nanoserver:10.0.14393.1884
FROM plugins/base:windows-amd64
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
org.label-schema.name="Drone Jenkins" \
+25
View File
@@ -0,0 +1,25 @@
image: appleboy/drone-jenkins:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: appleboy/drone-jenkins:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: appleboy/drone-jenkins:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
-
image: appleboy/drone-jenkins:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

+281
View File
@@ -0,0 +1,281 @@
{
test:: {
kind: 'pipeline',
name: 'testing',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'vet',
image: 'golang:1.12',
pull: 'always',
environment: {
GO111MODULE: 'on',
},
commands: [
'make vet',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
// {
// name: 'lint',
// image: 'golang:1.12',
// pull: 'always',
// environment: {
// GO111MODULE: 'on',
// },
// commands: [
// 'make lint',
// ],
// volumes: [
// {
// name: 'gopath',
// path: '/go',
// },
// ],
// },
{
name: 'misspell',
image: 'golang:1.12',
pull: 'always',
environment: {
GO111MODULE: 'on',
},
commands: [
'make misspell-check',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
{
name: 'test',
image: 'golang:1.12',
pull: 'always',
environment: {
GO111MODULE: 'on',
WEBHOOK_ID: { 'from_secret': 'webhook_id' },
WEBHOOK_TOKEN: { 'from_secret': 'webhook_token' },
},
commands: [
'make test',
'make coverage',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
{
name: 'codecov',
image: 'robertstettner/drone-codecov',
pull: 'always',
settings: {
token: { 'from_secret': 'codecov_token' },
},
},
],
volumes: [
{
name: 'gopath',
temp: {},
},
],
},
build(name, os='linux', arch='amd64'):: {
kind: 'pipeline',
name: os + '-' + arch,
platform: {
os: os,
arch: arch,
},
steps: [
{
name: 'build-push',
image: 'golang:1.12',
pull: 'always',
environment: {
CGO_ENABLED: '0',
GO111MODULE: 'on',
},
commands: [
'go build -v -ldflags \'-X main.build=${DRONE_BUILD_NUMBER}\' -a -o release/' + os + '/' + arch + '/' + name,
],
when: {
event: {
exclude: [ 'tag' ],
},
},
},
{
name: 'build-tag',
image: 'golang:1.12',
pull: 'always',
environment: {
CGO_ENABLED: '0',
GO111MODULE: 'on',
},
commands: [
'go build -v -ldflags \'-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\' -a -o release/' + os + '/' + arch + '/' + name,
],
when: {
event: [ 'tag' ],
},
},
{
name: 'executable',
image: 'golang:1.12',
pull: 'always',
commands: [
'./release/' + os + '/' + arch + '/' + name + ' --help',
],
},
{
name: 'dryrun',
image: 'plugins/docker:' + os + '-' + arch,
pull: 'always',
settings: {
daemon_off: false,
dry_run: true,
tags: os + '-' + arch,
dockerfile: 'docker/Dockerfile.' + os + '.' + arch,
repo: 'appleboy/' + name,
cache_from: 'appleboy/' + name,
},
when: {
event: [ 'pull_request' ],
},
},
{
name: 'publish',
image: 'plugins/docker:' + os + '-' + arch,
pull: 'always',
settings: {
daemon_off: 'false',
auto_tag: true,
auto_tag_suffix: os + '-' + arch,
dockerfile: 'docker/Dockerfile.' + os + '.' + arch,
repo: 'appleboy/' + name,
cache_from: 'appleboy/' + name,
username: { 'from_secret': 'docker_username' },
password: { 'from_secret': 'docker_password' },
},
when: {
event: {
exclude: [ 'pull_request' ],
},
},
},
],
depends_on: [
'testing',
],
trigger: {
ref: [
'refs/heads/master',
'refs/pull/**',
'refs/tags/**',
],
},
},
release:: {
kind: 'pipeline',
name: 'release-binary',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'build-all-binary',
image: 'golang:1.12',
pull: 'always',
environment: {
GO111MODULE: 'on',
},
commands: [
'make release'
],
when: {
event: [ 'tag' ],
},
},
{
name: 'deploy-all-binary',
image: 'plugins/github-release',
pull: 'always',
settings: {
files: [ 'dist/release/*' ],
api_key: { 'from_secret': 'github_release_api_key' },
},
when: {
event: [ 'tag' ],
},
},
],
depends_on: [
'testing',
],
trigger: {
ref: [
'refs/tags/**',
],
},
},
notifications(os='linux', arch='amd64', depends_on=[]):: {
kind: 'pipeline',
name: 'notifications',
platform: {
os: os,
arch: arch,
},
steps: [
{
name: 'manifest',
image: 'plugins/manifest',
pull: 'always',
settings: {
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'docker/manifest.tmpl',
ignore_missing: true,
},
},
{
name: 'microbadger',
image: 'plugins/webhook:1',
pull: 'always',
settings: {
url: { 'from_secret': 'microbadger_url' },
},
},
],
depends_on: depends_on,
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
},
},
signature(key):: {
kind: 'signature',
hmac: key,
}
}