From b548a9c07bda19364752b577bfeb45cbb0aa02df Mon Sep 17 00:00:00 2001 From: Don Date: Thu, 25 Apr 2019 16:45:09 -0700 Subject: [PATCH] Update windows build --- .drone.windows.yml | 32 ++++++++++++++++---------------- docker/Dockerfile.windows.1803 | 2 +- docker/Dockerfile.windows.1809 | 2 +- docker/manifest.tmpl | 4 ++-- plugin.go | 11 ++++++++++- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.drone.windows.yml b/.drone.windows.yml index e65f94f..cc5e350 100644 --- a/.drone.windows.yml +++ b/.drone.windows.yml @@ -10,7 +10,7 @@ platform: steps: - name: vet pull: always - image: golang:1.11-windowsservercore-1803 + image: golang:1.12-windowsservercore-1803 commands: - go vet ./... environment: @@ -21,7 +21,7 @@ steps: - name: test pull: always - image: golang:1.11-windowsservercore-1803 + image: golang:1.12-windowsservercore-1803 commands: - go test -cover ./... environment: @@ -52,7 +52,7 @@ platform: steps: - name: build-push pull: always - image: golang:1.11-windowsservercore-1803 + image: golang:1.12-windowsservercore-1803 commands: - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" environment: @@ -65,7 +65,7 @@ steps: - name: build-tag pull: always - image: golang:1.11-windowsservercore-1803 + image: golang:1.12-windowsservercore-1803 commands: - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" environment: @@ -77,13 +77,13 @@ steps: - name: executable pull: always - image: golang:1.11-windowsservercore-1803 + image: golang:1.12-windowsservercore-1803 commands: - ./release/windows/amd64/drone-manifest.exe --help - name: dryrun pull: always - image: plugins/docker:windows-1803 + image: plugins/docker settings: daemon_off: true dockerfile: docker/Dockerfile.windows.1803 @@ -91,7 +91,7 @@ steps: password: from_secret: docker_password repo: plugins/manifest - tags: windows-1803 + tags: windows-1803-amd64 username: from_secret: docker_username volumes: @@ -103,10 +103,10 @@ steps: - name: publish pull: always - image: plugins/docker:windows-1803 + image: plugins/docker settings: auto_tag: true - auto_tag_suffix: windows-1803 + auto_tag_suffix: windows-1803-amd64 daemon_off: true dockerfile: docker/Dockerfile.windows.1803 password: @@ -148,7 +148,7 @@ platform: steps: - name: build-push pull: always - image: golang:1.11-windowsservercore-1809 + image: golang:1.12-windowsservercore-1809 commands: - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" environment: @@ -161,7 +161,7 @@ steps: - name: build-tag pull: always - image: golang:1.11-windowsservercore-1809 + image: golang:1.12-windowsservercore-1809 commands: - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" environment: @@ -173,13 +173,13 @@ steps: - name: executable pull: always - image: golang:1.11-windowsservercore-1809 + image: golang:1.12-windowsservercore-1809 commands: - ./release/windows/amd64/drone-manifest.exe --help - name: dryrun pull: always - image: plugins/docker:windows-1809 + image: plugins/docker settings: daemon_off: true dockerfile: docker/Dockerfile.windows.1809 @@ -187,7 +187,7 @@ steps: password: from_secret: docker_password repo: plugins/manifest - tags: windows-1809 + tags: windows-1809-amd64 username: from_secret: docker_username volumes: @@ -199,10 +199,10 @@ steps: - name: publish pull: always - image: plugins/docker:windows-1809 + image: plugins/docker settings: auto_tag: true - auto_tag_suffix: windows-1809 + auto_tag_suffix: windows-1809-amd64 daemon_off: true dockerfile: docker/Dockerfile.windows.1809 password: diff --git a/docker/Dockerfile.windows.1803 b/docker/Dockerfile.windows.1803 index 0bc65b1..66858a5 100644 --- a/docker/Dockerfile.windows.1803 +++ b/docker/Dockerfile.windows.1803 @@ -1,5 +1,5 @@ # escape=` -FROM plugins/base:windows-1803 +FROM plugins/base:windows-1803-amd64 LABEL maintainer="Drone.IO Community " ` org.label-schema.name="Drone Manifest" ` diff --git a/docker/Dockerfile.windows.1809 b/docker/Dockerfile.windows.1809 index 0ebef5c..41a2153 100644 --- a/docker/Dockerfile.windows.1809 +++ b/docker/Dockerfile.windows.1809 @@ -1,5 +1,5 @@ # escape=` -FROM plugins/base:windows-1809 +FROM plugins/base:windows-1809-amd64 LABEL maintainer="Drone.IO Community " ` org.label-schema.name="Drone Manifest" ` diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl index 4e17f68..707c7fc 100644 --- a/docker/manifest.tmpl +++ b/docker/manifest.tmpl @@ -24,13 +24,13 @@ manifests: os: linux variant: v7 - - image: plugins/manifest:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803 + image: plugins/manifest:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1803-amd64 platform: architecture: amd64 os: windows version: 1803 - - image: plugins/manifest:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809 + image: plugins/manifest:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1809-amd64 platform: architecture: amd64 os: windows diff --git a/plugin.go b/plugin.go index 19b77b9..25a2dc2 100644 --- a/plugin.go +++ b/plugin.go @@ -6,6 +6,7 @@ import ( "log" "os" "os/exec" + "runtime" "strings" "github.com/drone/drone-template-lib/template" @@ -60,6 +61,14 @@ type ( } ) +func mainfestToolPath() string { + if runtime.GOOS == "windows" { + return "C:/bin/manifest-tool.exe" + } + + return "/bin/manifest-tool" +} + func (p *Plugin) Exec() error { args := []string{} @@ -144,7 +153,7 @@ func (p *Plugin) Exec() error { } cmd := exec.Command( - "manifest-tool", + mainfestToolPath(), args..., )