mirror of
https://github.com/thegeeklab/drone-matrix.git
synced 2024-11-28 13:10:35 +00:00
Merge pull request #15 from drone-plugins/improve-config
Drop renovate, proper version definition, unified jsonnet config
This commit is contained in:
commit
51e2469d51
177
.drone.jsonnet
177
.drone.jsonnet
@ -1,169 +1,14 @@
|
|||||||
local PipelineTesting = {
|
local pipeline = import 'pipeline.libsonnet';
|
||||||
kind: "pipeline",
|
local name = 'drone-matrix';
|
||||||
name: "testing",
|
|
||||||
platform: {
|
|
||||||
os: "linux",
|
|
||||||
arch: "amd64",
|
|
||||||
},
|
|
||||||
steps: [
|
|
||||||
{
|
|
||||||
name: "vet",
|
|
||||||
image: "golang:1.11",
|
|
||||||
pull: "always",
|
|
||||||
environment: {
|
|
||||||
GO111MODULE: "on",
|
|
||||||
},
|
|
||||||
commands: [
|
|
||||||
"go vet ./...",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "test",
|
|
||||||
image: "golang:1.11",
|
|
||||||
pull: "always",
|
|
||||||
environment: {
|
|
||||||
GO111MODULE: "on",
|
|
||||||
},
|
|
||||||
commands: [
|
|
||||||
"go test -cover ./...",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
trigger: {
|
|
||||||
branch: [ "master" ],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
local PipelineBuild(os="linux", arch="amd64") = {
|
|
||||||
kind: "pipeline",
|
|
||||||
name: os + "-" + arch,
|
|
||||||
platform: {
|
|
||||||
os: os,
|
|
||||||
arch: arch,
|
|
||||||
},
|
|
||||||
steps: [
|
|
||||||
{
|
|
||||||
name: "build-push",
|
|
||||||
image: "golang:1.11",
|
|
||||||
pull: "always",
|
|
||||||
environment: {
|
|
||||||
CGO_ENABLED: "0",
|
|
||||||
GO111MODULE: "on",
|
|
||||||
},
|
|
||||||
commands: [
|
|
||||||
"go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-matrix",
|
|
||||||
],
|
|
||||||
when: {
|
|
||||||
event: [ "push", "pull_request" ],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "build-tag",
|
|
||||||
image: "golang:1.11",
|
|
||||||
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 + "/drone-matrix",
|
|
||||||
],
|
|
||||||
when: {
|
|
||||||
event: [ "tag" ],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "executable",
|
|
||||||
image: "golang:1.11",
|
|
||||||
pull: "always",
|
|
||||||
commands: [
|
|
||||||
"./release/" + os + "/" + arch + "/drone-matrix --help",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "dryrun",
|
|
||||||
image: "plugins/docker:" + os + "-" + arch,
|
|
||||||
pull: "always",
|
|
||||||
settings: {
|
|
||||||
dry_run: true,
|
|
||||||
tags: os + "-" + arch,
|
|
||||||
dockerfile: "docker/Dockerfile." + os + "." + arch,
|
|
||||||
repo: "plugins/matrix",
|
|
||||||
username: { "from_secret": "docker_username" },
|
|
||||||
password: { "from_secret": "docker_password" },
|
|
||||||
},
|
|
||||||
when: {
|
|
||||||
event: [ "pull_request" ],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "publish",
|
|
||||||
image: "plugins/docker:" + os + "-" + arch,
|
|
||||||
pull: "always",
|
|
||||||
settings: {
|
|
||||||
auto_tag: true,
|
|
||||||
auto_tag_suffix: os + "-" + arch,
|
|
||||||
dockerfile: "docker/Dockerfile." + os + "." + arch,
|
|
||||||
repo: "plugins/matrix",
|
|
||||||
username: { "from_secret": "docker_username" },
|
|
||||||
password: { "from_secret": "docker_password" },
|
|
||||||
},
|
|
||||||
when: {
|
|
||||||
event: [ "push", "tag" ],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
depends_on: [
|
|
||||||
"testing",
|
|
||||||
],
|
|
||||||
trigger: {
|
|
||||||
branch: [ "master" ],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
local PipelineNotifications = {
|
|
||||||
kind: "pipeline",
|
|
||||||
name: "notifications",
|
|
||||||
platform: {
|
|
||||||
os: "linux",
|
|
||||||
arch: "amd64",
|
|
||||||
},
|
|
||||||
steps: [
|
|
||||||
{
|
|
||||||
name: "manifest",
|
|
||||||
image: "plugins/manifest:1",
|
|
||||||
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: [
|
|
||||||
"linux-amd64",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-arm",
|
|
||||||
],
|
|
||||||
trigger: {
|
|
||||||
branch: [ "master" ],
|
|
||||||
event: [ "push", "tag" ],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
[
|
[
|
||||||
PipelineTesting,
|
pipeline.test('linux', 'amd64'),
|
||||||
PipelineBuild("linux", "amd64"),
|
pipeline.build(name, 'linux', 'amd64'),
|
||||||
PipelineBuild("linux", "arm64"),
|
pipeline.build(name, 'linux', 'arm64'),
|
||||||
PipelineBuild("linux", "arm"),
|
pipeline.build(name, 'linux', 'arm'),
|
||||||
PipelineNotifications,
|
pipeline.notifications(depends_on=[
|
||||||
|
'linux-amd64',
|
||||||
|
'linux-arm64',
|
||||||
|
'linux-arm',
|
||||||
|
]),
|
||||||
]
|
]
|
||||||
|
9
.drone.windows.jsonnet
Normal file
9
.drone.windows.jsonnet
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
local pipeline = import 'pipeline.libsonnet';
|
||||||
|
local name = 'drone-matrix';
|
||||||
|
|
||||||
|
[
|
||||||
|
pipeline.test('windows', 'amd64', '1803'),
|
||||||
|
pipeline.build(name, 'windows', 'amd64', '1803'),
|
||||||
|
pipeline.build(name, 'windows', 'amd64', '1809'),
|
||||||
|
pipeline.notifications('windows', 'amd64', '1809', ['windows-1803', 'windows-1809']),
|
||||||
|
]
|
@ -1,30 +1,73 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: windows-amd64
|
name: testing
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: windows
|
os: windows
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
version: 1803
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: vet
|
||||||
|
pull: always
|
||||||
|
image: golang:1.11-windowsservercore-1803
|
||||||
|
commands:
|
||||||
|
- go vet ./...
|
||||||
|
environment:
|
||||||
|
GO111MODULE: on
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: C:\\gopath
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
pull: always
|
||||||
|
image: golang:1.11-windowsservercore-1803
|
||||||
|
commands:
|
||||||
|
- go test -cover ./...
|
||||||
|
environment:
|
||||||
|
GO111MODULE: on
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: C:\\gopath
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
temp: {}
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: windows-1803
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: windows
|
||||||
|
arch: amd64
|
||||||
|
version: 1803
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11-windowsservercore-1803
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/windows/amd64/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-matrix.exe"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11-windowsservercore-1803
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/windows/amd64/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-matrix.exe"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -34,43 +77,196 @@ steps:
|
|||||||
|
|
||||||
- name: executable
|
- name: executable
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11-windowsservercore-1803
|
||||||
commands:
|
commands:
|
||||||
- ./release/windows/amd64/drone-matrix --help
|
- ./release/windows/amd64/drone-matrix.exe --help
|
||||||
|
|
||||||
- name: dryrun
|
- name: dryrun
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:windows-amd64
|
image: plugins/docker:windows-1803
|
||||||
settings:
|
settings:
|
||||||
dockerfile: docker/Dockerfile.windows.amd64
|
daemon_off: true
|
||||||
|
dockerfile: docker/Dockerfile.windows.1803
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: plugins/matrix
|
repo: plugins/matrix
|
||||||
tags: windows-amd64
|
tags: windows-1803
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
- name: publish
|
- name: publish
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:windows-amd64
|
image: plugins/docker:windows-1803
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: windows-amd64
|
auto_tag_suffix: windows-1803
|
||||||
dockerfile: docker/Dockerfile.windows.amd64
|
daemon_off: true
|
||||||
|
dockerfile: docker/Dockerfile.windows.1803
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: plugins/matrix
|
repo: plugins/matrix
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
host:
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- testing
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: windows-1809
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: windows
|
||||||
|
arch: amd64
|
||||||
|
version: 1809
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build-push
|
||||||
|
pull: always
|
||||||
|
image: golang:1.11-windowsservercore-1809
|
||||||
|
commands:
|
||||||
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-matrix.exe"
|
||||||
|
environment:
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
GO111MODULE: on
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
- name: build-tag
|
||||||
|
pull: always
|
||||||
|
image: golang:1.11-windowsservercore-1809
|
||||||
|
commands:
|
||||||
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-matrix.exe"
|
||||||
|
environment:
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
GO111MODULE: on
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
- name: executable
|
||||||
|
pull: always
|
||||||
|
image: golang:1.11-windowsservercore-1809
|
||||||
|
commands:
|
||||||
|
- ./release/windows/amd64/drone-matrix.exe --help
|
||||||
|
|
||||||
|
- name: dryrun
|
||||||
|
pull: always
|
||||||
|
image: plugins/docker:windows-1809
|
||||||
|
settings:
|
||||||
|
daemon_off: true
|
||||||
|
dockerfile: docker/Dockerfile.windows.1809
|
||||||
|
dry_run: true
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: plugins/matrix
|
||||||
|
tags: windows-1809
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
pull: always
|
||||||
|
image: plugins/docker:windows-1809
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: windows-1809
|
||||||
|
daemon_off: true
|
||||||
|
dockerfile: docker/Dockerfile.windows.1809
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: plugins/matrix
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
host:
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- testing
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: notifications
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: windows
|
||||||
|
arch: amd64
|
||||||
|
version: 1809
|
||||||
|
|
||||||
|
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
|
||||||
|
settings:
|
||||||
|
url:
|
||||||
|
from_secret: microbadger_url
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- windows-1803
|
||||||
|
- windows-1809
|
||||||
|
|
||||||
|
...
|
||||||
|
88
.drone.yml
88
.drone.yml
@ -14,6 +14,9 @@ steps:
|
|||||||
- go vet ./...
|
- go vet ./...
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
pull: always
|
pull: always
|
||||||
@ -22,10 +25,19 @@ steps:
|
|||||||
- go test -cover ./...
|
- go test -cover ./...
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
temp: {}
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@ -40,20 +52,20 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-matrix"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-matrix"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -71,6 +83,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:linux-amd64
|
image: plugins/docker:linux-amd64
|
||||||
settings:
|
settings:
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.amd64
|
dockerfile: docker/Dockerfile.linux.amd64
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
@ -89,6 +102,7 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64
|
auto_tag_suffix: linux-amd64
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.amd64
|
dockerfile: docker/Dockerfile.linux.amd64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -97,12 +111,14 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- testing
|
- testing
|
||||||
@ -120,20 +136,20 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-matrix"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-matrix"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -151,6 +167,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:linux-arm64
|
image: plugins/docker:linux-arm64
|
||||||
settings:
|
settings:
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm64
|
dockerfile: docker/Dockerfile.linux.arm64
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
@ -169,6 +186,7 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-arm64
|
auto_tag_suffix: linux-arm64
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm64
|
dockerfile: docker/Dockerfile.linux.arm64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -177,12 +195,14 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- testing
|
- testing
|
||||||
@ -200,20 +220,20 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-matrix"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-matrix"
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-matrix"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -231,6 +251,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:linux-arm
|
image: plugins/docker:linux-arm
|
||||||
settings:
|
settings:
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm
|
dockerfile: docker/Dockerfile.linux.arm
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
@ -249,6 +270,7 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-arm
|
auto_tag_suffix: linux-arm
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm
|
dockerfile: docker/Dockerfile.linux.arm
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -257,12 +279,14 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- testing
|
- testing
|
||||||
@ -278,7 +302,7 @@ platform:
|
|||||||
steps:
|
steps:
|
||||||
- name: manifest
|
- name: manifest
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/manifest:1
|
image: plugins/manifest
|
||||||
settings:
|
settings:
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
@ -289,17 +313,15 @@ steps:
|
|||||||
|
|
||||||
- name: microbadger
|
- name: microbadger
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/webhook:1
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
url:
|
url:
|
||||||
from_secret: microbadger_url
|
from_secret: microbadger_url
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
event:
|
- "refs/tags/**"
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- linux-amd64
|
- linux-amd64
|
||||||
|
71
Gopkg.lock
generated
71
Gopkg.lock
generated
@ -1,71 +0,0 @@
|
|||||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
|
||||||
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/aymerick/raymond"
|
|
||||||
packages = [
|
|
||||||
".",
|
|
||||||
"ast",
|
|
||||||
"lexer",
|
|
||||||
"parser"
|
|
||||||
]
|
|
||||||
revision = "2eebd0f5dd9564c0c6e439df11d8a3c7b9b9ab11"
|
|
||||||
version = "v2.0.2"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/drone/drone-template-lib"
|
|
||||||
packages = ["template"]
|
|
||||||
revision = "5748d3149f4859c6d6cf43edb4fa35bba379c918"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/matrix-org/gomatrix"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "a7fc80c8060c2544fe5d4dae465b584f8e9b4e27"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/microcosm-cc/bluemonday"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "dafebb5b6ff2861a0d69af64991e10866c19be85"
|
|
||||||
version = "v1.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/pkg/errors"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
|
||||||
version = "v0.8.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/shurcooL/sanitized_anchor_name"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "86672fcb3f950f35f2e675df2240550f2a50762f"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/urfave/cli"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "cfb38830724cc34fedffe9a2a29fb54fa9169cd1"
|
|
||||||
version = "v1.20.0"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
name = "golang.org/x/net"
|
|
||||||
packages = [
|
|
||||||
"html",
|
|
||||||
"html/atom"
|
|
||||||
]
|
|
||||||
revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "gopkg.in/russross/blackfriday.v2"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "cadec560ec52d93835bf2f15bd794700d3a2473b"
|
|
||||||
version = "v2.0.0"
|
|
||||||
|
|
||||||
[solve-meta]
|
|
||||||
analyzer-name = "dep"
|
|
||||||
analyzer-version = 1
|
|
||||||
inputs-digest = "243a217f076aeb5fdc8b28a2a2f38884c3476409410f664e316cd92acf44d012"
|
|
||||||
solver-name = "gps-cdcl"
|
|
||||||
solver-version = 1
|
|
27
Gopkg.toml
27
Gopkg.toml
@ -1,27 +0,0 @@
|
|||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/drone/drone-template-lib"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/matrix-org/gomatrix"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/pkg/errors"
|
|
||||||
version = "0.8.0"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/urfave/cli"
|
|
||||||
version = "1.20.0"
|
|
||||||
|
|
||||||
[prune]
|
|
||||||
go-tests = true
|
|
||||||
unused-packages = true
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "gopkg.in/russross/blackfriday.v2"
|
|
||||||
version = "2.0.0"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/microcosm-cc/bluemonday"
|
|
||||||
version = "1.0.0"
|
|
25
README.md
25
README.md
@ -12,24 +12,31 @@ Drone plugin for sending build notifications to [Matrix](https://matrix.org/). F
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
Build the binary with the following commands:
|
Build the binary with the following command:
|
||||||
|
|
||||||
```
|
```console
|
||||||
go build
|
export GOOS=linux
|
||||||
|
export GOARCH=amd64
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-matrix
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
Build the Docker image with the following commands:
|
Build the Docker image with the following command:
|
||||||
|
|
||||||
```
|
```console
|
||||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-matrix
|
docker build \
|
||||||
docker build --rm -t plugins/matrix .
|
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||||
|
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||||
|
--file docker/Dockerfile.linux.amd64 --tag plugins/matrix .
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```console
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e PLUGIN_ROOMID=0123456789abcdef:matrix.org \
|
-e PLUGIN_ROOMID=0123456789abcdef:matrix.org \
|
||||||
-e PLUGIN_USERNAME=yourbot \
|
-e PLUGIN_USERNAME=yourbot \
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/base:windows-amd64
|
FROM plugins/base:windows-1803
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
org.label-schema.name="Drone Matrix" `
|
org.label-schema.name="Drone Matrix" `
|
||||||
org.label-schema.vendor="Drone.IO Community" `
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
org.label-schema.schema-version="1.0"
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
ADD release\drone-matrix.exe c:\drone-matrix.exe
|
ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
|
||||||
ENTRYPOINT [ "c:\\drone-matrix.exe" ]
|
ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
|
10
docker/Dockerfile.windows.1809
Normal file
10
docker/Dockerfile.windows.1809
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/base:windows-1809
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Matrix" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
|
@ -1,4 +1,4 @@
|
|||||||
image: plugins/matrix:{{#if build.tag}}{{trimPrefix build.tag "v"}}{{else}}latest{{/if}}
|
image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
@ -7,25 +7,31 @@ tags:
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
manifests:
|
manifests:
|
||||||
-
|
-
|
||||||
image: plugins/matrix:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-amd64
|
image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
-
|
-
|
||||||
image: plugins/matrix:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm64
|
image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
platform:
|
platform:
|
||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
-
|
-
|
||||||
image: plugins/matrix:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm
|
image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
platform:
|
platform:
|
||||||
architecture: arm
|
architecture: arm
|
||||||
os: linux
|
os: linux
|
||||||
variant: v7
|
variant: v7
|
||||||
-
|
-
|
||||||
image: plugins/matrix:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-amd64
|
image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
variant: 1809
|
version: 1803
|
||||||
|
-
|
||||||
|
image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1809
|
||||||
|
13
go.mod
Normal file
13
go.mod
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module github.com/drone-plugins/drone-matrix
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/aymerick/raymond v2.0.2+incompatible
|
||||||
|
github.com/drone/drone-template-lib v0.0.0-20180401170447-5748d3149f48
|
||||||
|
github.com/matrix-org/gomatrix v0.0.0-20171003113848-a7fc80c8060c
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.0
|
||||||
|
github.com/pkg/errors v0.8.0
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95
|
||||||
|
github.com/urfave/cli v1.20.0
|
||||||
|
golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a
|
||||||
|
gopkg.in/russross/blackfriday.v2 v2.0.0
|
||||||
|
)
|
18
go.sum
Normal file
18
go.sum
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
github.com/aymerick/raymond v2.0.2+incompatible h1:VEp3GpgdAnv9B2GFyTvqgcKvY+mfKMjPOA3SbKLtnU0=
|
||||||
|
github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
|
||||||
|
github.com/drone/drone-template-lib v0.0.0-20180401170447-5748d3149f48 h1:hP2l5isqaiJVvOUM8X/1WDNeeJKlVmM8I1B9aDNT/xw=
|
||||||
|
github.com/drone/drone-template-lib v0.0.0-20180401170447-5748d3149f48/go.mod h1:u34woe41m58Whrf21iH6z/xLOIRM3650LhWAyUc7Oik=
|
||||||
|
github.com/matrix-org/gomatrix v0.0.0-20171003113848-a7fc80c8060c h1:aZap604NyBGhAUE0CyNHz6+Pryye5A5mHnYyO4KPPW8=
|
||||||
|
github.com/matrix-org/gomatrix v0.0.0-20171003113848-a7fc80c8060c/go.mod h1:3fxX6gUjWyI/2Bt7J1OLhpCzOfO/bB3AiX0cJtEKud0=
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.0 h1:dr58SIfmOwOVr+m4Ye1xLWv8Dk9OFwXAtYnbJSmJ65k=
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.0/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
|
||||||
|
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 h1:/vdW8Cb7EXrkqWGufVMES1OH2sU9gKVb2n9/1y5NMBY=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
||||||
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
|
golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a h1:8fCF9zjAir2SP3N+axz9xs+0r4V8dqPzqsWO10t8zoo=
|
||||||
|
golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
gopkg.in/russross/blackfriday.v2 v2.0.0 h1:+FlnIV8DSQnT7NZ43hcVKcdJdzZoeCmJj4Ql8gq5keA=
|
||||||
|
gopkg.in/russross/blackfriday.v2 v2.0.0/go.mod h1:6sSBNz/GtOm/pJTuh5UmBK2ZHfmnxGbl2NZg1UliSOI=
|
6
main.go
6
main.go
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -9,16 +8,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
version = "0.0.0"
|
version = "unknown"
|
||||||
build = "0"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "matrix plugin"
|
app.Name = "matrix plugin"
|
||||||
app.Usage = "matrix plugin"
|
app.Usage = "matrix plugin"
|
||||||
app.Version = fmt.Sprintf("%s+%s", version, build)
|
|
||||||
app.Action = run
|
app.Action = run
|
||||||
|
app.Version = version
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username",
|
Name: "username",
|
||||||
|
204
pipeline.libsonnet
Normal file
204
pipeline.libsonnet
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
local windows_pipe = '\\\\\\\\.\\\\pipe\\\\docker_engine';
|
||||||
|
local windows_pipe_volume = 'docker_pipe';
|
||||||
|
local test_pipeline_name = 'testing';
|
||||||
|
|
||||||
|
local windows(os) = os == 'windows';
|
||||||
|
|
||||||
|
local golang_image(os, version) =
|
||||||
|
'golang:' + '1.11' + if windows(os) then '-windowsservercore-' + version else '';
|
||||||
|
|
||||||
|
{
|
||||||
|
test(os='linux', arch='amd64', version='')::
|
||||||
|
local is_windows = windows(os);
|
||||||
|
local golang = golang_image(os, version);
|
||||||
|
local volumes = if is_windows then [{name: 'gopath', path: 'C:\\\\gopath'}] else [{name: 'gopath', path: '/go',}];
|
||||||
|
{
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: test_pipeline_name,
|
||||||
|
platform: {
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
version: if std.length(version) > 0 then version,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'vet',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go vet ./...',
|
||||||
|
],
|
||||||
|
volumes: volumes,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'test',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go test -cover ./...',
|
||||||
|
],
|
||||||
|
volumes: volumes,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: [
|
||||||
|
'refs/heads/master',
|
||||||
|
'refs/tags/**',
|
||||||
|
'refs/pull/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
volumes: [{name: 'gopath', temp: {}}]
|
||||||
|
},
|
||||||
|
|
||||||
|
build(name, os='linux', arch='amd64', version='')::
|
||||||
|
local is_windows = windows(os);
|
||||||
|
local tag = if is_windows then os + '-' + version else os + '-' + arch;
|
||||||
|
local file_suffix = std.strReplace(tag, '-', '.');
|
||||||
|
local volumes = if is_windows then [{ name: windows_pipe_volume, path: windows_pipe }] else [];
|
||||||
|
local golang = golang_image(os, version);
|
||||||
|
local plugin_repo = 'plugins/' + std.splitLimit(name, '-', 1)[1];
|
||||||
|
local extension = if is_windows then '.exe' else '';
|
||||||
|
{
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: tag,
|
||||||
|
platform: {
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
version: if std.length(version) > 0 then version,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'build-push',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
CGO_ENABLED: '0',
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/' + os + '/' + arch + '/' + name + extension,
|
||||||
|
],
|
||||||
|
when: {
|
||||||
|
event: {
|
||||||
|
exclude: ['tag'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'build-tag',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
CGO_ENABLED: '0',
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/' + os + '/' + arch + '/' + name + extension,
|
||||||
|
],
|
||||||
|
when: {
|
||||||
|
event: ['tag'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'executable',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
commands: [
|
||||||
|
'./release/' + os + '/' + arch + '/' + name + extension + ' --help',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'dryrun',
|
||||||
|
image: 'plugins/docker:' + tag,
|
||||||
|
pull: 'always',
|
||||||
|
settings: {
|
||||||
|
dry_run: true,
|
||||||
|
tags: tag,
|
||||||
|
dockerfile: 'docker/Dockerfile.' + file_suffix,
|
||||||
|
daemon_off: if is_windows then 'true' else 'false',
|
||||||
|
repo: plugin_repo,
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
},
|
||||||
|
volumes: if std.length(volumes) > 0 then volumes,
|
||||||
|
when: {
|
||||||
|
event: ['pull_request'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish',
|
||||||
|
image: 'plugins/docker:' + tag,
|
||||||
|
pull: 'always',
|
||||||
|
settings: {
|
||||||
|
auto_tag: true,
|
||||||
|
auto_tag_suffix: tag,
|
||||||
|
daemon_off: if is_windows then 'true' else 'false',
|
||||||
|
dockerfile: 'docker/Dockerfile.' + file_suffix,
|
||||||
|
repo: plugin_repo,
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
},
|
||||||
|
volumes: if std.length(volumes) > 0 then volumes,
|
||||||
|
when: {
|
||||||
|
event: {
|
||||||
|
exclude: ['pull_request'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: [
|
||||||
|
'refs/heads/master',
|
||||||
|
'refs/tags/**',
|
||||||
|
'refs/pull/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
depends_on: [test_pipeline_name],
|
||||||
|
volumes: if is_windows then [{ name: windows_pipe_volume, host: { path: windows_pipe } }],
|
||||||
|
},
|
||||||
|
|
||||||
|
notifications(os='linux', arch='amd64', version='', depends_on=[])::
|
||||||
|
{
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: 'notifications',
|
||||||
|
platform: {
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
version: if std.length(version) > 0 then version,
|
||||||
|
},
|
||||||
|
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',
|
||||||
|
pull: 'always',
|
||||||
|
settings: {
|
||||||
|
url: { from_secret: 'microbadger_url' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: [
|
||||||
|
'refs/heads/master',
|
||||||
|
'refs/tags/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
depends_on: depends_on,
|
||||||
|
},
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"config:base"
|
|
||||||
],
|
|
||||||
"docker": {
|
|
||||||
"fileMatch": [
|
|
||||||
"/docker/Dockerfile"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"labels": [
|
|
||||||
"renovate"
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user