Compare commits

...

36 Commits

Author SHA1 Message Date
c7b4b0c4f7
Merge remote-tracking branch 'upstream/master' ...
Some checks failed
continuous-integration/drone/push Build is failing
...into edge-dind
2022-04-01 20:34:31 +02:00
TP Honey
d0b9da388f
Merge pull request #358 from tphoney/DRON-237
(DRON-237) cards add link to image repo, minor cleanup
2022-02-23 14:17:03 +00:00
TP Honey
332b73d3b0 (DRON-237) cards add link to image repo, minor cleanup 2022-02-23 12:28:40 +00:00
aa80cf46f3
chore: bump dind to 20.11.11
Some checks failed
continuous-integration/drone/push Build is failing
2022-02-21 02:16:08 +01:00
TP Honey
b6c9110c83
Merge pull request #356 from tphoney/DRON-232
(DRON-232) enable build-kit for secrets consumption
2022-02-16 12:49:48 +00:00
TP Honey
05357ea390 (DRON-232) enable build-kit for secrets consumption 2022-02-16 11:22:07 +00:00
TP Honey
ad28b4d0f6
(maint) add sample_data.json for adaptive cards 2022-01-19 16:15:08 +00:00
TP Honey
96ee8a4ebf
(fix) Update card.json with UX (#355)
* Update card.json
2022-01-19 16:06:21 +00:00
Eoin McAfee
dc9bf3bc79
fixes window semver error (#354) 2022-01-19 09:45:56 +00:00
Eoin McAfee
246dfb3c0e
(feat) publish docker data to create drone card (#347)
* plugin logic to write card data to publish drone card
2022-01-13 12:14:53 +00:00
TP Honey
3593c4165c
Merge pull request #353 from drone-plugins/v20.10.9.1
release prep for 20.10.9.1
2022-01-13 11:30:36 +00:00
Eoin McAfee
3922dcfea5 release prep for 20.10.9.1 2022-01-13 11:08:47 +00:00
Shubham Agrawal
47dc8555ad
Fix ECR & GCR docker publish on windows (#352) 2022-01-12 22:32:57 +05:30
TP Honey
0ffe085ddc
Merge pull request #351 from drone-plugins/win_fix
Fix windows docker builds
2022-01-10 10:02:17 +00:00
Shubham Agrawal
80d227e138 Fix windows docker builds 2022-01-08 00:31:45 +05:30
TP Honey
64b6aa187d
Merge pull request #350 from drone-plugins/fix_win_pipeline
Fix powershell script to publish windows images
2022-01-07 10:27:13 +00:00
Shubham Agrawal
74ec8ac761 Fix powershell script to publish windows images 2022-01-07 11:41:11 +05:30
TP Honey
368583a464
Merge pull request #348 from drone-plugins/serialize_win_1809
Serialize windows 1809 pipelines
2022-01-06 14:03:37 +00:00
Shubham Agrawal
28175f4003 Serialize windows 1809 pipelines 2022-01-06 13:28:00 +05:30
Shubham Agrawal
85e715fd5d
Support for windows images for tags (#346) 2022-01-05 23:28:27 +05:30
984e78e4c7
chore: bump dind to 20.10.10
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-04 22:24:32 +01:00
Eoin McAfee
4d8c628184
Merge pull request #342 from drone-plugins/task/bump-latest-version
bump to version 20.10.9:
2021-11-03 08:47:17 +00:00
Eoin McAfee
0244fdbc12 bump to version 20.10.9: 2021-11-02 11:23:08 +00:00
Eoin McAfee
28105d09d1
Merge pull request #334 from gzm0/upgrade-dind
Upgrade Docker dind to 20.10.9 for 64bit platforms
2021-11-02 11:03:25 +00:00
3e0e3c8cb5
bump dind to 20.10.9
All checks were successful
continuous-integration/drone/push Build is passing
rebased on master + applied the previous changes

commit b96d5245e363b8e465c95fde3dd7d3a00078da07
Author: surtur <a_mirre@utb.cz>
Date:   Fri Oct 22 14:28:24 2021 +0200

    chore: bump dind to 20.10.9

commit ca9cfe9733edef3df9ecae19d51976ea6371baf5
Author: surtur <a_mirre@utb.cz>
Date:   Tue Jun 8 22:32:45 2021 +0200

    chore: bump docker to 20.10.7-dind

commit 5dc2b561ae0cc0e75cf7f8ec78daeb0f1b2eafcd
Author: surtur <a_mirre@utb.cz>
Date:   Tue Apr 13 10:00:07 2021 +0200

    chore: bump docker to 20.10.6-dind

commit 6dc63b2b1d7ec133ae2b4a210f625364faa973b1
Author: surtur <a_mirre@utb.cz>
Date:   Wed Mar 17 02:35:29 2021 +0100

    chore: bump docker to 20.10.5-dind

commit 1ae4536a1e38d54e3d29812b70e52fabd25530b7
Author: surtur <a_mirre@utb.cz>
Date:   Wed Mar 17 01:11:36 2021 +0100

    docker: add multiple different image tags

    rolling:
    * latest
    * edge-dind

    fixed to a commit:
    * ${DRONE_COMMIT_SHA:0:8}
    * ${DRONE_COMMIT_SHA:0:8}-edge-dind
    * ${DRONE_COMMIT_SHA:0:8}-linux-amd64

commit 6b86978633e0b5ba039bb5139a4f9d83ce5b0e35
Author: surtur <a_mirre@utb.cz>
Date:   Wed Mar 17 02:22:36 2021 +0100

    ci: use plugins/docker:linux-amd64

    * bump from :18
    * add repo tag for dry_run

commit 2a52c7ee365d4e05d6657fe0481af4c073c59d62
Author: surtur <a_mirre@utb.cz>
Date:   Tue Mar 16 22:26:30 2021 +0100

    chore: bump docker to 19.03.15-dind

commit e5693c332a0e81366085ce9508590242f5e79f5a
Author: surtur <a_mirre@utb.cz>
Date:   Tue Mar 16 21:53:51 2021 +0100

    ci: dry-run on push+publish to immawanderer

commit 07c40b46a61421b1c3a6aa6bc4edaf089631c360
Author: surtur <a_mirre@utb.cz>
Date:   Tue Mar 16 19:59:34 2021 +0100

    jsonnet: thow out {arm,gcr,acr,heroku} stuff

commit f0056159bf98e9130d1af882f08fdde2e382629c
Author: surtur <a_mirre@utb.cz>
Date:   Tue Mar 16 19:26:12 2021 +0100

    ci: edit .drone.yml to only build for linux-amd64

    * rm windows pipelines as I don't have any windows runners
    * rm arm/arm64 pipelines as I don't have any arm runners
    * rm {ecr,acr,whatever} publish steps as we're not publishing anything
      just yet
    * tag the image under immawanderer, not the official plugins repo
    * run as a dry_run (cause we're not really publishing, right?)

commit 6ec5e7141117e1489faa378b1c00e459d789642d
Merge: 88f8bf1 0911e6a
Author: TP Honey <tp@harness.io>
Date:   Wed Oct 13 17:19:30 2021 +0100

    Merge pull request #338 from tphoney/bump-go-1.13

    (maint) bump git to 1.13 for build and test

commit 0911e6a922663d52e1d9e4dfdee51a383d2b95fa
Author: TP Honey <tp@harness.io>
Date:   Wed Oct 13 14:49:29 2021 +0100

    (maint) bump git to 1.13 for build and test

commit 88f8bf1cb0c41297dbe8f5bb5ff1006b51a9f718
Merge: 607b04a 2d70a1f
Author: TP Honey <tp@harness.io>
Date:   Wed Oct 13 14:32:03 2021 +0100

    Merge pull request #337 from tphoney/prep_v19.03.9

    (maint) v19.03.9 release prep

commit 2d70a1fa7cb4a8f2afe38cad3a1984804f1df464
Author: TP Honey <tp@harness.io>
Date:   Wed Oct 13 14:24:58 2021 +0100

    (maint) v19.03.9 release prep

commit 607b04a8719332e8bbef6ff76ac26e30715df060
Merge: 72ef7b1 e44c2d4
Author: Eoin McAfee <83226740+eoinmcafee00@users.noreply.github.com>
Date:   Thu Sep 23 15:52:24 2021 +0100

    Merge pull request #333 from jimsheldon/ecr-externalid

    adding support for externalId

commit e44c2d46eafd5f223ac246eb003bc6b3427b3374
Author: Jim Sheldon <jim.sheldon@meltwater.com>
Date:   Fri Sep 17 15:33:05 2021 -0400

    adding support for externalId

commit 72ef7b1f3fa6c47c58f33ca312bdc8c484b6c5a4
Author: Brad Rydzewski <bradley.rydzewski@harness.io>
Date:   Mon Aug 2 22:15:39 2021 -0400

    log available credentials before login

commit fbbeec5a2e5845e488100da3885dc630fa3468fe
Author: Brad Rydzewski <bradley.rydzewski@harness.io>
Date:   Mon Aug 2 21:42:22 2021 -0400

    use Replace instead of ReplaceAll

commit b1d8698d1c5eb834b0703939e1001d23152300d2
Author: Brad Rydzewski <bradley.rydzewski@harness.io>
Date:   Mon Aug 2 21:28:37 2021 -0400

    print login failure reason to output

commit d4cf9f20f175ae550b11e0eeb44604c6d71bee20
Author: Brad Rydzewski <brad.rydzewski@gmail.com>
Date:   Sun Jul 11 15:50:43 2021 -0400

    remove pull always

commit f75380013d16585f4e4038483d6b948f0c025ff4
Merge: dd359df c10d367
Author: Brad Rydzewski <brad.rydzewski@gmail.com>
Date:   Sun Jul 11 15:39:35 2021 -0400

    Merge pull request #325 from drone-plugins/revert-322-update-seccomp

    Revert "Update seccomp to 20.10 docker"

commit c10d36754ccf53341f462a2e9f703315cc31f0cf
Author: Brad Rydzewski <brad.rydzewski@gmail.com>
Date:   Sun Jul 11 15:38:04 2021 -0400

    Revert "Update seccomp to 20.10 docker (#322)"

    This reverts commit dd359dfc7242b257f0f2078f1ef9027391d0bd0a.

commit dd359dfc7242b257f0f2078f1ef9027391d0bd0a
Author: techknowlogick <matti@mdranta.net>
Date:   Wed Jul 7 15:03:54 2021 -0400

    Update seccomp to 20.10 docker (#322)

    * Update seccomp to 20.10 docker

commit 729aa5d300a4085cfa6e0e8776368710a7fa96be
Merge: f08821b db5c216
Author: TP Honey <tp@harness.io>
Date:   Wed Jul 7 19:52:19 2021 +0100

    Merge pull request #323 from tphoney/docker_rate_limit

    (maint) CI, remove the dry run steps, due to rate limiting

commit db5c2161febe6292386d9dc7dd8e20047219d15e
Author: TP Honey <tp@harness.io>
Date:   Wed Jul 7 19:37:30 2021 +0100

    (maint) CI, remove the dry run steps, due to rate limiting

commit f08821b02496bfa8814d688523e170156050128f
Merge: 0f6bd8a 5760e7b
Author: Brad Rydzewski <brad.rydzewski@gmail.com>
Date:   Tue Apr 6 15:55:56 2021 -0400

    Merge pull request #300 from rvoitenko/ecr_scan_on_push

    ECR: adding setting to enable image scanning while repo creation

commit 5760e7b4e821a89805454f614cf2635f7ff7dc96
Merge: 3501d9a 7ade37a
Author: Roman Voitenko <r00mka@gmail.com>
Date:   Sat Feb 20 13:32:16 2021 +0100

    Merge branch 'master' into ecr_scan_on_push

commit 3501d9a65d0f773b01cf2c1a50d13a7726bca166
Author: Roman Voitenko <roman.voitenko@konsult.atg.se>
Date:   Thu Oct 1 10:43:25 2020 +0200

    add possibility to turn on/off image scanning not only during repo creation, but when repo already created

commit d8b6b48fa34561c16680cc5787ab97b3f18b2141
Author: Roman Voitenko <roman.voitenko@konsult.atg.se>
Date:   Wed Sep 30 23:32:23 2020 +0200

    add possibility to turn on ECR image scanning for repos created by ecr plugin
2021-10-22 14:34:35 +02:00
Tobias Schlatter
501eae03f2 Upgrade to dind 20.10.9 which has been released in the meanwhile 2021-10-18 16:45:12 +02:00
Tobias Schlatter
5490a1c24c Upgrade Docker dind to 20.10.8 for 64bit platforms
This is an alternative to #327. As the discussion on that PR shows, it
seems docker is not going to provide updates for the arm32 platform
anymore.

Fixes #326 and fixes #330.
2021-10-18 16:45:12 +02:00
d2940d43e2
chore: bump docker to 20.10.7-dind
Some checks failed
continuous-integration/drone/push Build is failing
2021-06-08 22:32:45 +02:00
91965e06ed
chore: bump docker to 20.10.6-dind
All checks were successful
continuous-integration/drone/push Build is passing
2021-04-13 10:00:07 +02:00
9787e81f38
chore: bump docker to 20.10.5-dind
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-17 02:35:29 +01:00
48ca97aeb5
docker: add multiple different image tags
All checks were successful
continuous-integration/drone/push Build is passing
rolling:
* latest
* edge-dind

fixed to a commit:
* ${DRONE_COMMIT_SHA:0:8}
* ${DRONE_COMMIT_SHA:0:8}-edge-dind
* ${DRONE_COMMIT_SHA:0:8}-linux-amd64
2021-03-17 02:23:38 +01:00
d532d1b620
ci: use plugins/docker:linux-amd64
* bump from :18
* add repo tag for dry_run
2021-03-17 02:22:36 +01:00
41993225d6
chore: bump docker to 19.03.15-dind 2021-03-17 02:15:37 +01:00
22d00cc6cb
ci: dry-run on push+publish to immawanderer
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-17 00:49:30 +01:00
3bc2768d6f
jsonnet: thow out {arm,gcr,acr,heroku} stuff 2021-03-16 22:11:33 +01:00
1ba922ee04
ci: edit .drone.yml to only build for linux-amd64
* rm windows pipelines as I don't have any windows runners
* rm arm/arm64 pipelines as I don't have any arm runners
* rm {ecr,acr,whatever} publish steps as we're not publishing anything
  just yet
* tag the image under immawanderer, not the official plugins repo
* run as a dry_run (cause we're not really publishing, right?)
2021-03-16 22:11:33 +01:00
36 changed files with 679 additions and 1207 deletions

@ -4,47 +4,7 @@ local pipeline = import 'pipeline.libsonnet';
pipeline.test('linux', 'amd64'),
pipeline.build('docker', 'linux', 'amd64'),
pipeline.build('docker', 'linux', 'arm64'),
pipeline.build('docker', 'linux', 'arm'),
pipeline.notifications('docker', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('gcr', 'linux', 'amd64'),
pipeline.build('gcr', 'linux', 'arm64'),
pipeline.build('gcr', 'linux', 'arm'),
pipeline.notifications('gcr', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('acr', 'linux', 'amd64'),
pipeline.build('acr', 'linux', 'arm64'),
pipeline.build('acr', 'linux', 'arm'),
pipeline.notifications('acr', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('ecr', 'linux', 'amd64'),
pipeline.build('ecr', 'linux', 'arm64'),
pipeline.build('ecr', 'linux', 'arm'),
pipeline.notifications('ecr', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
pipeline.build('heroku', 'linux', 'amd64'),
pipeline.build('heroku', 'linux', 'arm64'),
pipeline.build('heroku', 'linux', 'arm'),
pipeline.notifications('heroku', depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
]

1119
.drone.yml

@ -8,7 +8,7 @@ platform:
steps:
- name: vet
image: golang:1.13
image: golang:1.17.3
commands:
- go vet ./...
environment:
@ -18,7 +18,7 @@ steps:
path: /go
- name: test
image: golang:1.13
image: golang:1.17.3
commands:
- go test -cover ./...
environment:
@ -34,123 +34,11 @@ volumes:
trigger:
ref:
- refs/heads/master
- refs/heads/edge-dind
- refs/heads/feature-*
- "refs/tags/**"
- "refs/pull/**"
---
kind: pipeline
type: ssh
name: windows-1809-amd64-docker
platform:
os: windows
server:
host: windows.1809.amd64.plugins.drone.ci
password:
from_secret: windows_password
user:
from_secret: windows_username
steps:
- name: build
commands:
# TODO use the new DRONE_SEMVER_SHORT environment variables to
# publish docker images for tag events.
- go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
- docker login -u $env:USERNAME -p $env:PASSWORD
- docker build -f docker/docker/Dockerfile.windows.1809 -t plugins/docker:windows-1809-amd64 .
- docker push plugins/docker:windows-1809-amd64
environment:
CGO_ENABLED: "0"
USERNAME:
from_secret: docker_username
PASSWORD:
from_secret: docker_password
trigger:
event:
- push
depends_on:
- testing
# ---
# kind: pipeline
# type: ssh
# name: windows-1903-amd64-docker
# platform:
# os: windows
# server:
# host: windows.1903.amd64.plugins.drone.ci
# password:
# from_secret: windows_password
# user:
# from_secret: windows_username
# steps:
# - name: build
# commands:
# # TODO use the new DRONE_SEMVER_SHORT environment variables to
# # publish docker images for tag events.
# - go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
# - docker login -u $env:USERNAME -p $env:PASSWORD
# - docker build -f docker/docker/Dockerfile.windows.1903 -t plugins/docker:windows-1903-amd64 .
# - docker push plugins/docker:windows-1903-amd64
# environment:
# CGO_ENABLED: "0"
# USERNAME:
# from_secret: docker_username
# PASSWORD:
# from_secret: docker_password
# trigger:
# event:
# - push
# depends_on:
# - testing
---
kind: pipeline
type: ssh
name: windows-1909-amd64-docker
platform:
os: windows
server:
host: windows.1909.amd64.plugins.drone.ci
password:
from_secret: windows_password
user:
from_secret: windows_username
steps:
- name: build
commands:
# TODO use the new DRONE_SEMVER_SHORT environment variables to
# publish docker images for tag events.
- go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
- docker login -u $env:USERNAME -p $env:PASSWORD
- docker build -f docker/docker/Dockerfile.windows.1909 -t plugins/docker:windows-1909-amd64 .
- docker push plugins/docker:windows-1909-amd64
environment:
CGO_ENABLED: "0"
USERNAME:
from_secret: docker_username
PASSWORD:
from_secret: docker_password
trigger:
event:
- push
depends_on:
- testing
---
kind: pipeline
name: linux-amd64-docker
@ -161,7 +49,7 @@ platform:
steps:
- name: build-push
image: golang:1.13
image: golang:1.17.3
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker"
environment:
@ -173,7 +61,7 @@ steps:
- tag
- name: build-tag
image: golang:1.13
image: golang:1.17.3
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker"
environment:
@ -184,23 +72,29 @@ steps:
- tag
- name: executable
image: golang:1.13
image: golang:1.17.3
commands:
- ./release/linux/amd64/drone-docker --help
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: plugins/docker
tags:
- latest
- edge-dind
- linux-amd64
- ${DRONE_COMMIT_SHA:0:8}
- ${DRONE_COMMIT_SHA:0:8}-edge-dind
- ${DRONE_COMMIT_SHA:0:8}-linux-amd64
repo: immawanderer/drone-docker
username:
from_secret: docker_username
password:
from_secret: docker_password
when:
branch: [edge-dind]
event:
exclude:
- pull_request
@ -208,985 +102,12 @@ steps:
trigger:
ref:
- refs/heads/master
- refs/heads/edge-dind
- refs/heads/feature-*
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
---
kind: pipeline
name: linux-arm64-docker
platform:
os: linux
arch: arm64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-docker ./cmd/drone-docker"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
image: golang:1.13
commands:
- ./release/linux/arm64/drone-docker --help
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.arm64
password:
from_secret: docker_password
repo: plugins/docker
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
---
kind: pipeline
name: linux-arm-docker
platform:
os: linux
arch: arm
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-docker ./cmd/drone-docker"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-docker ./cmd/drone-docker"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
image: golang:1.13
commands:
- ./release/linux/arm/drone-docker --help
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: plugins/docker
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
---
kind: pipeline
name: notifications-docker
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
spec: docker/docker/manifest.tmpl
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- windows-1809-amd64-docker
- windows-1909-amd64-docker
- linux-amd64-docker
- linux-arm64-docker
- linux-arm-docker
# - windows-1903-amd64-dfocker
---
kind: pipeline
name: linux-amd64-gcr
platform:
os: linux
arch: amd64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: plugins/gcr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-amd64-docker
---
kind: pipeline
name: linux-arm64-gcr
platform:
os: linux
arch: arm64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-gcr ./cmd/drone-gcr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.arm64
password:
from_secret: docker_password
repo: plugins/gcr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm64-docker
---
kind: pipeline
name: linux-arm-gcr
platform:
os: linux
arch: arm
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-gcr ./cmd/drone-gcr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-gcr ./cmd/drone-gcr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: plugins/gcr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm-docker
---
kind: pipeline
name: notifications-gcr
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
spec: docker/gcr/manifest.tmpl
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64-gcr
- linux-arm64-gcr
- linux-arm-gcr
---
kind: pipeline
name: linux-amd64-ecr
platform:
os: linux
arch: amd64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: plugins/ecr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-amd64-docker
---
kind: pipeline
name: linux-arm64-ecr
platform:
os: linux
arch: arm64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-ecr ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.arm64
password:
from_secret: docker_password
repo: plugins/ecr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm64-docker
---
kind: pipeline
name: linux-arm-ecr
platform:
os: linux
arch: arm
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-ecr ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-ecr ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: plugins/ecr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm-docker
---
kind: pipeline
name: notifications-ecr
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
spec: docker/ecr/manifest.tmpl
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64-ecr
- linux-arm64-ecr
- linux-arm-ecr
---
kind: pipeline
name: linux-amd64-heroku
platform:
os: linux
arch: amd64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: plugins/heroku
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-amd64-docker
---
kind: pipeline
name: linux-arm64-heroku
platform:
os: linux
arch: arm64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-heroku ./cmd/drone-heroku"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.arm64
password:
from_secret: docker_password
repo: plugins/heroku
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm64-docker
---
kind: pipeline
name: linux-arm-heroku
platform:
os: linux
arch: arm
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-heroku ./cmd/drone-heroku"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-heroku ./cmd/drone-heroku"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: plugins/heroku
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm-docker
---
kind: pipeline
name: notifications-heroku
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
spec: docker/heroku/manifest.tmpl
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64-heroku
- linux-arm64-heroku
- linux-arm-heroku
---
kind: pipeline
name: linux-amd64-acr
platform:
os: linux
arch: amd64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/amd64/drone-acr ./cmd/drone-acr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
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-acr ./cmd/drone-acr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/acr/Dockerfile.linux.amd64
password:
from_secret: docker_password
repo: plugins/acr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-amd64-docker
---
kind: pipeline
name: linux-arm64-acr
platform:
os: linux
arch: arm64
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm64/drone-acr ./cmd/drone-acr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
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-acr ./cmd/drone-acr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/acr/Dockerfile.linux.arm64
password:
from_secret: docker_password
repo: plugins/acr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm64-docker
---
kind: pipeline
name: linux-arm-acr
platform:
os: linux
arch: arm
steps:
- name: build-push
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-acr ./cmd/drone-acr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
image: golang:1.13
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-acr ./cmd/drone-acr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/acr/Dockerfile.linux.arm
password:
from_secret: docker_password
repo: plugins/acr
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- linux-arm-docker
---
kind: pipeline
name: notifications-acr
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest
settings:
ignore_missing: true
password:
from_secret: docker_password
spec: docker/acr/manifest.tmpl
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64-acr
- linux-arm64-acr
- linux-arm-acr
...

@ -1,5 +1,41 @@
# Changelog
## [v20.11.0](https://github.com/drone-plugins/drone-docker/tree/v20.11.0) (2022-01-19)
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.10.9.1...v20.11.0)
**Merged pull requests:**
- \(feat\) publish docker data to create drone card [\#347](https://github.com/drone-plugins/drone-docker/pull/347) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v20.10.9.1](https://github.com/drone-plugins/drone-docker/tree/v20.10.9.1) (2022-01-13)
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.10.9...v20.10.9.1)
**Implemented enhancements:**
- Serialize windows 1809 pipelines [\#348](https://github.com/drone-plugins/drone-docker/pull/348) ([shubham149](https://github.com/shubham149))
- Support for windows images for tags [\#346](https://github.com/drone-plugins/drone-docker/pull/346) ([shubham149](https://github.com/shubham149))
**Fixed bugs:**
- Fix ECR & GCR docker publish on windows [\#352](https://github.com/drone-plugins/drone-docker/pull/352) ([shubham149](https://github.com/shubham149))
- Fix windows docker builds [\#351](https://github.com/drone-plugins/drone-docker/pull/351) ([shubham149](https://github.com/shubham149))
- Fix powershell script to publish windows images [\#350](https://github.com/drone-plugins/drone-docker/pull/350) ([shubham149](https://github.com/shubham149))
**Merged pull requests:**
- release prep for 20.10.9.1 [\#353](https://github.com/drone-plugins/drone-docker/pull/353) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v20.10.9](https://github.com/drone-plugins/drone-docker/tree/v20.10.9) (2021-11-03)
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v19.03.9...v20.10.9)
**Merged pull requests:**
- bump to version 20.10.9: [\#342](https://github.com/drone-plugins/drone-docker/pull/342) ([eoinmcafee00](https://github.com/eoinmcafee00))
- Upgrade Docker dind to 20.10.9 for 64bit platforms [\#334](https://github.com/drone-plugins/drone-docker/pull/334) ([gzm0](https://github.com/gzm0))
## [v19.03.9](https://github.com/drone-plugins/drone-docker/tree/v19.03.9) (2021-10-13)
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v19.03.8...v19.03.9)
@ -17,6 +53,11 @@
**Merged pull requests:**
<<<<<<< HEAD
=======
- \(maint\) bump git to 1.13 for build and test [\#338](https://github.com/drone-plugins/drone-docker/pull/338) ([tphoney](https://github.com/tphoney))
- \(maint\) v19.03.9 release prep [\#337](https://github.com/drone-plugins/drone-docker/pull/337) ([tphoney](https://github.com/tphoney))
>>>>>>> upstream/master
- \(maint\) CI, remove the dry run steps, due to rate limiting [\#323](https://github.com/drone-plugins/drone-docker/pull/323) ([tphoney](https://github.com/tphoney))
- Update seccomp to 20.10 docker [\#322](https://github.com/drone-plugins/drone-docker/pull/322) ([techknowlogick](https://github.com/techknowlogick))

@ -72,3 +72,23 @@ docker run --rm \
--privileged \
plugins/docker --dry-run
```
## Release procedure
Run the changelog generator.
```BASH
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u drone-plugins -p drone-docker -t <secret github token>
```
You can generate a token by logging into your GitHub account and going to Settings -> Personal access tokens.
Next we tag the PR's with the fixes or enhancements labels. If the PR does not fufil the requirements, do not add a label.
Run the changelog generator again with the future version according to semver.
```BASH
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u drone-plugins -p drone-docker -t <secret token> --future-release v1.0.0
```
Create your pull request for the release. Get it merged then tag the release.

88
card.go Normal file

@ -0,0 +1,88 @@
package docker
import (
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
"time"
"github.com/drone/drone-go/drone"
"github.com/inhies/go-bytesize"
)
func (p Plugin) writeCard() error {
cmd := exec.Command("docker", "inspect", p.Build.Name)
data, err := cmd.CombinedOutput()
if err != nil {
return err
}
out := Card{}
if err := json.Unmarshal(data, &out); err != nil {
return err
}
inspect := out[0]
inspect.SizeString = fmt.Sprint(bytesize.New(float64(inspect.Size)))
inspect.VirtualSizeString = fmt.Sprint(bytesize.New(float64(inspect.VirtualSize)))
inspect.Time = fmt.Sprint(inspect.Metadata.LastTagTime.Format(time.RFC3339))
// change slice of tags to slice of TagStruct
var sliceTagStruct []TagStruct
for _, tag := range inspect.RepoTags {
sliceTagStruct = append(sliceTagStruct, TagStruct{Tag: tag})
}
inspect.ParsedRepoTags = sliceTagStruct[1:] // remove the first tag which is always "hash:latest"
// create the url from repo and registry
inspect.URL = mapRegistryToURL(p.Daemon.Registry, p.Build.Repo)
cardData, _ := json.Marshal(inspect)
card := drone.CardInput{
Schema: "https://drone-plugins.github.io/drone-docker/card.json",
Data: cardData,
}
writeCard(p.CardPath, &card)
return nil
}
func writeCard(path string, card interface{}) {
data, _ := json.Marshal(card)
switch {
case path == "/dev/stdout":
writeCardTo(os.Stdout, data)
case path == "/dev/stderr":
writeCardTo(os.Stderr, data)
case path != "":
ioutil.WriteFile(path, data, 0644)
}
}
func writeCardTo(out io.Writer, data []byte) {
encoded := base64.StdEncoding.EncodeToString(data)
io.WriteString(out, "\u001B]1338;")
io.WriteString(out, encoded)
io.WriteString(out, "\u001B]0m")
io.WriteString(out, "\n")
}
func mapRegistryToURL(registry, repo string) (url string) {
url = "https://"
var domain string
if strings.Contains(registry, "amazonaws.com") {
domain = "gallery.ecr.aws/"
} else if strings.Contains(registry, "gcr.io") {
domain = "console.cloud.google.com/gcr/images"
} else {
// default to docker hub
domain = "hub.docker.com/r/"
}
url = path.Join(url, domain, repo)
return url
}

@ -7,6 +7,9 @@ import (
"strings"
"github.com/joho/godotenv"
"github.com/sirupsen/logrus"
docker "github.com/drone-plugins/drone-docker"
)
func main() {
@ -40,12 +43,12 @@ func main() {
os.Setenv("DOCKER_PASSWORD", password)
// invoke the base docker plugin binary
cmd := exec.Command("drone-docker")
cmd := exec.Command(docker.GetDroneDockerExecCmd())
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
os.Exit(1)
logrus.Fatal(err)
}
}

@ -2,6 +2,7 @@ package main
import (
"os"
"runtime"
"github.com/joho/godotenv"
"github.com/sirupsen/logrus"
@ -248,6 +249,16 @@ func main() {
Usage: "additional host:IP mapping",
EnvVar: "PLUGIN_ADD_HOST",
},
cli.StringFlag{
Name: "secret",
Usage: "secret key value pair eg id=MYSECRET",
EnvVar: "PLUGIN_SECRET",
},
cli.StringFlag{
Name: "drone-card-path",
Usage: "card path location to write to",
EnvVar: "DRONE_CARD_PATH",
},
}
if err := app.Run(os.Args); err != nil {
@ -266,27 +277,29 @@ func run(c *cli.Context) error {
Email: c.String("docker.email"),
Config: c.String("docker.config"),
},
CardPath: c.String("drone-card-path"),
Build: docker.Build{
Remote: c.String("remote.url"),
Name: c.String("commit.sha"),
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
ArgsEnv: c.StringSlice("args-from-env"),
Target: c.String("target"),
Squash: c.Bool("squash"),
Pull: c.BoolT("pull-image"),
CacheFrom: c.StringSlice("cache-from"),
Compress: c.Bool("compress"),
Repo: c.String("repo"),
Labels: c.StringSlice("custom-labels"),
LabelSchema: c.StringSlice("label-schema"),
AutoLabel: c.BoolT("auto-label"),
Link: c.String("link"),
NoCache: c.Bool("no-cache"),
AddHost: c.StringSlice("add-host"),
Quiet: c.Bool("quiet"),
Remote: c.String("remote.url"),
Name: c.String("commit.sha"),
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
ArgsEnv: c.StringSlice("args-from-env"),
Target: c.String("target"),
Squash: c.Bool("squash"),
Pull: c.BoolT("pull-image"),
CacheFrom: c.StringSlice("cache-from"),
Compress: c.Bool("compress"),
Repo: c.String("repo"),
Labels: c.StringSlice("custom-labels"),
LabelSchema: c.StringSlice("label-schema"),
AutoLabel: c.BoolT("auto-label"),
Link: c.String("link"),
NoCache: c.Bool("no-cache"),
Secret: c.String("secret"),
AddHost: c.StringSlice("add-host"),
Quiet: c.Bool("quiet"),
},
Daemon: docker.Daemon{
Registry: c.String("docker.registry"),
@ -327,3 +340,11 @@ func run(c *cli.Context) error {
return plugin.Exec()
}
func GetExecCmd() string {
if runtime.GOOS == "windows" {
return "C:/bin/drone-docker.exe"
}
return "drone-docker"
}

@ -11,12 +11,15 @@ import (
"strings"
"github.com/joho/godotenv"
"github.com/sirupsen/logrus"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecr"
docker "github.com/drone-plugins/drone-docker"
)
const defaultRegion = "us-east-1"
@ -110,11 +113,11 @@ func main() {
os.Setenv("DOCKER_PASSWORD", password)
// invoke the base docker plugin binary
cmd := exec.Command("drone-docker")
cmd := exec.Command(docker.GetDroneDockerExecCmd())
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err = cmd.Run(); err != nil {
os.Exit(1)
logrus.Fatal(err)
}
}

@ -8,6 +8,9 @@ import (
"strings"
"github.com/joho/godotenv"
"github.com/sirupsen/logrus"
docker "github.com/drone-plugins/drone-docker"
)
// gcr default username
@ -54,12 +57,12 @@ func main() {
os.Setenv("DOCKER_PASSWORD", password)
// invoke the base docker plugin binary
cmd := exec.Command("drone-docker")
cmd := exec.Command(docker.GetDroneDockerExecCmd())
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
os.Exit(1)
logrus.Fatal(err)
}
}

@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
)
@ -57,17 +58,46 @@ type (
Labels []string // Label map
Link string // Git repo link
NoCache bool // Docker build no-cache
Secret string // secret keypair
AddHost []string // Docker build add-host
Quiet bool // Docker build quiet
}
// Plugin defines the Docker plugin parameters.
Plugin struct {
Login Login // Docker login configuration
Build Build // Docker build configuration
Daemon Daemon // Docker daemon configuration
Dryrun bool // Docker push is skipped
Cleanup bool // Docker purge is enabled
Login Login // Docker login configuration
Build Build // Docker build configuration
Daemon Daemon // Docker daemon configuration
Dryrun bool // Docker push is skipped
Cleanup bool // Docker purge is enabled
CardPath string // Card path to write file to
}
Card []struct {
ID string `json:"Id"`
RepoTags []string `json:"RepoTags"`
ParsedRepoTags []TagStruct `json:"ParsedRepoTags"`
RepoDigests []interface{} `json:"RepoDigests"`
Parent string `json:"Parent"`
Comment string `json:"Comment"`
Created time.Time `json:"Created"`
Container string `json:"Container"`
DockerVersion string `json:"DockerVersion"`
Author string `json:"Author"`
Architecture string `json:"Architecture"`
Os string `json:"Os"`
Size int `json:"Size"`
VirtualSize int `json:"VirtualSize"`
Metadata struct {
LastTagTime time.Time `json:"LastTagTime"`
} `json:"Metadata"`
SizeString string
VirtualSizeString string
Time string
URL string `json:"URL"`
}
TagStruct struct {
Tag string `json:"Tag"`
}
)
@ -108,10 +138,10 @@ func (p Plugin) Exec() error {
// create Auth Config File
if p.Login.Config != "" {
os.MkdirAll(dockerHome, 0600)
os.MkdirAll(dockerHome, 0o600)
path := filepath.Join(dockerHome, "config.json")
err := ioutil.WriteFile(path, []byte(p.Login.Config), 0600)
err := ioutil.WriteFile(path, []byte(p.Login.Config), 0o600)
if err != nil {
return fmt.Errorf("Error writing config.json: %s", err)
}
@ -151,16 +181,11 @@ func (p Plugin) Exec() error {
for _, tag := range p.Build.Tags {
cmds = append(cmds, commandTag(p.Build, tag)) // docker tag
if p.Dryrun == false {
if !p.Dryrun {
cmds = append(cmds, commandPush(p.Build, tag)) // docker push
}
}
if p.Cleanup {
cmds = append(cmds, commandRmi(p.Build.Name)) // docker rmi
cmds = append(cmds, commandPrune()) // docker system prune -f
}
// execute all commands in batch mode.
for _, cmd := range cmds {
cmd.Stdout = os.Stdout
@ -179,6 +204,26 @@ func (p Plugin) Exec() error {
}
}
// output the adaptive card
if err := p.writeCard(); err != nil {
fmt.Printf("Could not create adaptive card. %s\n", err)
}
// execute cleanup routines in batch mode
if p.Cleanup {
// clear the slice
cmds = nil
cmds = append(cmds, commandRmi(p.Build.Name)) // docker rmi
cmds = append(cmds, commandPrune()) // docker system prune -f
for _, cmd := range cmds {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
trace(cmd)
}
}
return nil
}
@ -258,6 +303,9 @@ func commandBuild(build Build) *exec.Cmd {
for _, host := range build.AddHost {
args = append(args, "--add-host", host)
}
if build.Secret != "" {
args = append(args, "--secret", build.Secret)
}
if build.Target != "" {
args = append(args, "--target", build.Target)
}
@ -289,6 +337,10 @@ func commandBuild(build Build) *exec.Cmd {
}
}
// we need to enable buildkit, for secret support
if build.Secret != "" {
os.Setenv("DOCKER_BUILDKIT", "1")
}
return exec.Command(dockerExe, args...)
}
@ -416,3 +468,11 @@ func commandRmi(tag string) *exec.Cmd {
func trace(cmd *exec.Cmd) {
fmt.Fprintf(os.Stdout, "+ %s\n", strings.Join(cmd.Args, " "))
}
func GetDroneDockerExecCmd() string {
if runtime.GOOS == "windows" {
return "C:/bin/drone-docker.exe"
}
return "drone-docker"
}

@ -1,5 +1,5 @@
# escape=`
FROM plugins/docker:windows-1803
FROM plugins/docker:windows-1803-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ACR" `

@ -1,5 +1,5 @@
# escape=`
FROM plugins/docker:windows-1809
FROM plugins/docker:windows-1809-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ACR" `

@ -0,0 +1,10 @@
# escape=`
FROM plugins/docker:windows-1909-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ACR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-acr.exe C:/bin/drone-acr.exe
ENTRYPOINT [ "C:\\bin\\drone-acr.exe" ]

@ -24,14 +24,26 @@ manifests:
os: linux
variant: v7
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
platform:
architecture: amd64
os: windows
version: 1809
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
platform:
architecture: amd64
os: windows
version: 1903
-
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
platform:
architecture: amd64
os: windows
version: 1909

@ -1,4 +1,4 @@
FROM docker:19.03.8-dind
FROM docker:20.11.11-dind
ENV DOCKER_HOST=unix:///var/run/docker.sock

@ -1,4 +1,4 @@
FROM arm64v8/docker:19.03.8-dind
FROM arm64v8/docker:20.10.9-dind
ENV DOCKER_HOST=unix:///var/run/docker.sock

@ -24,7 +24,7 @@ manifests:
os: linux
variant: v7
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
platform:
architecture: amd64
os: windows

@ -1,5 +1,5 @@
# escape=`
FROM plugins/docker:windows-1803
FROM plugins/docker:windows-1803-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ECR" `

@ -1,5 +1,5 @@
# escape=`
FROM plugins/docker:windows-1809
FROM plugins/docker:windows-1809-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ECR" `

@ -0,0 +1,10 @@
# escape=`
FROM plugins/docker:windows-1909-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone ECR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-ecr.exe C:/bin/drone-ecr.exe
ENTRYPOINT [ "C:\\bin\\drone-ecr.exe" ]

@ -24,14 +24,26 @@ manifests:
os: linux
variant: v7
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
platform:
architecture: amd64
os: windows
version: 1809
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
platform:
architecture: amd64
os: windows
version: 1903
-
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
platform:
architecture: amd64
os: windows
version: 1909

@ -1,5 +1,5 @@
# escape=`
FROM plugins/docker:windows-1803
FROM plugins/docker:windows-1803-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone GCR" `

@ -1,5 +1,5 @@
# escape=`
FROM plugins/docker:windows-1809
FROM plugins/docker:windows-1809-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone GCR" `

@ -0,0 +1,10 @@
# escape=`
FROM plugins/docker:windows-1909-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone GCR" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
ADD release/windows/amd64/drone-gcr.exe C:/bin/drone-gcr.exe
ENTRYPOINT [ "C:\\bin\\drone-gcr.exe" ]

@ -24,14 +24,20 @@ manifests:
os: linux
variant: v7
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
platform:
architecture: amd64
os: windows
version: 1803
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
platform:
architecture: amd64
os: windows
version: 1809
-
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
platform:
architecture: amd64
os: windows
version: 1909

41
docs/card.data.json Normal file

@ -0,0 +1,41 @@
{
"Id": "sha256:3b0709c9afb41629c79c93355feed114d08a8c1bedd975eb53af08f4b867fd91",
"RepoTags": [
"798a0dae10d63d281eff4c06eaa12001ffd23740:latest",
"tphoney/test:latest"
],
"ParsedRepoTags": [
{
"Tag": ""
},
{
"Tag": ""
},
{
"Tag": "798a0dae10d63d281eff4c06eaa12001ffd23740:latest"
},
{
"Tag": "tphoney/test:latest"
}
],
"RepoDigests": [
"tphoney/test@sha256:93f8b95aaae7d194208b72e94a3a90544b00c8f2ad45aeb89d81a0c6ccbc5e19"
],
"Parent": "sha256:493aa330a5929027dd8ecded9fa8c473a1508d17c0fd7d6a94a7f197f8d22c60",
"Comment": "",
"Created": "2022-02-16T11:13:40.8956582Z",
"Container": "a57c0ca4dd2e081df8758e00549f7abe83803f1a1a7aaaf1cd8e685a5eb5a097",
"DockerVersion": "20.10.9",
"Author": "",
"Architecture": "amd64",
"Os": "linux",
"Size": 14045949,
"VirtualSize": 14045949,
"Metadata": {
"LastTagTime": "2022-02-16T11:13:40.9433973Z"
},
"SizeString": "13.40MB",
"VirtualSizeString": "13.40MB",
"Time": "2022-02-16T11:13:40Z",
"URL": "http://hub.docker.com/repositories/tphoney/test/"
}

138
docs/card.json Normal file

@ -0,0 +1,138 @@
{
"type": "AdaptiveCard",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "Image",
"url": "https://d36jcksde1wxzq.cloudfront.net/be7833db9bddb4494d2a7c3dd659199a.png",
"size": "small"
}
],
"width": "auto"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"text": "Plugin: Drone Docker",
"wrap": true,
"size": "Small",
"weight": "Bolder",
"isSubtle": false,
"spacing": "Small"
},
{
"type": "TextBlock",
"text": "DIGEST: ${RepoDigests[0]}",
"wrap": true,
"size": "Small",
"weight": "Lighter",
"isSubtle": true,
"spacing": "Small"
}
],
"width": "stretch"
}
],
"style": "default"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Lighter",
"text": "TAGS",
"wrap": true,
"size": "Small",
"isSubtle": true,
"spacing": "Medium"
},
{
"type": "FactSet",
"facts": [
{
"title": "${Tag}",
"value": ""
}
],
"spacing": "Small",
"$data": "${ParsedRepoTags}",
"wrap": true,
"size": "Small",
"weight": "Bolder"
}
],
"separator": true,
"width": "auto"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Lighter",
"text": "SIZE",
"wrap": true,
"size": "Small",
"isSubtle": true
},
{
"type": "TextBlock",
"spacing": "Small",
"text": "${SizeString}",
"wrap": true,
"weight": "Bolder"
}
],
"width": "auto",
"separator": true,
"spacing": "Medium"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Lighter",
"text": "LAST PUSHED",
"wrap": true,
"size": "Small",
"isSubtle": true
},
{
"type": "TextBlock",
"spacing": "Small",
"text": "{{DATE(${Time})}} - {{TIME(${Time})}}",
"wrap": true,
"weight": "Bolder"
}
],
"width": "auto",
"separator": true,
"spacing": "Medium"
}
],
"style": "default",
"separator": true
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "Go to image",
"url": "${url}"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5"
}

0
docs/index.json Normal file

19
go.mod

@ -2,12 +2,23 @@ module github.com/drone-plugins/drone-docker
require (
github.com/aws/aws-sdk-go v1.26.7
github.com/coreos/go-semver v0.2.0
github.com/coreos/go-semver v0.3.0
github.com/drone/drone-go v1.7.1
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743
github.com/joho/godotenv v1.3.0
github.com/sirupsen/logrus v1.3.0
github.com/urfave/cli v1.22.2
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e // indirect
golang.org/x/text v0.3.0 // indirect
)
go 1.13
require (
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 // indirect
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
go 1.17

21
go.sum

@ -1,12 +1,19 @@
github.com/99designs/httpsignatures-go v0.0.0-20170731043157-88528bf4ca7e/go.mod h1:Xa6lInWHNQnuWoF0YPSsx+INFA9qk7/7pTjwb3PInkY=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/aws/aws-sdk-go v1.26.7 h1:ObjEnmzvSdYy8KVd3me7v/UMyCn81inLy2SyoIPoBkg=
github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
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/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
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/drone/drone-go v1.7.1 h1:ZX+3Rs8YHUSUQ5mkuMLmm1zr1ttiiE2YGNxF3AnyDKw=
github.com/drone/drone-go v1.7.1/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743 h1:X3Xxno5Ji8idrNiUoFc7QyXpqhSYlDRYQmc7mlpMBzU=
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743/go.mod h1:KrtyD5PFj++GKkFS/7/RRrfnRhAMGQwy75GLCHWrCNs=
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=
@ -24,19 +31,13 @@ github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
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=
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
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=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

@ -0,0 +1,35 @@
# this script is used by the continuous integration server to
# build and publish the docker image for a commit to master.
$ErrorActionPreference = "Stop"
$env:GOOS="windows"
$env:GOARCH="amd64"
$env:CGO_ENABLED="0"
if (-not (Test-Path env:VERSION)) {
$env:VERSION="1809"
}
if (-not (Test-Path env:REGISTRY)) {
$env:REGISTRY="docker"
}
echo $env:GOOS
echo $env:GOARCH
echo $env:VERSION
echo $env:REGISTRY
# build the binary
Write-Host "+ go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}";
go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}
# build and publish the docker image
docker login -u ${env:USERNAME} -p ${env:PASSWORD}
Write-Host "+ docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64 .";
docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64 .
Write-Host "+ docker push plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64"
docker push plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64
# remove images from local cache
Write-Host "+ docker rmi plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64"
docker rmi plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64

66
scripts/windows/tag.ps1 Normal file

@ -0,0 +1,66 @@
# this script is used by the continuous integration server to
# build and publish the docker image for a tagged revsision.
$ErrorActionPreference = "Stop"
$env:GOOS="windows"
$env:GOARCH="amd64"
$env:CGO_ENABLED="0"
if (-not (Test-Path env:VERSION)) {
$env:VERSION="1809"
}
if (-not (Test-Path env:DRONE_SEMVER_SHORT)) {
echo "missing semver"
exit 1
}
if (-not (Test-Path env:REGISTRY)) {
$env:REGISTRY="docker"
}
# define the image tags
$env:IMAGE_PATCH="plugins/${env:REGISTRY}:${env:DRONE_SEMVER_SHORT}-windows-${env:VERSION}-amd64"
$env:IMAGE_MAJOR="plugins/${env:REGISTRY}:${env:DRONE_SEMVER_MAJOR}-windows-${env:VERSION}-amd64"
$env:IMAGE_MINOR="plugins/${env:REGISTRY}:${env:DRONE_SEMVER_MAJOR}.${env:DRONE_SEMVER_MINOR}-windows-${env:VERSION}-amd64"
echo "build environment:"
echo $env:GOOS
echo $env:GOARCH
echo $env:VERSION
# build the binary
Write-Host "+ go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}"
go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}
# authenticate with the docker registry
docker login -u ${env:USERNAME} -p ${env:PASSWORD}
echo "building images:"
echo ${env:IMAGE_PATCH}
echo ${env:IMAGE_MINOR}
echo ${env:IMAGE_MAJOR}
# build and tag the docker images
Write-Host "+ docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t ${env:IMAGE_PATCH} ."
docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t ${env:IMAGE_PATCH} .
Write-Host "+ docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MAJOR}"
docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MAJOR}
Write-Host "+ docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MINOR}"
docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MINOR}
# publish the docker images
Write-Host "+ docker push ${env:IMAGE_MAJOR}"
docker push ${env:IMAGE_MAJOR}
Write-Host "+ docker push ${env:IMAGE_MINOR}"
docker push ${env:IMAGE_MINOR}
Write-Host "+ docker push ${env:IMAGE_PATCH}"
docker push ${env:IMAGE_PATCH}
# remove images after from local cache
Write-Host "+ docker rmi ${env:IMAGE_MAJOR}"
docker rmi ${env:IMAGE_MAJOR}
Write-Host "+ docker rmi ${env:IMAGE_MINOR}"
docker rmi ${env:IMAGE_MINOR}
Write-Host "+ docker rmi ${env:IMAGE_PATCH}"
docker rmi ${env:IMAGE_PATCH}