0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-22 20:20:39 +00:00

Apply a proper libsonnet library

This commit is contained in:
Thomas Boerger 2019-02-10 13:26:22 +01:00
parent 095ca8100b
commit da1afc3a38
No known key found for this signature in database
GPG Key ID: 09745AFF9D63C79B
7 changed files with 1028 additions and 475 deletions

View File

@ -1,181 +1,41 @@
local PipelineTesting = { local pipeline = import 'pipeline.libsonnet';
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" ],
},
},
if binary == "docker" then {
name: "executable",
image: "golang:1.11",
pull: "always",
commands: [
"./release/" + os + "/" + arch + "/drone-" + binary + " --help",
],
},
{
name: "dryrun",
image: "plugins/docker:" + os + "-" + arch,
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, pipeline.test('linux', 'amd64'),
PipelineBuild("docker", "linux", "amd64"),
PipelineBuild("docker", "linux", "arm64"), pipeline.build('docker', 'linux', 'amd64'),
PipelineBuild("docker", "linux", "arm"), pipeline.build('docker', 'linux', 'arm64'),
PipelineBuild("gcr", "linux", "amd64"), pipeline.build('docker', 'linux', 'arm'),
PipelineBuild("gcr", "linux", "arm64"), pipeline.notifications('docker', depends_on=[
PipelineBuild("gcr", "linux", "arm"), 'linux-amd64',
PipelineBuild("ecr", "linux", "amd64"), 'linux-arm64',
PipelineBuild("ecr", "linux", "arm64"), 'linux-arm',
PipelineBuild("ecr", "linux", "arm"), ]),
PipelineBuild("heroku", "linux", "amd64"),
PipelineBuild("heroku", "linux", "arm64"), pipeline.build('gcr', 'linux', 'amd64'),
PipelineBuild("heroku", "linux", "arm"), pipeline.build('gcr', 'linux', 'arm64'),
PipelineNotifications("docker"), pipeline.build('gcr', 'linux', 'arm'),
PipelineNotifications("gcr"), pipeline.notifications('gcr', depends_on=[
PipelineNotifications("ecr"), 'linux-amd64',
PipelineNotifications("heroku"), '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',
]),
] ]

26
.drone.windows.jsonnet Normal file
View File

@ -0,0 +1,26 @@
local pipeline = import 'pipeline.libsonnet';
[
pipeline.test('windows', 'amd64', '1803'),
pipeline.build('docker', 'windows', 'amd64', '1803'),
pipeline.build('docker', 'windows', 'amd64', '1809'),
pipeline.notifications('docker', 'windows', 'amd64', '1809', [
'windows-1803',
'windows-1809'
]),
pipeline.build('gcr', 'windows', 'amd64', '1803'),
pipeline.build('gcr', 'windows', 'amd64', '1809'),
pipeline.notifications('gcr', 'windows', 'amd64', '1809', [
'windows-1803',
'windows-1809'
]),
pipeline.build('ecr', 'windows', 'amd64', '1803'),
pipeline.build('ecr', 'windows', 'amd64', '1809'),
pipeline.notifications('ecr', 'windows', 'amd64', '1809', [
'windows-1803',
'windows-1809'
]),
]

View File

@ -1,30 +1,73 @@
--- ---
kind: pipeline kind: pipeline
name: windows-amd64-docker name: testing
platform: platform:
os: windows os: windows
arch: amd64 arch: amd64
version: 1803
steps:
- name: vet
pull: always
image: golang:1.11-windowsservercore-1803
commands:
- go vet ./...
environment:
GO111MODULE: on
volumes:
- name: gopath
path: C:\\gopath
- name: test
pull: always
image: golang:1.11-windowsservercore-1803
commands:
- go test -cover ./...
environment:
GO111MODULE: on
volumes:
- name: gopath
path: C:\\gopath
volumes:
- name: gopath
temp: {}
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
---
kind: pipeline
name: windows-1803-docker
platform:
os: windows
arch: amd64
version: 1803
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1803
commands: commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-docker ./cmd/drone-docker" - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1803
commands: 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" - "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.exe ./cmd/drone-docker"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
@ -34,74 +77,226 @@ steps:
- name: executable - name: executable
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1803
commands: commands:
- ./release/windows/amd64/drone-docker --help - ./release/windows/amd64/drone-docker.exe --help
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1803
settings: settings:
dockerfile: docker/docker/Dockerfile.windows.amd64 daemon_off: true
dockerfile: docker/docker/Dockerfile.windows.1803
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/docker repo: plugins/docker
tags: windows-amd64 tags: windows-1803
username: username:
from_secret: docker_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- pull_request - pull_request
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1803
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: windows-amd64 auto_tag_suffix: windows-1803
dockerfile: docker/docker/Dockerfile.windows.amd64 daemon_off: true
dockerfile: docker/docker/Dockerfile.windows.1803
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/docker repo: plugins/docker
username: username:
from_secret: docker_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- push exclude:
- tag - pull_request
volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
--- ---
kind: pipeline kind: pipeline
name: windows-amd64-gcr name: windows-1809-docker
platform: platform:
os: windows os: windows
arch: amd64 arch: amd64
version: 1809
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1809
commands: commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-gcr ./cmd/drone-gcr" - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1809
commands: 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" - "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.exe ./cmd/drone-docker"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11-windowsservercore-1809
commands:
- ./release/windows/amd64/drone-docker.exe --help
- name: dryrun
pull: always
image: plugins/docker:windows-1809
settings:
daemon_off: true
dockerfile: docker/docker/Dockerfile.windows.1809
dry_run: true
password:
from_secret: docker_password
repo: plugins/docker
tags: windows-1809
username:
from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:windows-1809
settings:
auto_tag: true
auto_tag_suffix: windows-1809
daemon_off: true
dockerfile: docker/docker/Dockerfile.windows.1809
password:
from_secret: docker_password
repo: plugins/docker
username:
from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
event:
exclude:
- pull_request
volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- testing
---
kind: pipeline
name: notifications-docker
platform:
os: windows
arch: amd64
version: 1809
steps:
- name: manifest
pull: always
image: plugins/manifest
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
settings:
url:
from_secret: microbadger_docker
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- windows-1803-docker
- windows-1809-docker
---
kind: pipeline
name: windows-1803-gcr
platform:
os: windows
arch: amd64
version: 1803
steps:
- name: build-push
pull: always
image: golang:1.11-windowsservercore-1803
commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-gcr.exe ./cmd/drone-gcr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.11-windowsservercore-1803
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.exe ./cmd/drone-gcr"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
@ -111,71 +306,87 @@ steps:
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1803
settings: settings:
daemon_off: true
dockerfile: docker/gcr/Dockerfile.windows.1803
dry_run: true dry_run: true
gcrfile: docker/gcr/Dockerfile.windows.amd64
password: password:
from_secret: gcr_password from_secret: docker_password
repo: plugins/gcr repo: plugins/gcr
tags: windows-amd64 tags: windows-1803
username: username:
from_secret: gcr_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- pull_request - pull_request
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1803
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: windows-amd64 auto_tag_suffix: windows-1803
gcrfile: docker/gcr/Dockerfile.windows.amd64 daemon_off: true
dockerfile: docker/gcr/Dockerfile.windows.1803
password: password:
from_secret: gcr_password from_secret: docker_password
repo: plugins/gcr repo: plugins/gcr
username: username:
from_secret: gcr_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- push exclude:
- tag - pull_request
volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- windows-amd64-docker - windows-1803-docker
--- ---
kind: pipeline kind: pipeline
name: windows-amd64-ecr name: windows-1809-gcr
platform: platform:
os: windows os: windows
arch: amd64 arch: amd64
version: 1809
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1809
commands: commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-ecr ./cmd/drone-ecr" - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-gcr.exe ./cmd/drone-gcr"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1809
commands: 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" - "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.exe ./cmd/drone-gcr"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
@ -185,71 +396,124 @@ steps:
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1809
settings: settings:
dockerfile: docker/ecr/Dockerfile.windows.amd64 daemon_off: true
dockerfile: docker/gcr/Dockerfile.windows.1809
dry_run: true dry_run: true
password: password:
from_secret: ecr_password from_secret: docker_password
repo: plugins/ecr repo: plugins/gcr
tags: windows-amd64 tags: windows-1809
username: username:
from_secret: ecr_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- pull_request - pull_request
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1809
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: windows-amd64 auto_tag_suffix: windows-1809
dockerfile: docker/ecr/Dockerfile.windows.amd64 daemon_off: true
dockerfile: docker/gcr/Dockerfile.windows.1809
password: password:
from_secret: ecr_password from_secret: docker_password
repo: plugins/ecr repo: plugins/gcr
username: username:
from_secret: ecr_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- push exclude:
- tag - pull_request
volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- windows-amd64-docker - windows-1809-docker
--- ---
kind: pipeline kind: pipeline
name: windows-amd64-heroku name: notifications-gcr
platform: platform:
os: windows os: windows
arch: amd64 arch: amd64
version: 1809
steps:
- name: manifest
pull: always
image: plugins/manifest
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
settings:
url:
from_secret: microbadger_gcr
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- windows-1803-gcr
- windows-1809-gcr
---
kind: pipeline
name: windows-1803-ecr
platform:
os: windows
arch: amd64
version: 1803
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1803
commands: commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-heroku ./cmd/drone-heroku" - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-ecr.exe ./cmd/drone-ecr"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11 image: golang:1.11-windowsservercore-1803
commands: 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" - "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.exe ./cmd/drone-ecr"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: on GO111MODULE: on
@ -259,40 +523,184 @@ steps:
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1803
settings: settings:
daemon_off: true
dockerfile: docker/ecr/Dockerfile.windows.1803
dry_run: true dry_run: true
herokufile: docker/heroku/Dockerfile.windows.amd64
password: password:
from_secret: heroku_password from_secret: docker_password
repo: plugins/heroku repo: plugins/ecr
tags: windows-amd64 tags: windows-1803
username: username:
from_secret: heroku_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- pull_request - pull_request
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:windows-amd64 image: plugins/docker:windows-1803
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: windows-amd64 auto_tag_suffix: windows-1803
herokufile: docker/heroku/Dockerfile.windows.amd64 daemon_off: true
dockerfile: docker/ecr/Dockerfile.windows.1803
password: password:
from_secret: heroku_password from_secret: docker_password
repo: plugins/heroku repo: plugins/ecr
username: username:
from_secret: heroku_username from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when: when:
event: event:
- push exclude:
- tag - pull_request
volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- windows-amd64-docker - windows-1803-docker
---
kind: pipeline
name: windows-1809-ecr
platform:
os: windows
arch: amd64
version: 1809
steps:
- name: build-push
pull: always
image: golang:1.11-windowsservercore-1809
commands:
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/windows/amd64/drone-ecr.exe ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.11-windowsservercore-1809
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.exe ./cmd/drone-ecr"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: dryrun
pull: always
image: plugins/docker:windows-1809
settings:
daemon_off: true
dockerfile: docker/ecr/Dockerfile.windows.1809
dry_run: true
password:
from_secret: docker_password
repo: plugins/ecr
tags: windows-1809
username:
from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
event:
- pull_request
- name: publish
pull: always
image: plugins/docker:windows-1809
settings:
auto_tag: true
auto_tag_suffix: windows-1809
daemon_off: true
dockerfile: docker/ecr/Dockerfile.windows.1809
password:
from_secret: docker_password
repo: plugins/ecr
username:
from_secret: docker_username
volumes:
- name: docker_pipe
path: \\\\.\\pipe\\docker_engine
when:
event:
exclude:
- pull_request
volumes:
- name: docker_pipe
host:
path: \\\\.\\pipe\\docker_engine
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on:
- windows-1809-docker
---
kind: pipeline
name: notifications-ecr
platform:
os: windows
arch: amd64
version: 1809
steps:
- name: manifest
pull: always
image: plugins/manifest
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
settings:
url:
from_secret: microbadger_ecr
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- windows-1803-ecr
- windows-1809-ecr
...

View File

@ -14,6 +14,9 @@ steps:
- go vet ./... - go vet ./...
environment: environment:
GO111MODULE: on GO111MODULE: on
volumes:
- name: gopath
path: /go
- name: test - name: test
pull: always pull: always
@ -22,10 +25,19 @@ steps:
- go test -cover ./... - go test -cover ./...
environment: environment:
GO111MODULE: on GO111MODULE: on
volumes:
- name: gopath
path: /go
volumes:
- name: gopath
temp: {}
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
--- ---
kind: pipeline kind: pipeline
@ -46,8 +58,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -71,6 +83,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
settings: settings:
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.amd64 dockerfile: docker/docker/Dockerfile.linux.amd64
dry_run: true dry_run: true
password: password:
@ -89,6 +102,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.amd64 dockerfile: docker/docker/Dockerfile.linux.amd64
password: password:
from_secret: docker_password from_secret: docker_password
@ -97,12 +111,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- testing - testing
@ -126,8 +142,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -151,6 +167,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm64 image: plugins/docker:linux-arm64
settings: settings:
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.arm64 dockerfile: docker/docker/Dockerfile.linux.arm64
dry_run: true dry_run: true
password: password:
@ -169,6 +186,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.arm64 dockerfile: docker/docker/Dockerfile.linux.arm64
password: password:
from_secret: docker_password from_secret: docker_password
@ -177,12 +195,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- testing - testing
@ -206,8 +226,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -231,6 +251,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm image: plugins/docker:linux-arm
settings: settings:
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.arm dockerfile: docker/docker/Dockerfile.linux.arm
dry_run: true dry_run: true
password: password:
@ -249,6 +270,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.arm dockerfile: docker/docker/Dockerfile.linux.arm
password: password:
from_secret: docker_password from_secret: docker_password
@ -257,16 +279,55 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- testing - testing
---
kind: pipeline
name: notifications-docker
platform:
os: linux
arch: amd64
steps:
- name: manifest
pull: always
image: plugins/manifest
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
settings:
url:
from_secret: microbadger_docker
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64-docker
- linux-arm64-docker
- linux-arm-docker
--- ---
kind: pipeline kind: pipeline
name: linux-amd64-gcr name: linux-amd64-gcr
@ -286,8 +347,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -305,6 +366,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
settings: settings:
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.amd64 dockerfile: docker/gcr/Dockerfile.linux.amd64
dry_run: true dry_run: true
password: password:
@ -323,6 +385,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.amd64 dockerfile: docker/gcr/Dockerfile.linux.amd64
password: password:
from_secret: docker_password from_secret: docker_password
@ -331,12 +394,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-amd64-docker - linux-amd64-docker
@ -360,8 +425,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -379,6 +444,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm64 image: plugins/docker:linux-arm64
settings: settings:
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.arm64 dockerfile: docker/gcr/Dockerfile.linux.arm64
dry_run: true dry_run: true
password: password:
@ -397,6 +463,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.arm64 dockerfile: docker/gcr/Dockerfile.linux.arm64
password: password:
from_secret: docker_password from_secret: docker_password
@ -405,12 +472,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-arm64-docker - linux-arm64-docker
@ -434,8 +503,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -453,6 +522,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm image: plugins/docker:linux-arm
settings: settings:
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.arm dockerfile: docker/gcr/Dockerfile.linux.arm
dry_run: true dry_run: true
password: password:
@ -471,6 +541,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.arm dockerfile: docker/gcr/Dockerfile.linux.arm
password: password:
from_secret: docker_password from_secret: docker_password
@ -479,16 +550,55 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-arm-docker - linux-arm-docker
---
kind: pipeline
name: notifications-gcr
platform:
os: linux
arch: amd64
steps:
- name: manifest
pull: always
image: plugins/manifest
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
settings:
url:
from_secret: microbadger_gcr
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64-gcr
- linux-arm64-gcr
- linux-arm-gcr
--- ---
kind: pipeline kind: pipeline
name: linux-amd64-ecr name: linux-amd64-ecr
@ -508,8 +618,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -527,6 +637,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
settings: settings:
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.amd64 dockerfile: docker/ecr/Dockerfile.linux.amd64
dry_run: true dry_run: true
password: password:
@ -545,6 +656,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.amd64 dockerfile: docker/ecr/Dockerfile.linux.amd64
password: password:
from_secret: docker_password from_secret: docker_password
@ -553,12 +665,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-amd64-docker - linux-amd64-docker
@ -582,8 +696,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -601,6 +715,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm64 image: plugins/docker:linux-arm64
settings: settings:
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.arm64 dockerfile: docker/ecr/Dockerfile.linux.arm64
dry_run: true dry_run: true
password: password:
@ -619,6 +734,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.arm64 dockerfile: docker/ecr/Dockerfile.linux.arm64
password: password:
from_secret: docker_password from_secret: docker_password
@ -627,12 +743,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-arm64-docker - linux-arm64-docker
@ -656,8 +774,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -675,6 +793,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm image: plugins/docker:linux-arm
settings: settings:
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.arm dockerfile: docker/ecr/Dockerfile.linux.arm
dry_run: true dry_run: true
password: password:
@ -693,6 +812,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.arm dockerfile: docker/ecr/Dockerfile.linux.arm
password: password:
from_secret: docker_password from_secret: docker_password
@ -701,16 +821,55 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-arm-docker - linux-arm-docker
---
kind: pipeline
name: notifications-ecr
platform:
os: linux
arch: amd64
steps:
- name: manifest
pull: always
image: plugins/manifest
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
settings:
url:
from_secret: microbadger_ecr
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- linux-amd64-ecr
- linux-arm64-ecr
- linux-arm-ecr
--- ---
kind: pipeline kind: pipeline
name: linux-amd64-heroku name: linux-amd64-heroku
@ -730,8 +889,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -749,6 +908,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-amd64 image: plugins/docker:linux-amd64
settings: settings:
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.amd64 dockerfile: docker/heroku/Dockerfile.linux.amd64
dry_run: true dry_run: true
password: password:
@ -767,6 +927,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.amd64 dockerfile: docker/heroku/Dockerfile.linux.amd64
password: password:
from_secret: docker_password from_secret: docker_password
@ -775,12 +936,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-amd64-docker - linux-amd64-docker
@ -804,8 +967,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -823,6 +986,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm64 image: plugins/docker:linux-arm64
settings: settings:
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.arm64 dockerfile: docker/heroku/Dockerfile.linux.arm64
dry_run: true dry_run: true
password: password:
@ -841,6 +1005,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: linux-arm64
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.arm64 dockerfile: docker/heroku/Dockerfile.linux.arm64
password: password:
from_secret: docker_password from_secret: docker_password
@ -849,12 +1014,14 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-arm64-docker - linux-arm64-docker
@ -878,8 +1045,8 @@ steps:
GO111MODULE: on GO111MODULE: on
when: when:
event: event:
- push exclude:
- pull_request - tag
- name: build-tag - name: build-tag
pull: always pull: always
@ -897,6 +1064,7 @@ steps:
pull: always pull: always
image: plugins/docker:linux-arm image: plugins/docker:linux-arm
settings: settings:
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.arm dockerfile: docker/heroku/Dockerfile.linux.arm
dry_run: true dry_run: true
password: password:
@ -915,6 +1083,7 @@ steps:
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: linux-arm
daemon_off: false
dockerfile: docker/heroku/Dockerfile.linux.arm dockerfile: docker/heroku/Dockerfile.linux.arm
password: password:
from_secret: docker_password from_secret: docker_password
@ -923,133 +1092,18 @@ steps:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- push exclude:
- tag - pull_request
trigger: trigger:
branch: ref:
- master - refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
depends_on: depends_on:
- linux-arm-docker - 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 kind: pipeline
name: notifications-heroku name: notifications-heroku
@ -1061,7 +1115,7 @@ platform:
steps: steps:
- name: manifest - name: manifest
pull: always pull: always
image: plugins/manifest:1 image: plugins/manifest
settings: settings:
ignore_missing: true ignore_missing: true
password: password:
@ -1072,17 +1126,15 @@ steps:
- name: microbadger - name: microbadger
pull: always pull: always
image: plugins/webhook:1 image: plugins/webhook
settings: settings:
url: url:
from_secret: microbadger_heroku from_secret: microbadger_heroku
trigger: trigger:
branch: ref:
- master - refs/heads/master
event: - "refs/tags/**"
- push
- tag
depends_on: depends_on:
- linux-amd64-heroku - linux-amd64-heroku

View File

@ -1,11 +1,6 @@
# escape=` # escape=`
FROM mcr.microsoft.com/windows/servercore:1803 as download FROM mcr.microsoft.com/windows/servercore:1803 as download
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV DOCKER_VERSION 18.09.1 ENV DOCKER_VERSION 18.09.1
@ -19,6 +14,12 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
RUN /innoextract.exe dockertoolbox.exe RUN /innoextract.exe dockertoolbox.exe
FROM plugins/base:windows-1803 FROM plugins/base:windows-1803
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
COPY --from=download /app/docker.exe C:/bin/docker.exe COPY --from=download /app/docker.exe C:/bin/docker.exe
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe

View File

@ -1,11 +1,6 @@
# escape=` # escape=`
FROM mcr.microsoft.com/windows/servercore:1809 as download FROM mcr.microsoft.com/windows/servercore:1809 as download
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV DOCKER_VERSION 18.09.1 ENV DOCKER_VERSION 18.09.1
@ -19,6 +14,12 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
RUN /innoextract.exe dockertoolbox.exe RUN /innoextract.exe dockertoolbox.exe
FROM plugins/base:windows-1809 FROM plugins/base:windows-1809
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
org.label-schema.schema-version="1.0"
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
COPY --from=download /app/docker.exe C:/bin/docker.exe COPY --from=download /app/docker.exe C:/bin/docker.exe
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe

205
pipeline.libsonnet Normal file
View File

@ -0,0 +1,205 @@
local windows_pipe = '\\\\\\\\.\\\\pipe\\\\docker_engine';
local windows_pipe_volume = 'docker_pipe';
local test_pipeline_name = 'testing';
local windows(os) = os == 'windows';
local golang_image(os, version) =
'golang:' + '1.11' + if windows(os) then '-windowsservercore-' + version else '';
{
test(os='linux', arch='amd64', version='')::
local is_windows = windows(os);
local golang = golang_image(os, version);
local volumes = if is_windows then [{name: 'gopath', path: 'C:\\\\gopath'}] else [{name: 'gopath', path: '/go',}];
{
kind: 'pipeline',
name: test_pipeline_name,
platform: {
os: os,
arch: arch,
version: if std.length(version) > 0 then version,
},
steps: [
{
name: 'vet',
image: golang,
pull: 'always',
environment: {
GO111MODULE: 'on',
},
commands: [
'go vet ./...',
],
volumes: volumes,
},
{
name: 'test',
image: golang,
pull: 'always',
environment: {
GO111MODULE: 'on',
},
commands: [
'go test -cover ./...',
],
volumes: volumes,
},
],
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
'refs/pull/**',
],
},
volumes: [{name: 'gopath', temp: {}}]
},
build(name, os='linux', arch='amd64', version='')::
local is_windows = windows(os);
local tag = if is_windows then os + '-' + version else os + '-' + arch;
local file_suffix = std.strReplace(tag, '-', '.');
local volumes = if is_windows then [{ name: windows_pipe_volume, path: windows_pipe }] else [];
local golang = golang_image(os, version);
local plugin_repo = 'plugins/' + name;
local extension = if is_windows then '.exe' else '';
local depends_on = if name == 'docker' then [test_pipeline_name] else [tag + '-docker'];
{
kind: 'pipeline',
name: tag + '-' + name,
platform: {
os: os,
arch: arch,
version: if std.length(version) > 0 then version,
},
steps: [
{
name: 'build-push',
image: golang,
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-' + name + extension + ' ./cmd/drone-' + name,
],
when: {
event: {
exclude: ['tag'],
},
},
},
{
name: 'build-tag',
image: golang,
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-' + name + extension + ' ./cmd/drone-' + name,
],
when: {
event: ['tag'],
},
},
if name == "docker" then {
name: 'executable',
image: golang,
pull: 'always',
commands: [
'./release/' + os + '/' + arch + '/drone-' + name + extension + ' --help',
],
},
{
name: 'dryrun',
image: 'plugins/docker:' + tag,
pull: 'always',
settings: {
dry_run: true,
tags: tag,
dockerfile: 'docker/'+ name +'/Dockerfile.' + file_suffix,
daemon_off: if is_windows then 'true' else 'false',
repo: plugin_repo,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
volumes: if std.length(volumes) > 0 then volumes,
when: {
event: ['pull_request'],
},
},
{
name: 'publish',
image: 'plugins/docker:' + tag,
pull: 'always',
settings: {
auto_tag: true,
auto_tag_suffix: tag,
daemon_off: if is_windows then 'true' else 'false',
dockerfile: 'docker/' + name + '/Dockerfile.' + file_suffix,
repo: plugin_repo,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
volumes: if std.length(volumes) > 0 then volumes,
when: {
event: {
exclude: ['pull_request'],
},
},
},
],
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
'refs/pull/**',
],
},
depends_on: depends_on,
volumes: if is_windows then [{ name: windows_pipe_volume, host: { path: windows_pipe } }],
},
notifications(name, os='linux', arch='amd64', version='', depends_on=[])::
{
kind: 'pipeline',
name: 'notifications-' + name,
platform: {
os: os,
arch: arch,
version: if std.length(version) > 0 then version,
},
steps: [
{
name: 'manifest',
image: 'plugins/manifest',
pull: 'always',
settings: {
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'docker/' + name + '/manifest.tmpl',
ignore_missing: true,
},
},
{
name: 'microbadger',
image: 'plugins/webhook',
pull: 'always',
settings: {
url: { from_secret: 'microbadger_' + name },
},
},
],
depends_on: [x + '-' + name for x in depends_on],
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
},
},
}