35 Commits

Author SHA1 Message Date
TP Honey 8a0ade0870 Merge pull request #70 from tphoney/use_correct_arm_runner
(fix) use correct arm runner
2023-09-15 16:31:44 +01:00
dependabot-ci 131f624843 (fix) use correct arm runner 2023-09-15 16:01:45 +01:00
TP Honey c92f28d142 Merge pull request #66 from tphoney/harness_move
(maint) move to harness.drone.io
2022-12-07 15:07:44 +00:00
TP Honey 05dd646658 (maint) move to harness.drone.io 2022-12-07 14:32:44 +00:00
Brad Rydzewski b83c004215 add plugin metadata [CI SKIP] 2022-10-03 15:54:33 -04:00
Don 8b44f3c41f Merge pull request #59 from jlehtimaki/master
This fixes false success on kubernetes
2020-08-26 08:11:23 -07:00
Joonas Lehtimäki 5d0c917e8f This fixes false success on kubernetes 2020-08-26 10:27:45 +03:00
Thomas Boerger dc62731f93 Merge pull request #58 from doubles-ss/master
Add support for Authorization type Bearer Token
2020-08-03 08:35:22 +02:00
Suriya.S b2d83444d1 Change token to token_value and add token_type for support other token type 2020-08-02 00:35:29 +07:00
Suriya.S 07a4386c3d Remove go version in go.mod 2020-08-01 11:10:34 +07:00
Suriya.S 739613d9dc Add Bearer token authen 2020-08-01 11:08:30 +07:00
Thomas Boerger 63eabce274 Merge pull request #56 from primait/fix-payload-signature
Fix payload signature flags
2020-07-14 22:23:37 +02:00
Michelangelo a4a3dd85d0 replace underscore with dash 2020-07-14 15:35:30 +02:00
Thomas Boerger 25de318efb Merge pull request #54 from primait/payload-signature
Payload signature
2020-06-29 09:19:27 +02:00
Michelangelo bff3a91abd Use dash instead of underscore 2020-06-28 18:00:01 +02:00
Michelangelo 32f681e175 Customizable signature header name, rename secret to signature_secret 2020-06-24 09:56:38 +02:00
Michelangelo Morrillo 770ffb857e Include signature algorithm in header field
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-05-21 15:34:57 +02:00
Michelangelo 7f2efea728 remove go version 2020-05-21 14:57:58 +02:00
Michelangelo a76e37dacb add support for signature header 2020-05-21 14:44:30 +02:00
Thomas Boerger b06afe33fc Merge pull request #53 from Jakob-em/master
Added deployTo to build data
2020-01-08 09:18:02 +01:00
Jakob em 79df46e1e2 Added deployTo to build data 2020-01-05 14:59:36 +01:00
Thomas Boerger e14fb4bea1 Merge pull request #48 from drone-plugins/starlark
Update build
2019-09-16 21:30:15 +02:00
Thomas Boerger e014932320 Use a more simple manifest format 2019-09-16 21:26:56 +02:00
Thomas Boerger 0e796ebab4 Use the right windows base tag 2019-09-16 21:26:36 +02:00
Thomas Boerger 8e7a4739ff Add more simple gitignore 2019-09-16 21:26:15 +02:00
Thomas Boerger 6e02fe8835 Notify gitter not for prs 2019-09-16 21:26:03 +02:00
Don 40d04ce615 Update drone yml 2019-08-29 15:00:37 -07:00
Don 6e11b7548c Add starlark 2019-08-29 15:00:37 -07:00
Don f9c3721cc1 Remove jsonnet 2019-08-29 15:00:37 -07:00
Don 92c5bc12cb Remove windows 1803 add windows 1903 2019-08-29 15:00:37 -07:00
Don 2299439e40 Fix url 2019-04-25 18:08:54 -07:00
Don 25db2cdd33 Use recommended windows tags 2019-04-25 15:52:02 -07:00
Don a505d07fb3 Update windows build 2019-04-25 15:39:28 -07:00
Thomas Boerger 211e64e531 Merge pull request #46 from xoxys/master
Fail if no urls specified
2019-03-18 13:43:55 +01:00
Robert Kaussow 04d1e28229 fail if no urls specified 2019-03-18 12:08:11 +01:00
15 changed files with 335 additions and 890 deletions
-14
View File
@@ -1,14 +0,0 @@
local pipeline = import 'pipeline.libsonnet';
local name = 'drone-webhook';
[
pipeline.test('linux', 'amd64'),
pipeline.build(name, 'linux', 'amd64'),
pipeline.build(name, 'linux', 'arm64'),
pipeline.build(name, 'linux', 'arm'),
pipeline.notifications(depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
]
-9
View File
@@ -1,9 +0,0 @@
local pipeline = import 'pipeline.libsonnet';
local name = 'drone-webhook';
[
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']),
]
-272
View File
@@ -1,272 +0,0 @@
---
kind: pipeline
name: testing
platform:
os: windows
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:
- name: build-push
pull: always
image: golang:1.11-windowsservercore-1803
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-webhook.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.11-windowsservercore-1803
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-webhook.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11-windowsservercore-1803
commands:
- ./release/windows/amd64/drone-webhook.exe --help
- name: dryrun
pull: always
image: plugins/docker:windows-1803
settings:
daemon_off: true
dockerfile: docker/Dockerfile.windows.1803
dry_run: true
password:
from_secret: docker_password
repo: plugins/webhook
tags: windows-1803
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-1803
settings:
auto_tag: true
auto_tag_suffix: windows-1803
daemon_off: true
dockerfile: docker/Dockerfile.windows.1803
password:
from_secret: docker_password
repo: plugins/webhook
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: 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-webhook.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-webhook.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-webhook.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/webhook
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/webhook
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
...
+203 -280
View File
@@ -1,331 +1,254 @@
---
kind: pipeline
type: vm
name: testing
platform:
os: linux
arch: amd64
pool:
use: ubuntu
steps:
- name: vet
pull: always
image: golang:1.11
commands:
- go vet ./...
environment:
GO111MODULE: on
volumes:
- name: gopath
path: /go
- name: test
pull: always
image: golang:1.11
commands:
- go test -cover ./...
environment:
GO111MODULE: on
volumes:
- name: gopath
path: /go
- name: lint
image: golang:1.20
pull: always
commands:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- golangci-lint version
- golangci-lint run
volumes:
- name: gopath
path: "/go"
- name: test
image: golang:1.20
commands:
- go test -cover ./...
volumes:
- name: gopath
path: "/go"
volumes:
- name: gopath
temp: {}
- name: gopath
temp: {}
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
- refs/heads/master
- refs/tags/**
- refs/pull/**
---
kind: pipeline
type: vm
name: linux-amd64
platform:
os: linux
arch: amd64
pool:
use: ubuntu
steps:
- name: build-push
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-webhook"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-webhook"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11
commands:
- ./release/linux/amd64/drone-webhook --help
- name: dryrun
pull: always
image: plugins/docker:linux-amd64
settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.amd64
dry_run: true
password:
from_secret: docker_password
repo: plugins/webhook
tags: linux-amd64
username:
from_secret: docker_username
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-amd64
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: plugins/webhook
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
- name: environment
image: golang:1.20
pull: always
environment:
CGO_ENABLED: "0"
commands:
- go version
- go env
- name: build
image: golang:1.20
environment:
CGO_ENABLED: "0"
commands:
- go build -v -ldflags "-X main.version=" -a -tags netgo -o release/linux/amd64/drone-webhook .
- name: docker
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.linux.amd64
repo: plugins/webhook
username:
from_secret: docker_username
password:
from_secret: docker_password
auto_tag: true
auto_tag_suffix: linux-amd64
depends_on:
- testing
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
- refs/heads/master
- refs/tags/**
- refs/pull/**
---
kind: pipeline
type: vm
name: linux-arm64
platform:
os: linux
arch: arm64
pool:
use: ubuntu_arm64
steps:
- name: build-push
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-webhook"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-webhook"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11
commands:
- ./release/linux/arm64/drone-webhook --help
- name: dryrun
pull: always
image: plugins/docker:linux-arm64
settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm64
dry_run: true
password:
from_secret: docker_password
repo: plugins/webhook
tags: linux-arm64
username:
from_secret: docker_username
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm64
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm64
password:
from_secret: docker_password
repo: plugins/webhook
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
- name: environment
image: golang:1.20
pull: always
environment:
CGO_ENABLED: "0"
commands:
- go version
- go env
- name: build
image: golang:1.20
environment:
CGO_ENABLED: "0"
commands:
- go build -v -ldflags "-X main.version=" -a -tags netgo -o release/linux/arm64/drone-webhook .
- name: docker
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.linux.arm64
repo: plugins/webhook
username:
from_secret: docker_username
password:
from_secret: docker_password
auto_tag: true
auto_tag_suffix: linux-arm64
depends_on:
- testing
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
- refs/heads/master
- refs/tags/**
- refs/pull/**
---
kind: pipeline
name: linux-arm
type: vm
name: windows-1809
platform:
os: linux
arch: arm
os: windows
arch: amd64
pool:
use: windows
steps:
- name: build-push
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-webhook"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.11
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-webhook"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11
commands:
- ./release/linux/arm/drone-webhook --help
- name: dryrun
pull: always
image: plugins/docker:linux-arm
settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm
dry_run: true
password:
from_secret: docker_password
repo: plugins/webhook
tags: linux-arm
username:
from_secret: docker_username
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm
settings:
auto_tag: true
auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: plugins/webhook
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
- name: environment
image: golang:1.20
pull: always
environment:
CGO_ENABLED: "0"
commands:
- go version
- go env
- name: build
image: golang:1.20
environment:
CGO_ENABLED: "0"
commands:
- go build -v -ldflags "-X main.version=" -a -tags netgo -o release/windows/amd64/drone-webhook.exe .
- name: docker
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.windows.1809
repo: plugins/webhook
username:
from_secret: docker_username
password:
from_secret: docker_password
auto_tag: true
auto_tag_suffix: windows-1809-amd64
daemon_off: true
purge: false
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- testing
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
- refs/heads/master
- refs/tags/**
- refs/pull/**
---
kind: pipeline
name: notifications
type: vm
name: windows-ltsc2022
platform:
os: windows
arch: amd64
pool:
use: windows-2022
steps:
- name: environment
image: golang:1.20
pull: always
environment:
CGO_ENABLED: "0"
commands:
- go version
- go env
- name: build
image: golang:1.20
environment:
CGO_ENABLED: "0"
commands:
- go build -v -ldflags "-X main.version=" -a -tags netgo -o release/windows/amd64/drone-webhook.exe .
- name: docker
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.windows.ltsc2022
repo: plugins/webhook
username:
from_secret: docker_username
password:
from_secret: docker_password
auto_tag: true
auto_tag_suffix: windows-ltsc2022-amd64
daemon_off: true
purge: false
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- testing
trigger:
ref:
- refs/heads/master
- refs/tags/**
- refs/pull/**
---
kind: pipeline
type: vm
name: manifest
platform:
os: linux
arch: amd64
pool:
use: ubuntu
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
- name: manifest
image: plugins/manifest
settings:
auto_tag: "true"
username:
from_secret: docker_username
password:
from_secret: docker_password
spec: docker/manifest.tmpl
ignore_missing: true
depends_on:
- linux-amd64
- linux-arm64
- windows-1809
- windows-ltsc2022
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64
- linux-arm64
- linux-arm
...
- refs/heads/master
- refs/tags/**
-26
View File
@@ -1,30 +1,4 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
release/
vendor/
coverage.out
drone-webhook
-9
View File
@@ -1,9 +0,0 @@
FROM plugins/base:multiarch
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
org.label-schema.name="Drone Webhook" \
org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0"
ADD release/linux/arm/drone-webhook /bin/
ENTRYPOINT ["/bin/drone-webhook"]
+1 -1
View File
@@ -1,5 +1,5 @@
# escape=`
FROM plugins/base:windows-1809
FROM plugins/base:windows-1809-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Webhook" `
@@ -1,5 +1,5 @@
# escape=`
FROM plugins/base:windows-1803
FROM plugins/base:windows-ltsc2022-amd64@sha256:0f90d5bceb432f1ee6f93cf44eed6a38c322834edd55df8a6648c9e6f15131f4
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Webhook" `
+8 -17
View File
@@ -6,30 +6,21 @@ tags:
{{/each}}
{{/if}}
manifests:
-
image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
- image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
- image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
-
image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
-
image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
- image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
platform:
architecture: amd64
os: windows
version: 1809
- image: plugins/webhook:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
platform:
architecture: amd64
os: windows
version: ltsc2022
+8 -3
View File
@@ -1,12 +1,17 @@
module github.com/drone-plugins/drone-webhook
require (
github.com/drone/drone-template-lib v0.0.0-20181004051823-4019baa6c594
github.com/joho/godotenv v1.3.0
github.com/urfave/cli v1.20.0
)
require (
bou.ke/monkey v1.0.1 // indirect
github.com/aymerick/raymond v2.0.2+incompatible // indirect
github.com/drone/drone-template-lib v0.0.0-20181004051823-4019baa6c594
github.com/pkg/errors v0.8.1 // indirect
github.com/stretchr/testify v1.3.0 // indirect
github.com/tkuchiki/faketime v0.1.1 // indirect
github.com/urfave/cli v1.20.0
gopkg.in/yaml.v2 v2.2.2 // indirect
)
go 1.20
+2 -8
View File
@@ -2,22 +2,16 @@ bou.ke/monkey v1.0.1 h1:zEMLInw9xvNakzUUPjfS4Ds6jYPqCFx3m7bRmG5NH2U=
bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg=
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/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/drone/drone-template-lib v0.0.0-20181004051823-4019baa6c594 h1:zPRVfiHpXeGt1XGpK2TQcaj2lRydiGdVz1AoHkaC554=
github.com/drone/drone-template-lib v0.0.0-20181004051823-4019baa6c594/go.mod h1:u34woe41m58Whrf21iH6z/xLOIRM3650LhWAyUc7Oik=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/tkuchiki/faketime v0.1.1 h1:UZjBlktFAi23wo+jWuHuNoHUpLnB0j/5B62bl5nCPls=
github.com/tkuchiki/faketime v0.1.1/go.mod h1:RXY/TXAwGGL36IKDjrHFMcjpUrEiyWSEtLhFPw3UWF0=
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=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+59 -22
View File
@@ -4,6 +4,7 @@ import (
"log"
"os"
"github.com/joho/godotenv"
"github.com/urfave/cli"
)
@@ -34,6 +35,17 @@ func main() {
Usage: "password for basic auth",
EnvVar: "PLUGIN_PASSWORD,WEBHOOK_PASSWORD",
},
cli.StringFlag{
Name: "token-value",
Usage: "token value",
EnvVar: "PLUGIN_TOKEN_VALUE,WEBHOOK_TOKEN_VALUE",
},
cli.StringFlag{
Name: "token-type",
Usage: "type of token",
EnvVar: "PLUGIN_TOKEN_TYPE,WEBHOOK_TOKEN_TYPE",
Value: "Bearer",
},
cli.StringFlag{
Name: "content-type",
Usage: "content type",
@@ -70,6 +82,17 @@ func main() {
Usage: "skip ssl verification",
EnvVar: "PLUGIN_SKIP_VERIFY",
},
cli.StringFlag{
Name: "signature-header",
Usage: "header name to use in request",
EnvVar: "PLUGIN_SIGNATURE_HEADER,WEBHOOK_SIGNATURE_HEADER",
Value: "X-Drone-Signature",
},
cli.StringFlag{
Name: "signature-secret",
Usage: "secret to generate signature",
EnvVar: "PLUGIN_SIGNATURE_SECRET,WEBHOOK_SIGNATURE_SECRET",
},
cli.StringFlag{
Name: "repo.owner",
Usage: "repository owner",
@@ -129,6 +152,11 @@ func main() {
Usage: "build link",
EnvVar: "DRONE_BUILD_LINK",
},
cli.StringFlag{
Name: "build.deployTo",
Usage: "environment deployed to",
EnvVar: "DRONE_DEPLOY_TO",
},
cli.Int64Flag{
Name: "build.started",
Usage: "build started",
@@ -151,6 +179,10 @@ func main() {
},
}
if _, err := os.Stat("/run/drone/env"); err == nil {
_ = godotenv.Overload("/run/drone/env")
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
@@ -163,33 +195,38 @@ func run(c *cli.Context) error {
Name: c.String("repo.name"),
},
Build: Build{
Tag: c.String("build.tag"),
Number: c.Int("build.number"),
Event: c.String("build.event"),
Status: c.String("build.status"),
Commit: c.String("commit.sha"),
Ref: c.String("commit.ref"),
Branch: c.String("commit.branch"),
Author: c.String("commit.author"),
Message: c.String("commit.message"),
Link: c.String("build.link"),
Started: c.Int64("build.started"),
Created: c.Int64("build.created"),
Tag: c.String("build.tag"),
Number: c.Int("build.number"),
Event: c.String("build.event"),
Status: c.String("build.status"),
Commit: c.String("commit.sha"),
Ref: c.String("commit.ref"),
Branch: c.String("commit.branch"),
Author: c.String("commit.author"),
Message: c.String("commit.message"),
Link: c.String("build.link"),
DeployTo: c.String("build.deployTo"),
Started: c.Int64("build.started"),
Created: c.Int64("build.created"),
},
Job: Job{
Started: c.Int64("job.started"),
},
Config: Config{
Method: c.String("method"),
Username: c.String("username"),
Password: c.String("password"),
ContentType: c.String("content-type"),
Template: c.String("template"),
Headers: c.StringSlice("headers"),
URLs: c.StringSlice("urls"),
ValidCodes: c.IntSlice("valid-response-codes"),
Debug: c.Bool("debug"),
SkipVerify: c.Bool("skip-verify"),
Method: c.String("method"),
Username: c.String("username"),
Password: c.String("password"),
TokenValue: c.String("token-value"),
TokenType: c.String("token-type"),
ContentType: c.String("content-type"),
Template: c.String("template"),
Headers: c.StringSlice("headers"),
URLs: c.StringSlice("urls"),
ValidCodes: c.IntSlice("valid-response-codes"),
Debug: c.Bool("debug"),
SkipVerify: c.Bool("skip-verify"),
SignatureHeader: c.String("signature-header"),
SignatureSecret: c.String("signature-secret"),
},
}
-204
View File
@@ -1,204 +0,0 @@
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,
},
}
+50 -24
View File
@@ -2,10 +2,13 @@ package main
import (
"bytes"
"crypto/hmac"
"crypto/sha256"
"crypto/tls"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
@@ -21,31 +24,36 @@ type (
}
Build struct {
Tag string `json:"tag"`
Event string `json:"event"`
Number int `json:"number"`
Commit string `json:"commit"`
Ref string `json:"ref"`
Branch string `json:"branch"`
Author string `json:"author"`
Message string `json:"message"`
Status string `json:"status"`
Link string `json:"link"`
Started int64 `json:"started"`
Created int64 `json:"created"`
Tag string `json:"tag"`
Event string `json:"event"`
Number int `json:"number"`
Commit string `json:"commit"`
Ref string `json:"ref"`
Branch string `json:"branch"`
Author string `json:"author"`
Message string `json:"message"`
Status string `json:"status"`
Link string `json:"link"`
DeployTo string `json:"deployTo"`
Started int64 `json:"started"`
Created int64 `json:"created"`
}
Config struct {
Method string
Username string
Password string
ContentType string
Template string
Headers []string
URLs []string
ValidCodes []int
Debug bool
SkipVerify bool
Method string
Username string
Password string
TokenValue string
TokenType string
ContentType string
Template string
Headers []string
URLs []string
ValidCodes []int
Debug bool
SkipVerify bool
SignatureHeader string
SignatureSecret string
}
Job struct {
@@ -66,6 +74,10 @@ func (p Plugin) Exec() error {
b []byte
)
if len(p.Config.URLs) == 0 {
return fmt.Errorf("You must provide at least one url")
}
if p.Config.Template == "" {
data := struct {
Repo Repo `json:"repo"`
@@ -112,6 +124,16 @@ func (p Plugin) Exec() error {
req.Header.Set("Content-Type", p.Config.ContentType)
if p.Config.SignatureSecret != "" {
// generate signature with secret and body
h := hmac.New(sha256.New, []byte(p.Config.SignatureSecret))
h.Write(b)
sha := hex.EncodeToString(h.Sum(nil))
// append signature to headers
req.Header.Set(p.Config.SignatureHeader, fmt.Sprintf("sha256=%s", sha))
}
for _, value := range p.Config.Headers {
header := strings.Split(value, "=")
req.Header.Set(header[0], header[1])
@@ -121,6 +143,10 @@ func (p Plugin) Exec() error {
req.SetBasicAuth(p.Config.Username, p.Config.Password)
}
if p.Config.TokenValue != "" {
req.Header.Set("Authorization", fmt.Sprintf("%s %s", p.Config.TokenType, p.Config.TokenValue))
}
client := http.DefaultClient
if p.Config.SkipVerify {
@@ -143,7 +169,7 @@ func (p Plugin) Exec() error {
defer resp.Body.Close()
if p.Config.Debug || resp.StatusCode >= http.StatusBadRequest {
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Printf("Error: Failed to read the HTTP response body. %s\n", err)
+3
View File
@@ -0,0 +1,3 @@
run:
go:
module: github.com/drone-plugins/drone-webhook