mirror of
https://github.com/drone-plugins/drone-webhook.git
synced 2026-06-04 18:24:05 +08:00
Merge pull request #25 from drone-plugins/restructure
Restructured multi arch and added auto tagging
This commit is contained in:
+33
-8
@@ -1,7 +1,9 @@
|
||||
version: '{build}'
|
||||
image: 'Visual Studio 2017'
|
||||
platform: x64
|
||||
|
||||
clone_folder: 'c:\go\src\github.com\drone-plugins\drone-webhook'
|
||||
max_jobs: 1
|
||||
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
@@ -10,28 +12,51 @@ environment:
|
||||
secure: 'VqO/G3Zfslu6zSLdwHKO+Q=='
|
||||
|
||||
install:
|
||||
- cmd: |
|
||||
- ps: |
|
||||
docker version
|
||||
go version
|
||||
|
||||
build_script:
|
||||
- cmd: |
|
||||
go build -v -ldflags "-X main.build=%APPVEYOR_BUILD_VERSION%"" -a -o drone-webhook.exe
|
||||
- ps: |
|
||||
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
|
||||
go build -ldflags "-X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o drone-webhook.exe
|
||||
} else {
|
||||
$version = $env:APPVEYOR_REPO_TAG_NAME.substring(1)
|
||||
go build -ldflags "-X main.version=$version -X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o drone-webhook.exe
|
||||
}
|
||||
|
||||
docker pull microsoft/nanoserver:10.0.14393.1593
|
||||
docker build -f Dockerfile.windows -t plugins/webhook:windows .
|
||||
docker build -f Dockerfile.windows -t plugins/webhook:windows-amd64 .
|
||||
|
||||
test_script:
|
||||
- cmd: |
|
||||
docker run --rm plugins/webhook:windows --version
|
||||
- ps: |
|
||||
docker run --rm plugins/webhook:windows-amd64 --version
|
||||
|
||||
deploy_script:
|
||||
- ps: |
|
||||
$ErrorActionPreference = 'Stop';
|
||||
|
||||
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER -Or ! $env:APPVEYOR_REPO_BRANCH.Equals("master")) {
|
||||
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) {
|
||||
Write-Host Nothing to deploy.
|
||||
} else {
|
||||
docker login --username $env:DOCKER_USERNAME --password $env:DOCKER_PASSWORD
|
||||
docker push plugins/webhook:windows
|
||||
|
||||
if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) {
|
||||
$major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.substring(1).split('.')
|
||||
|
||||
docker push plugins/webhook:windows-amd64
|
||||
|
||||
docker tag plugins/webhook:windows-amd64 plugins/webhook:$major.$minor.$patch-windows-amd64
|
||||
docker push plugins/webhook:$major.$minor.$patch-windows-amd64
|
||||
|
||||
docker tag plugins/webhook:windows-amd64 plugins/webhook:$major.$minor-windows-amd64
|
||||
docker push plugins/webhook:$major.$minor-windows-amd64
|
||||
|
||||
docker tag plugins/webhook:windows-amd64 plugins/webhook:$major-windows-amd64
|
||||
docker push plugins/webhook:$major-windows-amd64
|
||||
} else {
|
||||
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
|
||||
docker push plugins/webhook:windows-amd64
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+74
-39
@@ -8,7 +8,10 @@ pipeline:
|
||||
pull: true
|
||||
commands:
|
||||
- go vet
|
||||
- go test -cover -coverprofile=coverage.out
|
||||
- |
|
||||
for PKG in $(go list ./... | grep -v /vendor/); do
|
||||
go test -cover -coverprofile $GOPATH/src/$PKG/coverage.out $PKG
|
||||
done
|
||||
|
||||
build_linux_amd64:
|
||||
image: golang:1.9
|
||||
@@ -19,7 +22,28 @@ pipeline:
|
||||
- GOARCH=amd64
|
||||
- CGO_ENABLED=0
|
||||
commands:
|
||||
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-webhook
|
||||
- |
|
||||
if test "${DRONE_TAG}" = ""; then
|
||||
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-webhook
|
||||
else
|
||||
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-webhook
|
||||
fi
|
||||
|
||||
build_linux_i386:
|
||||
image: golang:1.9
|
||||
pull: true
|
||||
group: build
|
||||
environment:
|
||||
- GOOS=linux
|
||||
- GOARCH=386
|
||||
- CGO_ENABLED=0
|
||||
commands:
|
||||
- |
|
||||
if test "${DRONE_TAG}" = ""; then
|
||||
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/i386/drone-webhook
|
||||
else
|
||||
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/i386/drone-webhook
|
||||
fi
|
||||
|
||||
build_linux_arm64:
|
||||
image: golang:1.9
|
||||
@@ -30,7 +54,12 @@ pipeline:
|
||||
- GOARCH=arm64
|
||||
- CGO_ENABLED=0
|
||||
commands:
|
||||
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-webhook
|
||||
- |
|
||||
if test "${DRONE_TAG}" = ""; then
|
||||
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-webhook
|
||||
else
|
||||
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-webhook
|
||||
fi
|
||||
|
||||
build_linux_arm:
|
||||
image: golang:1.9
|
||||
@@ -42,68 +71,74 @@ pipeline:
|
||||
- CGO_ENABLED=0
|
||||
- GOARM=7
|
||||
commands:
|
||||
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-webhook
|
||||
|
||||
# build_windows_amd64:
|
||||
# image: golang:1.9-nanoserver
|
||||
# pull: true
|
||||
# group: build
|
||||
# environment:
|
||||
# - GOOS=windows
|
||||
# - GOARCH=amd64
|
||||
# - CGO_ENABLED=0
|
||||
# commands:
|
||||
# - go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/windows/amd64/drone-webhook
|
||||
- |
|
||||
if test "${DRONE_TAG}" = ""; then
|
||||
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-webhook
|
||||
else
|
||||
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-webhook
|
||||
fi
|
||||
|
||||
publish_linux_amd64:
|
||||
image: plugins/docker:17.05
|
||||
pull: true
|
||||
repo: plugins/webhook
|
||||
tags: [ latest, 1.0.0, 1.0, 1 ]
|
||||
secrets: [ docker_username, docker_password ]
|
||||
group: docker
|
||||
repo: plugins/webhook
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
dockerfile: Dockerfile
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
event: [ push, tag ]
|
||||
|
||||
publish_linux_i386:
|
||||
image: plugins/docker:17.05
|
||||
pull: true
|
||||
secrets: [ docker_username, docker_password ]
|
||||
group: docker
|
||||
repo: plugins/webhook
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-i386
|
||||
dockerfile: Dockerfile.i386
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
|
||||
publish_linux_arm64:
|
||||
image: plugins/docker:17.05
|
||||
pull: true
|
||||
repo: plugins/webhook
|
||||
tags: [ linux-arm64 ]
|
||||
secrets: [ docker_username, docker_password ]
|
||||
group: docker
|
||||
repo: plugins/webhook
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
dockerfile: Dockerfile.arm64
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
event: [ push, tag ]
|
||||
|
||||
publish_linux_arm:
|
||||
image: plugins/docker:17.05
|
||||
pull: true
|
||||
repo: plugins/webhook
|
||||
tags: [ linux-arm ]
|
||||
secrets: [ docker_username, docker_password ]
|
||||
group: docker
|
||||
repo: plugins/webhook
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm
|
||||
dockerfile: Dockerfile.arm
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
event: [ push, tag ]
|
||||
|
||||
# publish_windows_amd64:
|
||||
# image: plugins/docker:17.05
|
||||
# pull: true
|
||||
# repo: plugins/webhook
|
||||
# tags: [ windows-amd64 ]
|
||||
# secrets: [ docker_username, docker_password ]
|
||||
# dockerfile: Dockerfile.windows
|
||||
# when:
|
||||
# branch: master
|
||||
# event: push
|
||||
manifests:
|
||||
image: plugins/manifest:1
|
||||
pull: true
|
||||
secrets: [ docker_username, docker_password ]
|
||||
spec: manifest.tmpl
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
|
||||
microbadger:
|
||||
image: plugins/webhook:1
|
||||
pull: true
|
||||
secrets: [ webhook_url ]
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
status: [ success ]
|
||||
|
||||
+4
-6
@@ -1,11 +1,9 @@
|
||||
FROM plugins/base:multiarch
|
||||
MAINTAINER Drone.IO Community <drone-dev@googlegroups.com>
|
||||
|
||||
LABEL org.label-schema.version=latest
|
||||
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-webhook.git"
|
||||
LABEL org.label-schema.name="Drone Webhook"
|
||||
LABEL org.label-schema.vendor="Drone.IO Community"
|
||||
LABEL org.label-schema.schema-version="1.0"
|
||||
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/amd64/drone-webhook /bin/
|
||||
ENTRYPOINT ["/bin/drone-webhook"]
|
||||
|
||||
+4
-6
@@ -1,11 +1,9 @@
|
||||
FROM plugins/base:multiarch
|
||||
MAINTAINER Drone.IO Community <drone-dev@googlegroups.com>
|
||||
|
||||
LABEL org.label-schema.version=latest
|
||||
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-webhook.git"
|
||||
LABEL org.label-schema.name="Drone Webhook"
|
||||
LABEL org.label-schema.vendor="Drone.IO Community"
|
||||
LABEL org.label-schema.schema-version="1.0"
|
||||
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"]
|
||||
|
||||
+4
-6
@@ -1,11 +1,9 @@
|
||||
FROM plugins/base:multiarch
|
||||
MAINTAINER Drone.IO Community <drone-dev@googlegroups.com>
|
||||
|
||||
LABEL org.label-schema.version=latest
|
||||
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-webhook.git"
|
||||
LABEL org.label-schema.name="Drone Webhook"
|
||||
LABEL org.label-schema.vendor="Drone.IO Community"
|
||||
LABEL org.label-schema.schema-version="1.0"
|
||||
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/arm64/drone-webhook /bin/
|
||||
ENTRYPOINT ["/bin/drone-webhook"]
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
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/i386/drone-webhook /bin/
|
||||
ENTRYPOINT ["/bin/drone-webhook"]
|
||||
+7
-8
@@ -1,11 +1,10 @@
|
||||
# escape=`
|
||||
FROM microsoft/nanoserver:10.0.14393.1593
|
||||
MAINTAINER Drone.IO Community <drone-dev@googlegroups.com>
|
||||
|
||||
LABEL org.label-schema.version=latest
|
||||
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-webhook.git"
|
||||
LABEL org.label-schema.name="Drone Webhook"
|
||||
LABEL org.label-schema.vendor="Drone.IO Community"
|
||||
LABEL org.label-schema.schema-version="1.0"
|
||||
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 drone-webhook.exe /drone-webhook.exe
|
||||
ENTRYPOINT [ "\\drone-webhook.exe" ]
|
||||
ADD drone-webhook.exe c:\drone-webhook.exe
|
||||
ENTRYPOINT [ "c:\\drone-webhook.exe" ]
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# drone-webhook
|
||||
|
||||
[](http://beta.drone.io/drone-plugins/drone-webhook)
|
||||
[](https://gitter.im/drone/drone)
|
||||
[](https://discourse.drone.io)
|
||||
[](https://stackoverflow.com/questions/tagged/drone.io)
|
||||
[](http://godoc.org/github.com/drone-plugins/drone-webhook)
|
||||
[](https://goreportcard.com/report/github.com/drone-plugins/drone-webhook)
|
||||
[](https://microbadger.com/images/plugins/webhook "Get your own image badge on microbadger.com")
|
||||
|
||||
Drone plugin to send build status notifications via Webhook. For the usage information and a listing of the available options please take a look at [the docs](DOCS.md).
|
||||
Drone plugin to send build status notifications via Webhook. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-webhook/).
|
||||
|
||||
## Build
|
||||
|
||||
@@ -42,5 +43,7 @@ docker run --rm \
|
||||
-e DRONE_BUILD_STATUS=success \
|
||||
-e DRONE_BUILD_LINK=http://github.com/octocat/hello-world \
|
||||
-e DRONE_TAG=1.0.0 \
|
||||
-v $(pwd):$(pwd) \
|
||||
-w $(pwd) \
|
||||
plugins/webhook
|
||||
```
|
||||
|
||||
@@ -2,19 +2,23 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var build = "0" // build number set at compile-time
|
||||
var (
|
||||
version = "0.0.0"
|
||||
build = "0"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "webhook plugin"
|
||||
app.Usage = "webhook plugin"
|
||||
app.Action = run
|
||||
app.Version = fmt.Sprintf("1.0.0+%s", build)
|
||||
app.Version = fmt.Sprintf("%s+%s", version, build)
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "method",
|
||||
@@ -51,7 +55,7 @@ func main() {
|
||||
cli.StringSliceFlag{
|
||||
Name: "urls",
|
||||
Usage: "list of urls to perform the action on",
|
||||
EnvVar: "PLUGIN_URLS",
|
||||
EnvVar: "PLUGIN_URLS,WEBHOOK_URLS",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "debug",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
image: plugins/webhook:{{#if build.tag}}{{trimPrefix build.tag "v"}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: plugins/webhook:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/webhook:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-i386
|
||||
platform:
|
||||
architecture: 386
|
||||
os: linux
|
||||
-
|
||||
image: plugins/webhook:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/webhook:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm
|
||||
platform:
|
||||
architecture: arm
|
||||
os: linux
|
||||
-
|
||||
image: plugins/webhook:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
Reference in New Issue
Block a user