From 90fab79dc3180f2a475360dd7f95eabad14bf111 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 9 Aug 2019 10:44:41 -0700 Subject: [PATCH 01/10] enable windows 1809 builds --- .drone.yml | 39 +++++++++++++++++++++++++++++++++++++ docker/docker/manifest.tmpl | 8 +++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index a362ed9..30113ee 100644 --- a/.drone.yml +++ b/.drone.yml @@ -39,6 +39,44 @@ trigger: - "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 + - docker login -u $env:USERNAME -p $env:PASSWORD + - docker build -f 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 name: linux-amd64-docker @@ -326,6 +364,7 @@ trigger: - "refs/tags/**" depends_on: +- windows-amd64-docker - linux-amd64-docker - linux-arm64-docker - linux-arm-docker diff --git a/docker/docker/manifest.tmpl b/docker/docker/manifest.tmpl index 8a823f9..fa9d454 100644 --- a/docker/docker/manifest.tmpl +++ b/docker/docker/manifest.tmpl @@ -30,8 +30,14 @@ manifests: os: windows version: 1803 - - image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809 + image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64 platform: architecture: amd64 os: windows version: 1809 + - + image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64 + platform: + architecture: amd64 + os: windows + version: 1903 From ac4f39236eaef58dbc3b005c43d52ed2282c58a4 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 9 Aug 2019 10:45:16 -0700 Subject: [PATCH 02/10] remove windows specific yaml --- .drone.windows.yml | 926 --------------------------------------------- 1 file changed, 926 deletions(-) delete mode 100644 .drone.windows.yml diff --git a/.drone.windows.yml b/.drone.windows.yml deleted file mode 100644 index ab11bfe..0000000 --- a/.drone.windows.yml +++ /dev/null @@ -1,926 +0,0 @@ ---- -kind: pipeline -name: testing - -platform: - os: windows - 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: -- name: build-push - pull: always - image: golang:1.11-windowsservercore-1803 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker" - 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}\" -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-1803 - commands: - - ./release/windows/amd64/drone-docker.exe --help - -- name: dryrun - pull: always - image: plugins/docker:windows-1803 - settings: - daemon_off: true - dockerfile: docker/docker/Dockerfile.windows.1803 - dry_run: true - password: - from_secret: docker_password - repo: plugins/docker - tags: windows-1803 - 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-1803 - settings: - auto_tag: true - auto_tag_suffix: windows-1803 - daemon_off: true - dockerfile: docker/docker/Dockerfile.windows.1803 - 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: windows-1809-docker - -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.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker" - 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}\" -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: - auto_tag: true - 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: - urls: - 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.version=${DRONE_COMMIT_SHA:0:8}\" -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}\" -a -tags netgo -o release/windows/amd64/drone-gcr.exe ./cmd/drone-gcr" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: dryrun - pull: always - image: plugins/docker:windows-1803 - settings: - daemon_off: true - dockerfile: docker/gcr/Dockerfile.windows.1803 - dry_run: true - password: - from_secret: docker_password - repo: plugins/gcr - tags: windows-1803 - 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-1803 - settings: - auto_tag: true - auto_tag_suffix: windows-1803 - daemon_off: true - dockerfile: docker/gcr/Dockerfile.windows.1803 - password: - from_secret: docker_password - repo: plugins/gcr - 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-1803-docker - ---- -kind: pipeline -name: windows-1809-gcr - -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.version=${DRONE_COMMIT_SHA:0:8}\" -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-1809 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-gcr.exe ./cmd/drone-gcr" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: dryrun - pull: always - image: plugins/docker:windows-1809 - settings: - daemon_off: true - dockerfile: docker/gcr/Dockerfile.windows.1809 - dry_run: true - password: - from_secret: docker_password - repo: plugins/gcr - 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/gcr/Dockerfile.windows.1809 - password: - from_secret: docker_password - repo: plugins/gcr - 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-gcr - -platform: - os: windows - arch: amd64 - version: 1809 - -steps: -- name: manifest - pull: always - 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 - -- name: microbadger - pull: always - image: plugins/webhook - settings: - urls: - 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: -- name: build-push - pull: always - image: golang:1.11-windowsservercore-1803 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -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-1803 - commands: - - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -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-1803 - settings: - daemon_off: true - dockerfile: docker/ecr/Dockerfile.windows.1803 - dry_run: true - password: - from_secret: docker_password - repo: plugins/ecr - tags: windows-1803 - 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-1803 - settings: - auto_tag: true - auto_tag_suffix: windows-1803 - daemon_off: true - dockerfile: docker/ecr/Dockerfile.windows.1803 - 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-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.version=${DRONE_COMMIT_SHA:0:8}\" -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}\" -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: - auto_tag: true - 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: - urls: - from_secret: microbadger_ecr - -trigger: - ref: - - refs/heads/master - - "refs/tags/**" - -depends_on: -- windows-1803-ecr -- windows-1809-ecr - ---- -kind: pipeline -name: windows-1803-acr - -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-acr.exe ./cmd/drone-acr" - 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-acr.exe ./cmd/drone-acr" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: dryrun - pull: always - image: plugins/docker:windows-1803 - settings: - daemon_off: true - dockerfile: docker/acr/Dockerfile.windows.1803 - dry_run: true - password: - from_secret: docker_password - repo: plugins/acr - tags: windows-1803 - 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-1803 - settings: - auto_tag: true - auto_tag_suffix: windows-1803 - daemon_off: true - dockerfile: docker/acr/Dockerfile.windows.1803 - password: - from_secret: docker_password - repo: plugins/acr - 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-1803-docker - ---- -kind: pipeline -name: windows-1809-acr - -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-acr.exe ./cmd/drone-acr" - 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-acr.exe ./cmd/drone-acr" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: dryrun - pull: always - image: plugins/docker:windows-1809 - settings: - daemon_off: true - dockerfile: docker/acr/Dockerfile.windows.1809 - dry_run: true - password: - from_secret: docker_password - repo: plugins/acr - 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/acr/Dockerfile.windows.1809 - password: - from_secret: docker_password - repo: plugins/acr - 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-acr - -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/acr/manifest.tmpl - username: - from_secret: docker_username - -- name: microbadger - pull: always - image: plugins/webhook - settings: - url: - from_secret: microbadger_acr - -trigger: - ref: - - refs/heads/master - - "refs/tags/**" - -depends_on: -- windows-1803-acr -- windows-1809-acr - -... From acd38d572cfc58fb955bdf944b60039fedcb725e Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 9 Aug 2019 10:45:29 -0700 Subject: [PATCH 03/10] remove windows jsonnet --- .drone.windows.jsonnet | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .drone.windows.jsonnet diff --git a/.drone.windows.jsonnet b/.drone.windows.jsonnet deleted file mode 100644 index 23475af..0000000 --- a/.drone.windows.jsonnet +++ /dev/null @@ -1,33 +0,0 @@ -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('acr', 'windows', 'amd64', '1803'), - pipeline.build('acr', 'windows', 'amd64', '1809'), - pipeline.notifications('acr', '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' - ]), -] From 43c45fed4de7a0e19d1beea440655b697b9b71fc Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 9 Aug 2019 10:46:20 -0700 Subject: [PATCH 04/10] fix dependency graph --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 30113ee..71a0600 100644 --- a/.drone.yml +++ b/.drone.yml @@ -364,7 +364,7 @@ trigger: - "refs/tags/**" depends_on: -- windows-amd64-docker +- windows-1809-amd64-docker - linux-amd64-docker - linux-arm64-docker - linux-arm-docker From d880d528ecd1d6f77687555919e646eba21c8eaa Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 13 Aug 2019 13:35:12 -0700 Subject: [PATCH 05/10] enable 1903 build --- .drone.yml | 39 +++++++++++++++++++++++++++ docker/docker/Dockerfile.windows.1903 | 27 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 docker/docker/Dockerfile.windows.1903 diff --git a/.drone.yml b/.drone.yml index 71a0600..789eadf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -77,6 +77,44 @@ trigger: 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 + - docker login -u $env:USERNAME -p $env:PASSWORD + - docker build -f 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 name: linux-amd64-docker @@ -365,6 +403,7 @@ trigger: depends_on: - windows-1809-amd64-docker +- windows-1903-amd64-docker - linux-amd64-docker - linux-arm64-docker - linux-arm-docker diff --git a/docker/docker/Dockerfile.windows.1903 b/docker/docker/Dockerfile.windows.1903 new file mode 100644 index 0000000..4d50542 --- /dev/null +++ b/docker/docker/Dockerfile.windows.1903 @@ -0,0 +1,27 @@ +# escape=` +FROM mcr.microsoft.com/windows/servercore:1903 as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV DOCKER_VERSION 18.09.1 + +RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; ` + Expand-Archive innoextract.zip -DestinationPath C:\ ; ` + Remove-Item -Path innoextract.zip + +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; ` + Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing +RUN /innoextract.exe dockertoolbox.exe + +FROM mcr.microsoft.com/windows/nanoserver:1903 +USER ContainerAdministrator + +LABEL maintainer="Drone.IO Community " ` + 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 /app/docker.exe C:/bin/docker.exe +ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe +ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ] From 65e411842ecee45f0defec324c6df0484f47c42e Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 13 Aug 2019 15:52:36 -0700 Subject: [PATCH 06/10] fix Dockerfile path --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 789eadf..b33a826 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,7 +61,7 @@ steps: # publish docker images for tag events. - go build -o release/windows/amd64/drone-docker.exe - docker login -u $env:USERNAME -p $env:PASSWORD - - docker build -f docker/Dockerfile.windows.1809 -t plugins/docker:windows-1809-amd64 . + - 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" @@ -99,7 +99,7 @@ steps: # publish docker images for tag events. - go build -o release/windows/amd64/drone-docker.exe - docker login -u $env:USERNAME -p $env:PASSWORD - - docker build -f docker/Dockerfile.windows.1903 -t plugins/docker:windows-1903-amd64 . + - 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" From 8d8851bf9890147600613bff31f66b4759964524 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 14 Aug 2019 10:34:18 -0700 Subject: [PATCH 07/10] use windowsservercore for 1903 --- docker/docker/Dockerfile.windows.1903 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/docker/Dockerfile.windows.1903 b/docker/docker/Dockerfile.windows.1903 index 4d50542..8ee4c9e 100644 --- a/docker/docker/Dockerfile.windows.1903 +++ b/docker/docker/Dockerfile.windows.1903 @@ -13,8 +13,7 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing RUN /innoextract.exe dockertoolbox.exe -FROM mcr.microsoft.com/windows/nanoserver:1903 -USER ContainerAdministrator +FROM mcr.microsoft.com/windows/servercore:1903 LABEL maintainer="Drone.IO Community " ` org.label-schema.name="Drone Docker" ` From 98722a6680353a8224ddb665862edcc992de5c4f Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 14 Aug 2019 11:29:53 -0700 Subject: [PATCH 08/10] remove 1903 netapi32 --- docker/docker/Dockerfile.windows.1903 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/docker/Dockerfile.windows.1903 b/docker/docker/Dockerfile.windows.1903 index 8ee4c9e..b0d03ad 100644 --- a/docker/docker/Dockerfile.windows.1903 +++ b/docker/docker/Dockerfile.windows.1903 @@ -3,9 +3,9 @@ FROM mcr.microsoft.com/windows/servercore:1903 as download SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -ENV DOCKER_VERSION 18.09.1 +ENV DOCKER_VERSION 19.03.1 -RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; ` +RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; ` Expand-Archive innoextract.zip -DestinationPath C:\ ; ` Remove-Item -Path innoextract.zip @@ -20,7 +20,7 @@ LABEL maintainer="Drone.IO Community " ` 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 +RUN mkdir C:\bin COPY --from=download /app/docker.exe C:/bin/docker.exe ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ] From 33367587085258e4243fa039d7fbcca720e946c2 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 14 Aug 2019 12:51:43 -0700 Subject: [PATCH 09/10] disable starting the daemon on windows --- .drone.yml | 4 ++-- daemon.go | 26 ++++++++++++++++++++++++++ daemon_win.go | 10 ++++++++++ docker.go | 17 +---------------- docker/docker/Dockerfile.windows.1903 | 4 +++- 5 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 daemon.go create mode 100644 daemon_win.go diff --git a/.drone.yml b/.drone.yml index b33a826..0d3b2fe 100644 --- a/.drone.yml +++ b/.drone.yml @@ -59,7 +59,7 @@ steps: 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 + - 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 @@ -97,7 +97,7 @@ steps: 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 + - 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 diff --git a/daemon.go b/daemon.go new file mode 100644 index 0000000..5bf1119 --- /dev/null +++ b/daemon.go @@ -0,0 +1,26 @@ +// +build !windows + +package docker + +import ( + "io/ioutil" + "os" +) + +const dockerExe = "/usr/local/bin/docker" +const dockerdExe = "/usr/local/bin/dockerd" + +func (p Plugin) startDaemon() { + cmd := commandDaemon(p.Daemon) + if p.Daemon.Debug { + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + } else { + cmd.Stdout = ioutil.Discard + cmd.Stderr = ioutil.Discard + } + go func() { + trace(cmd) + cmd.Run() + }() +} \ No newline at end of file diff --git a/daemon_win.go b/daemon_win.go new file mode 100644 index 0000000..062cf5e --- /dev/null +++ b/daemon_win.go @@ -0,0 +1,10 @@ +// +build windows + +package docker + +const dockerExe = "C:\\bin\\docker.exe" +const dockerdExe = "" + +func (p Plugin) startDaemon() { + // this is a no-op on windows +} diff --git a/docker.go b/docker.go index e6e5386..9c2a136 100644 --- a/docker.go +++ b/docker.go @@ -2,7 +2,6 @@ package docker import ( "fmt" - "io/ioutil" "os" "os/exec" "strings" @@ -69,18 +68,7 @@ type ( func (p Plugin) Exec() error { // start the Docker daemon server if !p.Daemon.Disabled { - cmd := commandDaemon(p.Daemon) - if p.Daemon.Debug { - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - } else { - cmd.Stdout = ioutil.Discard - cmd.Stderr = ioutil.Discard - } - go func() { - trace(cmd) - cmd.Run() - }() + p.startDaemon() } // poll the docker daemon until it is started. This ensures the daemon is @@ -154,9 +142,6 @@ func (p Plugin) Exec() error { return nil } -const dockerExe = "/usr/local/bin/docker" -const dockerdExe = "/usr/local/bin/dockerd" - // helper function to create the docker login command. func commandLogin(login Login) *exec.Cmd { if login.Email != "" { diff --git a/docker/docker/Dockerfile.windows.1903 b/docker/docker/Dockerfile.windows.1903 index b0d03ad..a6eadef 100644 --- a/docker/docker/Dockerfile.windows.1903 +++ b/docker/docker/Dockerfile.windows.1903 @@ -13,7 +13,8 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing RUN /innoextract.exe dockertoolbox.exe -FROM mcr.microsoft.com/windows/servercore:1903 +FROM mcr.microsoft.com/windows/nanoserver:1903 +USER ContainerAdministrator LABEL maintainer="Drone.IO Community " ` org.label-schema.name="Drone Docker" ` @@ -21,6 +22,7 @@ LABEL maintainer="Drone.IO Community " ` org.label-schema.schema-version="1.0" RUN mkdir C:\bin +COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll COPY --from=download /app/docker.exe C:/bin/docker.exe ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ] From 261afaa9ed23adac449936368ec92f32b67ddefc Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 15 Aug 2019 10:54:51 -0700 Subject: [PATCH 10/10] use nanoserver for 1809 --- docker/docker/Dockerfile.windows.1809 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/docker/Dockerfile.windows.1809 b/docker/docker/Dockerfile.windows.1809 index 647ec42..bffc4b4 100644 --- a/docker/docker/Dockerfile.windows.1809 +++ b/docker/docker/Dockerfile.windows.1809 @@ -13,7 +13,8 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing RUN /innoextract.exe dockertoolbox.exe -FROM plugins/base:windows-1809 +FROM mcr.microsoft.com/windows/nanoserver:1809 +USER ContainerAdministrator LABEL maintainer="Drone.IO Community " ` org.label-schema.name="Drone Docker" `