Skip to content

Commit

Permalink
Updated to current build process
Browse files Browse the repository at this point in the history
  • Loading branch information
tboerger committed Apr 22, 2018
1 parent da5d31b commit 639d9a8
Show file tree
Hide file tree
Showing 16 changed files with 311 additions and 302 deletions.
68 changes: 68 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
version: '{build}'
image: 'Visual Studio 2017'
platform: 'x64'

clone_folder: 'c:\gopath\src\github.com\drone-plugins\drone-slack'
max_jobs: 1

environment:
GOPATH: c:\gopath
DOCKER_USERNAME:
secure: '4YzzahbEiMZQJpOCOd1LAw=='
DOCKER_PASSWORD:
secure: 'VqO/G3Zfslu6zSLdwHKO+Q=='

install:
- ps: |
docker version
go version
- ps: |
$env:Path = "c:\gopath\bin;$env:Path"
build_script:
- ps: |
go get -u github.com/golang/dep/cmd/dep
dep ensure
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
go build -ldflags "-X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o release/drone-slack.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 release/drone-slack.exe
}
docker pull microsoft/nanoserver:10.0.14393.1593
docker build -f Dockerfile.windows -t plugins/slack:windows-amd64 .
test_script:
- ps: |
docker run --rm plugins/slack:windows-amd64 --version
deploy_script:
- ps: |
$ErrorActionPreference = 'Stop';
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) {
Write-Host Nothing to deploy.
} else {
docker login --username $env:DOCKER_USERNAME --password $env:DOCKER_PASSWORD
if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) {
$major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.substring(1).split('.')
docker push plugins/slack:windows-amd64
docker tag plugins/slack:windows-amd64 plugins/slack:$major.$minor.$patch-windows-amd64
docker push plugins/slack:$major.$minor.$patch-windows-amd64
docker tag plugins/slack:windows-amd64 plugins/slack:$major.$minor-windows-amd64
docker push plugins/slack:$major.$minor-windows-amd64
docker tag plugins/slack:windows-amd64 plugins/slack:$major-windows-amd64
docker push plugins/slack:$major-windows-amd64
} else {
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
docker push plugins/slack:windows-amd64
}
}
}
147 changes: 100 additions & 47 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,147 @@ workspace:
path: src/github.com/drone-plugins/drone-slack

pipeline:
deps:
image: golang:1.10
pull: true
commands:
- go get -u github.com/golang/dep/cmd/dep
- dep ensure
- dep status

test:
image: golang:1.9
image: golang:1.10
pull: true
commands:
- go vet
- go test -cover -coverprofile=coverage.out
- go vet ./...
- go test -cover ./...

build_linux_amd64:
image: golang:1.9
image: golang:1.10
pull: true
group: build
environment:
- GOOS=linux
- GOARCH=amd64
- CGO_ENABLED=0
commands:
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-slack
- |
if test "${DRONE_TAG}" = ""; then
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-slack
else
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-slack
fi
build_linux_i386:
image: golang:1.10
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-slack
else
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/i386/drone-slack
fi
build_linux_arm64:
image: golang:1.9
image: golang:1.10
pull: true
group: build
environment:
- GOOS=linux
- GOARCH=arm64
- CGO_ENABLED=0
commands:
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-slack
- |
if test "${DRONE_TAG}" = ""; then
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-slack
else
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-slack
fi
build_linux_arm:
image: golang:1.9
image: golang:1.10
pull: true
group: build
environment:
- GOOS=linux
- GOARCH=arm
- CGO_ENABLED=0
- GOARM=7
commands:
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-slack

# build_windows_amd64:
# image: golang:1.9-nanoserver
# 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-slack
- |
if test "${DRONE_TAG}" = ""; then
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-slack
else
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-slack
fi
publish_linux_amd64:
image: plugins/docker
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password ]
group: docker
repo: plugins/slack
tags: [ latest, 1.1.0, 1.1, 1 ]
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: Dockerfile
when:
event: [ push, tag ]

publish_linux_i386:
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password ]
group: docker
repo: plugins/slack
auto_tag: true
auto_tag_suffix: linux-i386
dockerfile: Dockerfile.i386
when:
branch: master
event: push
event: [ push, tag ]

publish_linux_arm64:
image: plugins/docker
repo: plugins/slack
tags: [ linux-arm64 ]
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password ]
group: docker
repo: plugins/slack
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
repo: plugins/slack
tags: [ linux-arm ]
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password ]
group: docker
repo: plugins/slack
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
# repo: plugins/slack
# 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
# secrets: [ webhook_url ]
# when:
# status: [ success ]
microbadger:
image: plugins/webhook:1
pull: true
secrets: [ webhook_url ]
when:
status: [ success ]
9 changes: 0 additions & 9 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
<!-- PLEASE READ BEFORE DELETING
Please discuss changes before creating pull requests. This plugin
is stable and feature frozen. We are only accepting bug fixes at
this time.
https://gitter.im/drone/drone
-->
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ _testmain.go
*.exe
*.test
*.prof
.env

release/*
release/
vendor/

coverage.out
drone-slack
21 changes: 6 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates
FROM plugins/base:multiarch

FROM scratch
MAINTAINER Drone.IO Community <[email protected]>

ENV GODEBUG=netdns=go

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-slack.git"
LABEL org.label-schema.name="Drone Slack"
LABEL org.label-schema.vendor="Drone.IO Community"
LABEL org.label-schema.schema-version="1.0"
LABEL maintainer="Drone.IO Community <[email protected]>" \
org.label-schema.name="Drone Slack" \
org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0"

ADD release/linux/amd64/drone-slack /bin/
ENTRYPOINT [ "/bin/drone-slack" ]
ENTRYPOINT ["/bin/drone-slack"]
21 changes: 6 additions & 15 deletions Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates
FROM plugins/base:multiarch

FROM scratch
MAINTAINER Drone.IO Community <[email protected]>

ENV GODEBUG=netdns=go

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-slack.git"
LABEL org.label-schema.name="Drone Slack"
LABEL org.label-schema.vendor="Drone.IO Community"
LABEL org.label-schema.schema-version="1.0"
LABEL maintainer="Drone.IO Community <[email protected]>" \
org.label-schema.name="Drone Slack" \
org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0"

ADD release/linux/arm/drone-slack /bin/
ENTRYPOINT [ "/bin/drone-slack" ]
ENTRYPOINT ["/bin/drone-slack"]
21 changes: 6 additions & 15 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates
FROM plugins/base:multiarch

FROM scratch
MAINTAINER Drone.IO Community <[email protected]>

ENV GODEBUG=netdns=go

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-slack.git"
LABEL org.label-schema.name="Drone Slack"
LABEL org.label-schema.vendor="Drone.IO Community"
LABEL org.label-schema.schema-version="1.0"
LABEL maintainer="Drone.IO Community <[email protected]>" \
org.label-schema.name="Drone Slack" \
org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0"

ADD release/linux/arm64/drone-slack /bin/
ENTRYPOINT [ "/bin/drone-slack" ]
ENTRYPOINT ["/bin/drone-slack"]
9 changes: 9 additions & 0 deletions Dockerfile.i386
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM plugins/base:multiarch

LABEL maintainer="Drone.IO Community <[email protected]>" \
org.label-schema.name="Drone Slack" \
org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0"

ADD release/linux/i386/drone-slack /bin/
ENTRYPOINT ["/bin/drone-slack"]
19 changes: 9 additions & 10 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM microsoft/nanoserver:latest
MAINTAINER Drone.IO Community <[email protected]>
# escape=`
FROM microsoft/nanoserver:10.0.14393.1593

ENV GODEBUG=netdns=go
LABEL maintainer="Drone.IO Community <[email protected]>" `
org.label-schema.name="Drone Slack" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"

LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-slack.git"
LABEL org.label-schema.name="Drone Slack"
LABEL org.label-schema.vendor="Drone.IO Community"
LABEL org.label-schema.schema-version="1.0"
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ADD release/windows/amd64/drone-slack /bin/
ENTRYPOINT [ "/bin/drone-slack" ]
ADD release\drone-slack.exe c:\drone-slack.exe
ENTRYPOINT [ "c:\\drone-slack.exe" ]
Loading

0 comments on commit 639d9a8

Please sign in to comment.