Update windows build

This commit is contained in:
Don
2019-04-25 16:45:09 -07:00
parent a9899d8548
commit b548a9c07b
5 changed files with 30 additions and 21 deletions
+16 -16
View File
@@ -10,7 +10,7 @@ platform:
steps: steps:
- name: vet - name: vet
pull: always pull: always
image: golang:1.11-windowsservercore-1803 image: golang:1.12-windowsservercore-1803
commands: commands:
- go vet ./... - go vet ./...
environment: environment:
@@ -21,7 +21,7 @@ steps:
- name: test - name: test
pull: always pull: always
image: golang:1.11-windowsservercore-1803 image: golang:1.12-windowsservercore-1803
commands: commands:
- go test -cover ./... - go test -cover ./...
environment: environment:
@@ -52,7 +52,7 @@ platform:
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11-windowsservercore-1803 image: golang:1.12-windowsservercore-1803
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe"
environment: environment:
@@ -65,7 +65,7 @@ steps:
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11-windowsservercore-1803 image: golang:1.12-windowsservercore-1803
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe"
environment: environment:
@@ -77,13 +77,13 @@ steps:
- name: executable - name: executable
pull: always pull: always
image: golang:1.11-windowsservercore-1803 image: golang:1.12-windowsservercore-1803
commands: commands:
- ./release/windows/amd64/drone-manifest.exe --help - ./release/windows/amd64/drone-manifest.exe --help
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:windows-1803 image: plugins/docker
settings: settings:
daemon_off: true daemon_off: true
dockerfile: docker/Dockerfile.windows.1803 dockerfile: docker/Dockerfile.windows.1803
@@ -91,7 +91,7 @@ steps:
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/manifest repo: plugins/manifest
tags: windows-1803 tags: windows-1803-amd64
username: username:
from_secret: docker_username from_secret: docker_username
volumes: volumes:
@@ -103,10 +103,10 @@ steps:
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:windows-1803 image: plugins/docker
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: windows-1803 auto_tag_suffix: windows-1803-amd64
daemon_off: true daemon_off: true
dockerfile: docker/Dockerfile.windows.1803 dockerfile: docker/Dockerfile.windows.1803
password: password:
@@ -148,7 +148,7 @@ platform:
steps: steps:
- name: build-push - name: build-push
pull: always pull: always
image: golang:1.11-windowsservercore-1809 image: golang:1.12-windowsservercore-1809
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe"
environment: environment:
@@ -161,7 +161,7 @@ steps:
- name: build-tag - name: build-tag
pull: always pull: always
image: golang:1.11-windowsservercore-1809 image: golang:1.12-windowsservercore-1809
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe" - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-manifest.exe"
environment: environment:
@@ -173,13 +173,13 @@ steps:
- name: executable - name: executable
pull: always pull: always
image: golang:1.11-windowsservercore-1809 image: golang:1.12-windowsservercore-1809
commands: commands:
- ./release/windows/amd64/drone-manifest.exe --help - ./release/windows/amd64/drone-manifest.exe --help
- name: dryrun - name: dryrun
pull: always pull: always
image: plugins/docker:windows-1809 image: plugins/docker
settings: settings:
daemon_off: true daemon_off: true
dockerfile: docker/Dockerfile.windows.1809 dockerfile: docker/Dockerfile.windows.1809
@@ -187,7 +187,7 @@ steps:
password: password:
from_secret: docker_password from_secret: docker_password
repo: plugins/manifest repo: plugins/manifest
tags: windows-1809 tags: windows-1809-amd64
username: username:
from_secret: docker_username from_secret: docker_username
volumes: volumes:
@@ -199,10 +199,10 @@ steps:
- name: publish - name: publish
pull: always pull: always
image: plugins/docker:windows-1809 image: plugins/docker
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: windows-1809 auto_tag_suffix: windows-1809-amd64
daemon_off: true daemon_off: true
dockerfile: docker/Dockerfile.windows.1809 dockerfile: docker/Dockerfile.windows.1809
password: password:
+1 -1
View File
@@ -1,5 +1,5 @@
# escape=` # escape=`
FROM plugins/base:windows-1803 FROM plugins/base:windows-1803-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" ` LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Manifest" ` org.label-schema.name="Drone Manifest" `
+1 -1
View File
@@ -1,5 +1,5 @@
# escape=` # escape=`
FROM plugins/base:windows-1809 FROM plugins/base:windows-1809-amd64
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" ` LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Manifest" ` org.label-schema.name="Drone Manifest" `
+2 -2
View File
@@ -24,13 +24,13 @@ manifests:
os: linux os: linux
variant: v7 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: platform:
architecture: amd64 architecture: amd64
os: windows os: windows
version: 1803 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: platform:
architecture: amd64 architecture: amd64
os: windows os: windows
+10 -1
View File
@@ -6,6 +6,7 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"runtime"
"strings" "strings"
"github.com/drone/drone-template-lib/template" "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 { func (p *Plugin) Exec() error {
args := []string{} args := []string{}
@@ -144,7 +153,7 @@ func (p *Plugin) Exec() error {
} }
cmd := exec.Command( cmd := exec.Command(
"manifest-tool", mainfestToolPath(),
args..., args...,
) )