From cf3c936f2869a6e5fd8447bffc3c5b97989bbaa7 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Tue, 22 Jan 2019 10:52:21 +0100 Subject: [PATCH 1/4] Add proper instructions to readme --- README.md | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6debd57..48ecc6a 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,41 @@ Drone plugin to build and publish Docker images to a container registry. ## Build -Build the binary with the following commands: +Build the binaries with the following commands: ``` -sh .drone.sh +go test -cover ./... + +go build -v -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker +go build -v -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr +go build -v -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr +go build -v -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku ``` ## Docker -Build the Docker image with the following commands: +Build the Docker images with the following commands: ``` -docker build --rm=true -f docker/Dockerfile -t plugins/docker . +docker build \ + --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/docker/Dockerfile.linux.amd64 --tag plugins/docker . + +docker build \ + --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/gcr/Dockerfile.linux.amd64 --tag plugins/gcr . + +docker build \ + --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/ecr/Dockerfile.linux.amd64 --tag plugins/ecr . + +docker build \ + --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/heroku/Dockerfile.linux.amd64 --tag plugins/heroku . ``` ## Usage From 3ab94b020a6ef2f6adb9f2dd256b2ca65ece833f Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Tue, 22 Jan 2019 10:52:39 +0100 Subject: [PATCH 2/4] Properly configure permissions for protected branches --- .github/settings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index 3a43817..f647429 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -58,7 +58,6 @@ branches: dismissal_restrictions: teams: - Admins - - Captain required_status_checks: strict: true contexts: @@ -66,4 +65,5 @@ branches: enforce_admins: false restrictions: users: [] - teams: [] + teams: + - Admins From 81a6499ee824698c523fba2fcf2400b0c70ff9bc Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Tue, 22 Jan 2019 11:27:13 +0100 Subject: [PATCH 3/4] Export required env variables within readme --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 48ecc6a..b4bd438 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,18 @@ [![Go Doc](https://godoc.org/github.com/drone-plugins/drone-docker?status.svg)](http://godoc.org/github.com/drone-plugins/drone-docker) [![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-docker)](https://goreportcard.com/report/github.com/drone-plugins/drone-docker) -Drone plugin to build and publish Docker images to a container registry. +Drone plugin to build and publish Docker images to a container registry. 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-docker/). ## Build Build the binaries with the following commands: ``` +export GOOS=linux +export GOARCH=amd64 +export CGO_ENABLED=0 +export GO111MODULE=on + go test -cover ./... go build -v -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker From b3ccd0b7780281569c1c7b31812df15a2e324c14 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Tue, 22 Jan 2019 23:12:12 +0100 Subject: [PATCH 4/4] Execute built binary as simple test --- .drone.jsonnet | 8 ++++++++ .drone.windows.yml | 6 ++++++ .drone.yml | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/.drone.jsonnet b/.drone.jsonnet index ea298c0..3e06df5 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -72,6 +72,14 @@ local PipelineBuild(binary="docker", os="linux", arch="amd64") = { event: [ "tag" ], }, }, + if binary == "docker" then { + name: "executable", + image: "golang:1.11", + pull: "always", + commands: [ + "./release/" + os + "/" + arch + "/drone-" + binary + " --help", + ], + }, { name: "dryrun", image: "plugins/docker:" + os + "-" + arch, diff --git a/.drone.windows.yml b/.drone.windows.yml index 0d6099c..dc2b04c 100644 --- a/.drone.windows.yml +++ b/.drone.windows.yml @@ -32,6 +32,12 @@ steps: event: - tag +- name: executable + pull: always + image: golang:1.11 + commands: + - ./release/windows/amd64/drone-docker --help + - name: dryrun pull: always image: plugins/docker:windows-amd64 diff --git a/.drone.yml b/.drone.yml index 1af8690..db3c341 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,6 +61,12 @@ steps: event: - tag +- name: executable + pull: always + image: golang:1.11 + commands: + - ./release/linux/amd64/drone-docker --help + - name: dryrun pull: always image: plugins/docker:linux-amd64 @@ -135,6 +141,12 @@ steps: event: - tag +- name: executable + pull: always + image: golang:1.11 + commands: + - ./release/linux/arm64/drone-docker --help + - name: dryrun pull: always image: plugins/docker:linux-arm64 @@ -209,6 +221,12 @@ steps: event: - tag +- name: executable + pull: always + image: golang:1.11 + commands: + - ./release/linux/arm/drone-docker --help + - name: dryrun pull: always image: plugins/docker:linux-arm