diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..ea298c0 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,173 @@ +local PipelineTesting = { + kind: "pipeline", + 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(binary="docker", os="linux", arch="amd64") = { + kind: "pipeline", + name: os + "-" + arch + "-" + binary, + 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 -tags netgo -o release/" + os + "/" + arch + "/drone-" + binary + " ./cmd/drone-" + binary, + ], + 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 -tags netgo -o release/" + os + "/" + arch + "/drone-" + binary + " ./cmd/drone-" + binary, + ], + when: { + event: [ "tag" ], + }, + }, + { + name: "dryrun", + image: "plugins/docker:" + os + "-" + arch, + pull: "always", + settings: { + dry_run: true, + tags: os + "-" + arch, + dockerfile: "docker/" + binary + "/Dockerfile." + os + "." + arch, + repo: "plugins/" + binary, + 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/" + binary + "/Dockerfile." + os + "." + arch, + repo: "plugins/" + binary, + username: { "from_secret": "docker_username" }, + password: { "from_secret": "docker_password" }, + }, + when: { + event: [ "push", "tag" ], + }, + }, + ], + depends_on: [ + if binary == "docker" then "testing" else os + "-" + arch + "-docker", + ], + trigger: { + branch: [ "master" ], + }, +}; + +local PipelineNotifications(binary="docker") = { + kind: "pipeline", + name: "notifications-" + binary, + 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/" + binary + "/manifest.tmpl", + ignore_missing: true, + }, + }, + { + name: "microbadger", + image: "plugins/webhook:1", + pull: "always", + settings: { + url: { "from_secret": "microbadger_" + binary }, + }, + }, + ], + depends_on: [ + "linux-amd64-" + binary, + "linux-arm64-" + binary, + "linux-arm-" + binary, + ], + trigger: { + branch: [ "master" ], + event: [ "push", "tag" ], + }, +}; + +[ + PipelineTesting, + PipelineBuild("docker", "linux", "amd64"), + PipelineBuild("docker", "linux", "arm64"), + PipelineBuild("docker", "linux", "arm"), + PipelineBuild("gcr", "linux", "amd64"), + PipelineBuild("gcr", "linux", "arm64"), + PipelineBuild("gcr", "linux", "arm"), + PipelineBuild("ecr", "linux", "amd64"), + PipelineBuild("ecr", "linux", "arm64"), + PipelineBuild("ecr", "linux", "arm"), + PipelineBuild("heroku", "linux", "amd64"), + PipelineBuild("heroku", "linux", "arm64"), + PipelineBuild("heroku", "linux", "arm"), + PipelineNotifications("docker"), + PipelineNotifications("gcr"), + PipelineNotifications("ecr"), + PipelineNotifications("heroku"), +] diff --git a/.drone.sh b/.drone.sh deleted file mode 100644 index a86a192..0000000 --- a/.drone.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -e -set -x - -# compile the main binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm/drone-docker github.com/drone-plugins/drone-docker/cmd/drone-docker - -# build the heroku binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku - -# build the gcr binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr - -# build the ecr binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/arm64/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr diff --git a/.drone.windows.yml b/.drone.windows.yml new file mode 100644 index 0000000..0d6099c --- /dev/null +++ b/.drone.windows.yml @@ -0,0 +1,292 @@ +--- +kind: pipeline +name: windows-amd64-docker + +platform: + os: windows + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:windows-amd64 + settings: + dockerfile: docker/docker/Dockerfile.windows.amd64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/docker + tags: windows-amd64 + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:windows-amd64 + settings: + auto_tag: true + auto_tag_suffix: windows-amd64 + dockerfile: docker/docker/Dockerfile.windows.amd64 + password: + from_secret: docker_password + repo: plugins/docker + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +--- +kind: pipeline +name: windows-amd64-gcr + +platform: + os: windows + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:windows-amd64 + settings: + dry_run: true + gcrfile: docker/gcr/Dockerfile.windows.amd64 + password: + from_secret: gcr_password + repo: plugins/gcr + tags: windows-amd64 + username: + from_secret: gcr_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:windows-amd64 + settings: + auto_tag: true + auto_tag_suffix: windows-amd64 + gcrfile: docker/gcr/Dockerfile.windows.amd64 + password: + from_secret: gcr_password + repo: plugins/gcr + username: + from_secret: gcr_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- windows-amd64-docker + +--- +kind: pipeline +name: windows-amd64-ecr + +platform: + os: windows + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:windows-amd64 + settings: + dockerfile: docker/ecr/Dockerfile.windows.amd64 + dry_run: true + password: + from_secret: ecr_password + repo: plugins/ecr + tags: windows-amd64 + username: + from_secret: ecr_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:windows-amd64 + settings: + auto_tag: true + auto_tag_suffix: windows-amd64 + dockerfile: docker/ecr/Dockerfile.windows.amd64 + password: + from_secret: ecr_password + repo: plugins/ecr + username: + from_secret: ecr_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- windows-amd64-docker + +--- +kind: pipeline +name: windows-amd64-heroku + +platform: + os: windows + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:windows-amd64 + settings: + dry_run: true + herokufile: docker/heroku/Dockerfile.windows.amd64 + password: + from_secret: heroku_password + repo: plugins/heroku + tags: windows-amd64 + username: + from_secret: heroku_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:windows-amd64 + settings: + auto_tag: true + auto_tag_suffix: windows-amd64 + herokufile: docker/heroku/Dockerfile.windows.amd64 + password: + from_secret: heroku_password + repo: plugins/heroku + username: + from_secret: heroku_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- windows-amd64-docker diff --git a/.drone.yml b/.drone.yml index 0fc3103..1af8690 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,53 +1,1074 @@ -workspace: - base: /go - path: src/github.com/drone-plugins/drone-docker +--- +kind: pipeline +name: testing -pipeline: - build: - image: golang:1.9 - commands: - - go get -u github.com/golang/dep/cmd/dep - - dep ensure - - go vet ./... - - go test -cover ./... - - sh .drone.sh +platform: + os: linux + arch: amd64 - publish: - image: plugins/docker +steps: +- name: vet + pull: always + image: golang:1.11 + commands: + - go vet ./... + environment: + GO111MODULE: on + +- name: test + pull: always + image: golang:1.11 + commands: + - go test -cover ./... + environment: + GO111MODULE: on + +trigger: + branch: + - master + +--- +kind: pipeline +name: linux-amd64-docker + +platform: + os: linux + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/docker/Dockerfile.linux.amd64 + dry_run: true + password: + from_secret: docker_password repo: plugins/docker - tags: [ "latest", "17", "17.12" ] - secrets: [ docker_username, docker_password ] - dockerfile: docker/Dockerfile - when: - branch: master - event: push + tags: linux-amd64 + username: + from_secret: docker_username + when: + event: + - pull_request - publish_heroku: - image: plugins/docker - repo: plugins/heroku - tags: [ "latest", "17", "17.12" ] - secrets: [ docker_username, docker_password ] - dockerfile: docker/heroku/Dockerfile - when: - branch: master - event: push +- name: publish + pull: always + image: plugins/docker:linux-amd64 + settings: + auto_tag: true + auto_tag_suffix: linux-amd64 + dockerfile: docker/docker/Dockerfile.linux.amd64 + password: + from_secret: docker_password + repo: plugins/docker + username: + from_secret: docker_username + when: + event: + - push + - tag - publish_gcr: - image: plugins/docker +trigger: + branch: + - master + +depends_on: +- testing + +--- +kind: pipeline +name: linux-arm64-docker + +platform: + os: linux + arch: arm64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dockerfile: docker/docker/Dockerfile.linux.arm64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/docker + 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 + dockerfile: docker/docker/Dockerfile.linux.arm64 + password: + from_secret: docker_password + repo: plugins/docker + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- testing + +--- +kind: pipeline +name: linux-arm-docker + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/docker/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/docker + 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 + dockerfile: docker/docker/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/docker + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- testing + +--- +kind: pipeline +name: linux-amd64-gcr + +platform: + os: linux + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/gcr/Dockerfile.linux.amd64 + dry_run: true + password: + from_secret: docker_password repo: plugins/gcr - tags: [ "latest", "17", "17.10" ] - secrets: [ docker_username, docker_password ] - dockerfile: docker/gcr/Dockerfile - when: - branch: master - event: push + tags: linux-amd64 + username: + from_secret: docker_username + when: + event: + - pull_request - publish_ecr: - image: plugins/docker +- name: publish + pull: always + image: plugins/docker:linux-amd64 + settings: + auto_tag: true + auto_tag_suffix: linux-amd64 + dockerfile: docker/gcr/Dockerfile.linux.amd64 + password: + from_secret: docker_password + repo: plugins/gcr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-amd64-docker + +--- +kind: pipeline +name: linux-arm64-gcr + +platform: + os: linux + arch: arm64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dockerfile: docker/gcr/Dockerfile.linux.arm64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/gcr + 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 + dockerfile: docker/gcr/Dockerfile.linux.arm64 + password: + from_secret: docker_password + repo: plugins/gcr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm64-docker + +--- +kind: pipeline +name: linux-arm-gcr + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/gcr/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/gcr + 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 + dockerfile: docker/gcr/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/gcr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm-docker + +--- +kind: pipeline +name: linux-amd64-ecr + +platform: + os: linux + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/ecr/Dockerfile.linux.amd64 + dry_run: true + password: + from_secret: docker_password repo: plugins/ecr - tags: [ "latest", "17", "17.10" ] - secrets: [ docker_username, docker_password ] - dockerfile: docker/ecr/Dockerfile - when: - branch: master - event: push + 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 + dockerfile: docker/ecr/Dockerfile.linux.amd64 + password: + from_secret: docker_password + repo: plugins/ecr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-amd64-docker + +--- +kind: pipeline +name: linux-arm64-ecr + +platform: + os: linux + arch: arm64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dockerfile: docker/ecr/Dockerfile.linux.arm64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/ecr + 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 + dockerfile: docker/ecr/Dockerfile.linux.arm64 + password: + from_secret: docker_password + repo: plugins/ecr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm64-docker + +--- +kind: pipeline +name: linux-arm-ecr + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/ecr/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/ecr + 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 + dockerfile: docker/ecr/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/ecr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm-docker + +--- +kind: pipeline +name: linux-amd64-heroku + +platform: + os: linux + arch: amd64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: docker/heroku/Dockerfile.linux.amd64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/heroku + 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 + dockerfile: docker/heroku/Dockerfile.linux.amd64 + password: + from_secret: docker_password + repo: plugins/heroku + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-amd64-docker + +--- +kind: pipeline +name: linux-arm64-heroku + +platform: + os: linux + arch: arm64 + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dockerfile: docker/heroku/Dockerfile.linux.arm64 + dry_run: true + password: + from_secret: docker_password + repo: plugins/heroku + 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 + dockerfile: docker/heroku/Dockerfile.linux.arm64 + password: + from_secret: docker_password + repo: plugins/heroku + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm64-docker + +--- +kind: pipeline +name: linux-arm-heroku + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/heroku/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/heroku + 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 + dockerfile: docker/heroku/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/heroku + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm-docker + +--- +kind: pipeline +name: notifications-docker + +platform: + os: linux + arch: amd64 + +steps: +- name: manifest + pull: always + image: plugins/manifest:1 + settings: + ignore_missing: true + password: + from_secret: docker_password + spec: docker/docker/manifest.tmpl + username: + from_secret: docker_username + +- name: microbadger + pull: always + image: plugins/webhook:1 + settings: + url: + from_secret: microbadger_docker + +trigger: + branch: + - master + event: + - push + - tag + +depends_on: +- linux-amd64-docker +- linux-arm64-docker +- linux-arm-docker + +--- +kind: pipeline +name: notifications-gcr + +platform: + os: linux + arch: amd64 + +steps: +- name: manifest + pull: always + image: plugins/manifest:1 + settings: + ignore_missing: true + password: + from_secret: docker_password + spec: docker/gcr/manifest.tmpl + username: + from_secret: docker_username + +- name: microbadger + pull: always + image: plugins/webhook:1 + settings: + url: + from_secret: microbadger_gcr + +trigger: + branch: + - master + event: + - push + - tag + +depends_on: +- linux-amd64-gcr +- linux-arm64-gcr +- linux-arm-gcr + +--- +kind: pipeline +name: notifications-ecr + +platform: + os: linux + arch: amd64 + +steps: +- name: manifest + pull: always + image: plugins/manifest:1 + settings: + ignore_missing: true + password: + from_secret: docker_password + spec: docker/ecr/manifest.tmpl + username: + from_secret: docker_username + +- name: microbadger + pull: always + image: plugins/webhook:1 + settings: + url: + from_secret: microbadger_ecr + +trigger: + branch: + - master + event: + - push + - tag + +depends_on: +- linux-amd64-ecr +- linux-arm64-ecr +- linux-arm-ecr + +--- +kind: pipeline +name: notifications-heroku + +platform: + os: linux + arch: amd64 + +steps: +- name: manifest + pull: always + image: plugins/manifest:1 + settings: + ignore_missing: true + password: + from_secret: docker_password + spec: docker/heroku/manifest.tmpl + username: + from_secret: docker_username + +- name: microbadger + pull: always + image: plugins/webhook:1 + settings: + url: + from_secret: microbadger_heroku + +trigger: + branch: + - master + event: + - push + - tag + +depends_on: +- linux-amd64-heroku +- linux-arm64-heroku +- linux-arm-heroku + +... diff --git a/.github/issue_template.md b/.github/issue_template.md index e69cc9a..3f95605 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -4,6 +4,6 @@ Bugs or Issues? Due to the high number of false positive issues we receive, please do not create a GitHub issue until you have discussed and verified with community support at: - https://discourse.drone.io + https://discourse.drone.io/ --> diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..3a43817 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,69 @@ +repository: + name: drone-docker + description: Drone plugin for publishing Docker images + homepage: http://plugins.drone.io/drone-plugins/drone-docker + topics: drone, drone-plugin + + private: false + has_issues: true + has_wiki: false + has_downloads: false + + default_branch: master + + allow_squash_merge: true + allow_merge_commit: true + allow_rebase_merge: true + +labels: + - name: bug + color: d73a4a + description: Something isn't working + - name: duplicate + color: cfd3d7 + description: This issue or pull request already exists + - name: enhancement + color: a2eeef + description: New feature or request + - name: good first issue + color: 7057ff + description: Good for newcomers + - name: help wanted + color: 008672 + description: Extra attention is needed + - name: invalid + color: e4e669 + description: This doesn't seem right + - name: question + color: d876e3 + description: Further information is requested + - name: renovate + color: e99695 + description: Automated action from Renovate + - name: wontfix + color: ffffff + description: This will not be worked on + +teams: + - name: Admins + permission: admin + +branches: + - name: master + protection: + required_pull_request_reviews: + required_approving_review_count: 1 + dismiss_stale_reviews: false + require_code_owner_reviews: false + dismissal_restrictions: + teams: + - Admins + - Captain + required_status_checks: + strict: true + contexts: + - continuous-integration/drone/pr + enforce_admins: false + restrictions: + users: [] + teams: [] diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 599ad9a..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,63 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/Sirupsen/logrus" - packages = ["."] - revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e" - version = "v1.0.3" - -[[projects]] - name = "github.com/aws/aws-sdk-go" - packages = ["aws","aws/awserr","aws/awsutil","aws/client","aws/client/metadata","aws/corehandlers","aws/credentials","aws/credentials/ec2rolecreds","aws/credentials/endpointcreds","aws/credentials/stscreds","aws/defaults","aws/ec2metadata","aws/endpoints","aws/request","aws/session","aws/signer/v4","internal/shareddefaults","private/protocol","private/protocol/json/jsonutil","private/protocol/jsonrpc","private/protocol/query","private/protocol/query/queryutil","private/protocol/rest","private/protocol/xml/xmlutil","service/ecr","service/sts"] - revision = "ee1f179877b2daf2aaabf71fa900773bf8842253" - version = "v1.12.19" - -[[projects]] - name = "github.com/coreos/go-semver" - packages = ["semver"] - revision = "8ab6407b697782a06568d4b7f1db25550ec2e4c6" - version = "v0.2.0" - -[[projects]] - name = "github.com/go-ini/ini" - packages = ["."] - revision = "f280b3ba517bf5fc98922624f21fb0e7a92adaec" - version = "v1.30.3" - -[[projects]] - name = "github.com/jmespath/go-jmespath" - packages = ["."] - revision = "0b12d6b5" - -[[projects]] - name = "github.com/joho/godotenv" - packages = ["."] - revision = "a79fa1e548e2c689c241d10173efd51e5d689d5b" - version = "v1.2.0" - -[[projects]] - branch = "master" - name = "github.com/urfave/cli" - packages = ["."] - revision = "0d51abd87c7705e9ee80d7227d77fcea82d69b7f" - source = "https://github.com/bradrydzewski/cli.git" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["ssh/terminal"] - revision = "2509b142fb2b797aa7587dad548f113b2c0f20ce" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix","windows"] - revision = "661970f62f5897bc0cd5fdca7e087ba8a98a8fa1" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "d810a46da78466106fe9f994d288826e0c876cef7addebade091f62c1a1522a1" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 9357288..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,43 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - - -[[constraint]] - name = "github.com/Sirupsen/logrus" - version = "1.0.3" - -[[constraint]] - name = "github.com/aws/aws-sdk-go" - version = "1.12.19" - -[[constraint]] - name = "github.com/joho/godotenv" - version = "1.2.0" - -[[constraint]] - branch = "master" - name = "github.com/urfave/cli" - source = "https://github.com/bradrydzewski/cli.git" - -[[constraint]] - name = "github.com/coreos/go-semver" - version = "v0.2.0" diff --git a/README.md b/README.md index 4da25ee..6debd57 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # drone-docker +[![Build Status](http://cloud.drone.io/api/badges/drone-plugins/drone-docker/status.svg)](http://cloud.drone.io/drone-plugins/drone-docker) +[![Gitter chat](https://badges.gitter.im/drone/drone.png)](https://gitter.im/drone/drone) +[![Join the discussion at https://discourse.drone.io](https://img.shields.io/badge/discourse-forum-orange.svg)](https://discourse.drone.io) +[![Drone questions at https://stackoverflow.com](https://img.shields.io/badge/drone-stackoverflow-orange.svg)](https://stackoverflow.com/questions/tagged/drone.io) +[![](https://images.microbadger.com/badges/image/plugins/docker.svg)](https://microbadger.com/images/plugins/docker "Get your own image badge on microbadger.com") +[![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. ## Build diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 89cc480..145997b 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -4,8 +4,8 @@ import ( "fmt" "os" - "github.com/Sirupsen/logrus" "github.com/joho/godotenv" + "github.com/sirupsen/logrus" "github.com/urfave/cli" "github.com/drone-plugins/drone-docker" diff --git a/cmd/drone-docker-ecr/main.go b/cmd/drone-ecr/main.go similarity index 100% rename from cmd/drone-docker-ecr/main.go rename to cmd/drone-ecr/main.go diff --git a/cmd/drone-docker-ecr/main_test.go b/cmd/drone-ecr/main_test.go similarity index 100% rename from cmd/drone-docker-ecr/main_test.go rename to cmd/drone-ecr/main_test.go diff --git a/cmd/drone-docker-gcr/main.go b/cmd/drone-gcr/main.go similarity index 100% rename from cmd/drone-docker-gcr/main.go rename to cmd/drone-gcr/main.go diff --git a/cmd/drone-docker-heroku/main.go b/cmd/drone-heroku/main.go similarity index 100% rename from cmd/drone-docker-heroku/main.go rename to cmd/drone-heroku/main.go diff --git a/docker.go b/docker.go index c3c7332..decdab7 100644 --- a/docker.go +++ b/docker.go @@ -172,7 +172,7 @@ func commandLogin(login Login) *exec.Cmd { // helper to check if args match "docker pull " func isCommandPull(args []string) bool { - return len(args) > 2 && args[1] == "pull" + return len(args) > 2 && args[1] == "pull" } func commandPull(repo string) *exec.Cmd { diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm deleted file mode 100644 index b8e4bb0..0000000 --- a/docker/Dockerfile.arm +++ /dev/null @@ -1 +0,0 @@ -# see https://github.com/docker-library/docker/issues/67 diff --git a/docker/Dockerfile b/docker/docker/Dockerfile.linux.amd64 similarity index 56% rename from docker/Dockerfile rename to docker/docker/Dockerfile.linux.amd64 index 8ada790..02b6fff 100644 --- a/docker/Dockerfile +++ b/docker/docker/Dockerfile.linux.amd64 @@ -1,6 +1,4 @@ -# docker build --rm -f docker/Dockerfile -t plugins/docker . - -FROM docker:17.12.0-ce-dind +FROM docker:18.06-dind ADD release/linux/amd64/drone-docker /bin/ ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"] diff --git a/docker/docker/Dockerfile.linux.arm b/docker/docker/Dockerfile.linux.arm new file mode 100644 index 0000000..310f16a --- /dev/null +++ b/docker/docker/Dockerfile.linux.arm @@ -0,0 +1,4 @@ +FROM docker:18.06-dind + +ADD release/linux/arm/drone-docker /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"] diff --git a/docker/Dockerfile.arm64 b/docker/docker/Dockerfile.linux.arm64 similarity index 79% rename from docker/Dockerfile.arm64 rename to docker/docker/Dockerfile.linux.arm64 index 502fb4c..5fd6f01 100644 --- a/docker/Dockerfile.arm64 +++ b/docker/docker/Dockerfile.linux.arm64 @@ -1,4 +1,4 @@ -FROM arm64v8/docker:18.06-dind +FROM docker:18.06-dind ADD release/linux/arm64/drone-docker /bin/ ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"] diff --git a/docker/docker/manifest.tmpl b/docker/docker/manifest.tmpl new file mode 100644 index 0000000..5b399aa --- /dev/null +++ b/docker/docker/manifest.tmpl @@ -0,0 +1,25 @@ +image: plugins/docker:{{#if build.tag}}{{trimPrefix build.tag "v"}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - + image: plugins/docker:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: plugins/docker:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + - + image: plugins/docker:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/docker/ecr/Dockerfile b/docker/ecr/Dockerfile deleted file mode 100644 index e50563e..0000000 --- a/docker/ecr/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -# docker build --rm -f docker/ecr/Dockerfile -t plugins/ecr . - -FROM plugins/docker:latest - -ADD release/linux/amd64/drone-docker-ecr /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-ecr"] diff --git a/docker/ecr/Dockerfile.linux.amd64 b/docker/ecr/Dockerfile.linux.amd64 new file mode 100644 index 0000000..5f7ab8b --- /dev/null +++ b/docker/ecr/Dockerfile.linux.amd64 @@ -0,0 +1,4 @@ +FROM plugins/docker:linux-amd64 + +ADD release/linux/amd64/drone-ecr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"] diff --git a/docker/ecr/Dockerfile.arm b/docker/ecr/Dockerfile.linux.arm similarity index 61% rename from docker/ecr/Dockerfile.arm rename to docker/ecr/Dockerfile.linux.arm index b36ba35..f8dd9e3 100644 --- a/docker/ecr/Dockerfile.arm +++ b/docker/ecr/Dockerfile.linux.arm @@ -1,4 +1,4 @@ FROM plugins/docker:linux-arm -ADD release/linux/arm64/drone-docker-ecr /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-ecr"] +ADD release/linux/arm/drone-ecr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"] diff --git a/docker/ecr/Dockerfile.arm64 b/docker/ecr/Dockerfile.linux.arm64 similarity index 62% rename from docker/ecr/Dockerfile.arm64 rename to docker/ecr/Dockerfile.linux.arm64 index 600273c..83ed26a 100644 --- a/docker/ecr/Dockerfile.arm64 +++ b/docker/ecr/Dockerfile.linux.arm64 @@ -1,4 +1,4 @@ FROM plugins/docker:linux-arm64 -ADD release/linux/arm64/drone-docker-ecr /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-ecr"] \ No newline at end of file +ADD release/linux/arm64/drone-ecr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"] diff --git a/docker/ecr/manifest.tmpl b/docker/ecr/manifest.tmpl new file mode 100644 index 0000000..424295f --- /dev/null +++ b/docker/ecr/manifest.tmpl @@ -0,0 +1,25 @@ +image: plugins/ecr:{{#if build.tag}}{{trimPrefix build.tag "v"}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - + image: plugins/ecr:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: plugins/ecr:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + - + image: plugins/ecr:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/docker/gcr/Dockerfile b/docker/gcr/Dockerfile deleted file mode 100644 index 92d562d..0000000 --- a/docker/gcr/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -# docker build --rm -f docker/gcr/Dockerfile -t plugins/gcr . - -FROM plugins/docker:latest - -ADD release/linux/amd64/drone-docker-gcr /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-gcr"] diff --git a/docker/gcr/Dockerfile.linux.amd64 b/docker/gcr/Dockerfile.linux.amd64 new file mode 100644 index 0000000..b756e04 --- /dev/null +++ b/docker/gcr/Dockerfile.linux.amd64 @@ -0,0 +1,4 @@ +FROM plugins/docker:linux-amd64 + +ADD release/linux/amd64/drone-gcr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"] diff --git a/docker/gcr/Dockerfile.arm b/docker/gcr/Dockerfile.linux.arm similarity index 61% rename from docker/gcr/Dockerfile.arm rename to docker/gcr/Dockerfile.linux.arm index 5d45caf..718ce0f 100644 --- a/docker/gcr/Dockerfile.arm +++ b/docker/gcr/Dockerfile.linux.arm @@ -1,4 +1,4 @@ FROM plugins/docker:linux-arm -ADD release/linux/arm64/drone-docker-gcr /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-gcr"] +ADD release/linux/arm/drone-gcr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"] diff --git a/docker/gcr/Dockerfile.arm64 b/docker/gcr/Dockerfile.linux.arm64 similarity index 61% rename from docker/gcr/Dockerfile.arm64 rename to docker/gcr/Dockerfile.linux.arm64 index 49c049b..396e373 100644 --- a/docker/gcr/Dockerfile.arm64 +++ b/docker/gcr/Dockerfile.linux.arm64 @@ -1,4 +1,4 @@ FROM plugins/docker:linux-arm64 -ADD release/linux/arm64/drone-docker-gcr /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-gcr"] +ADD release/linux/arm64/drone-gcr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"] diff --git a/docker/gcr/manifest.tmpl b/docker/gcr/manifest.tmpl new file mode 100644 index 0000000..82f8dae --- /dev/null +++ b/docker/gcr/manifest.tmpl @@ -0,0 +1,25 @@ +image: plugins/gcr:{{#if build.tag}}{{trimPrefix build.tag "v"}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - + image: plugins/gcr:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: plugins/gcr:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + - + image: plugins/gcr:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/docker/heroku/Dockerfile b/docker/heroku/Dockerfile deleted file mode 100644 index 6f53c65..0000000 --- a/docker/heroku/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -# docker build --rm -f docker/heroku/Dockerfile -t plugins/heroku . - -FROM plugins/docker:latest - -ADD release/linux/amd64/drone-docker-heroku /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-heroku"] diff --git a/docker/heroku/Dockerfile.linux.amd64 b/docker/heroku/Dockerfile.linux.amd64 new file mode 100644 index 0000000..e2e7e52 --- /dev/null +++ b/docker/heroku/Dockerfile.linux.amd64 @@ -0,0 +1,4 @@ +FROM plugins/docker:linux-amd64 + +ADD release/linux/amd64/drone-heroku /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"] diff --git a/docker/heroku/Dockerfile.arm b/docker/heroku/Dockerfile.linux.arm similarity index 59% rename from docker/heroku/Dockerfile.arm rename to docker/heroku/Dockerfile.linux.arm index e521b02..b233cca 100644 --- a/docker/heroku/Dockerfile.arm +++ b/docker/heroku/Dockerfile.linux.arm @@ -1,4 +1,4 @@ FROM plugins/docker:linux-arm -ADD release/linux/arm/drone-docker-heroku /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-heroku"] +ADD release/linux/arm/drone-heroku /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"] diff --git a/docker/heroku/Dockerfile.arm64 b/docker/heroku/Dockerfile.linux.arm64 similarity index 59% rename from docker/heroku/Dockerfile.arm64 rename to docker/heroku/Dockerfile.linux.arm64 index c9e9fe8..e49f7c6 100644 --- a/docker/heroku/Dockerfile.arm64 +++ b/docker/heroku/Dockerfile.linux.arm64 @@ -1,4 +1,4 @@ FROM plugins/docker:linux-arm64 -ADD release/linux/arm64/drone-docker-heroku /bin/ -ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker-heroku"] +ADD release/linux/arm64/drone-heroku /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"] diff --git a/docker/heroku/manifest.tmpl b/docker/heroku/manifest.tmpl new file mode 100644 index 0000000..1c2315c --- /dev/null +++ b/docker/heroku/manifest.tmpl @@ -0,0 +1,25 @@ +image: plugins/heroku:{{#if build.tag}}{{trimPrefix build.tag "v"}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - + image: plugins/heroku:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: plugins/heroku:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + - + image: plugins/heroku:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9f5a2f2 --- /dev/null +++ b/go.mod @@ -0,0 +1,14 @@ +module github.com/drone-plugins/drone-docker + +require ( + github.com/aws/aws-sdk-go v1.16.15 + github.com/coreos/go-semver v0.2.0 + github.com/joho/godotenv v1.3.0 + github.com/sirupsen/logrus v1.3.0 + github.com/urfave/cli v1.20.0 + golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e // indirect + golang.org/x/text v0.3.0 // indirect + gopkg.in/yaml.v2 v2.2.2 // indirect +) + +replace github.com/urfave/cli => github.com/bradrydzewski/cli v0.0.0-20190108225652-0d51abd87c77 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..1c09484 --- /dev/null +++ b/go.sum @@ -0,0 +1,34 @@ +github.com/aws/aws-sdk-go v1.16.15 h1:kQyxfRyjAwIYjf0225sn/pn+WAlncKyI8dmT3+ItMFE= +github.com/aws/aws-sdk-go v1.16.15/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/bradrydzewski/cli v0.0.0-20190108225652-0d51abd87c77/go.mod h1:4SmsVk3pOgYeJlG54e23Ztd/HucXeH5RmH5bNO+uOpk= +github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +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/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +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/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= +github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +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/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +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=