14 Commits

Author SHA1 Message Date
Brad Rydzewski 4a15a55224 enable auto tagging 2019-08-22 14:09:26 -07:00
Brad Rydzewski fbe23cbcec option to dump spec file to debug 2019-08-22 13:54:15 -07:00
Brad Rydzewski 3f387227b5 bump template lib and fix manifest trimPrefix 2019-08-22 13:16:53 -07:00
Brad Rydzewski bd53675813 remove microbadger [ci skip] 2019-08-22 13:04:41 -07:00
Brad Rydzewski 3091c4a002 update manifest template 2019-08-22 13:02:25 -07:00
Thomas Boerger f92bc07dad Merge pull request #26 from deitch/fix-push-args
add from-args
2019-06-21 09:20:18 +02:00
Avi Deitcher 5b15413fc2 add from-args 2019-06-06 14:34:53 +03:00
Don af2017d35c Fix 1803 image 2019-04-25 17:58:29 -07:00
Don 5e8ab59d01 Use base again 2019-04-25 17:55:08 -07:00
Don 18cf775bd3 Fix Tls for Github 2019-04-25 17:31:35 -07:00
Don aaa402cdff Modify shell 2019-04-25 17:19:11 -07:00
Don bed8b9a1b2 Try servercore 2019-04-25 17:11:26 -07:00
Don e957ab3e04 Use 1809 for testing on windows 2019-04-25 16:46:56 -07:00
Don b548a9c07b Update windows build 2019-04-25 16:45:09 -07:00
12 changed files with 56 additions and 520 deletions
-14
View File
@@ -1,14 +0,0 @@
local pipeline = import 'pipeline.libsonnet';
local name = 'drone-manifest';
[
pipeline.test('linux', 'amd64'),
pipeline.build(name, 'linux', 'amd64'),
pipeline.build(name, 'linux', 'arm64'),
pipeline.build(name, 'linux', 'arm'),
pipeline.notifications(depends_on=[
'linux-amd64',
'linux-arm64',
'linux-arm',
]),
]
-9
View File
@@ -1,9 +0,0 @@
local pipeline = import 'pipeline.libsonnet';
local name = 'drone-manifest';
[
pipeline.test('windows', 'amd64', '1803'),
pipeline.build(name, 'windows', 'amd64', '1803'),
pipeline.build(name, 'windows', 'amd64', '1809'),
pipeline.notifications('windows', 'amd64', '1809', ['windows-1803', 'windows-1809']),
]
-272
View File
@@ -1,272 +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
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-manifest.exe"
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-manifest.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11-windowsservercore-1803
commands:
- ./release/windows/amd64/drone-manifest.exe --help
- name: dryrun
pull: always
image: plugins/docker:windows-1803
settings:
daemon_off: true
dockerfile: docker/Dockerfile.windows.1803
dry_run: true
password:
from_secret: docker_password
repo: plugins/manifest
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/Dockerfile.windows.1803
password:
from_secret: docker_password
repo: plugins/manifest
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
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-manifest.exe"
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-manifest.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.11-windowsservercore-1809
commands:
- ./release/windows/amd64/drone-manifest.exe --help
- name: dryrun
pull: always
image: plugins/docker:windows-1809
settings:
daemon_off: true
dockerfile: docker/Dockerfile.windows.1809
dry_run: true
password:
from_secret: docker_password
repo: plugins/manifest
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/Dockerfile.windows.1809
password:
from_secret: docker_password
repo: plugins/manifest
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
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/manifest.tmpl
username:
from_secret: docker_username
- name: microbadger
pull: always
image: plugins/webhook
settings:
url:
from_secret: microbadger_url
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
depends_on:
- windows-1803
- windows-1809
...
+8 -13
View File
@@ -81,7 +81,7 @@ steps:
- name: dryrun
pull: always
image: plugins/docker:linux-amd64
image: plugins/docker
settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.amd64
@@ -98,7 +98,7 @@ steps:
- name: publish
pull: always
image: plugins/docker:linux-amd64
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
@@ -165,7 +165,7 @@ steps:
- name: dryrun
pull: always
image: plugins/docker:linux-arm64
image: plugins/docker
settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm64
@@ -182,7 +182,7 @@ steps:
- name: publish
pull: always
image: plugins/docker:linux-arm64
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
@@ -249,7 +249,7 @@ steps:
- name: dryrun
pull: always
image: plugins/docker:linux-arm
image: plugins/docker
settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm
@@ -266,7 +266,7 @@ steps:
- name: publish
pull: always
image: plugins/docker:linux-arm
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: linux-arm
@@ -304,6 +304,8 @@ steps:
pull: always
image: plugins/manifest
settings:
dump: true
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
@@ -311,13 +313,6 @@ steps:
username:
from_secret: docker_username
- name: microbadger
pull: always
image: plugins/webhook
settings:
url:
from_secret: microbadger_url
trigger:
ref:
- refs/heads/master
+4 -1
View File
@@ -1,5 +1,7 @@
# escape=`
FROM plugins/base:windows-1803
FROM plugins/base:windows-1803-amd64
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Manifest" `
@@ -9,6 +11,7 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
ENV MANIFEST_TOOL_VERSION 0.9.0
RUN New-Item -ItemType directory -Path 'C:/bin'; `
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest ('https://github.com/estesp/manifest-tool/releases/download/v{0}/manifest-tool-windows-amd64.exe' -f $env:MANIFEST_TOOL_VERSION) -OutFile 'C:/bin/manifest-tool.exe';
ADD release/windows/amd64/drone-manifest.exe C:/bin/drone-manifest.exe
+4 -1
View File
@@ -1,5 +1,7 @@
# escape=`
FROM plugins/base:windows-1809
FROM plugins/base:windows-1809-amd64
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Manifest" `
@@ -9,6 +11,7 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
ENV MANIFEST_TOOL_VERSION 0.9.0
RUN New-Item -ItemType directory -Path 'C:/bin'; `
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest ('https://github.com/estesp/manifest-tool/releases/download/v{0}/manifest-tool-windows-amd64.exe' -f $env:MANIFEST_TOOL_VERSION) -OutFile 'C:/bin/manifest-tool.exe';
ADD release/windows/amd64/drone-manifest.exe C:/bin/drone-manifest.exe
+2 -2
View File
@@ -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 "v" build.tag}}-{{/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 "v" build.tag}}-{{/if}}windows-1809-amd64
platform:
architecture: amd64
os: windows
+2 -3
View File
@@ -1,12 +1,11 @@
module github.com/drone-plugins/drone-manifest
require (
bou.ke/monkey v1.0.1 // indirect
github.com/bouk/monkey v1.0.0 // indirect
github.com/coreos/go-semver v0.2.0
github.com/drone/drone-template-lib v1.0.0
github.com/drone/drone-template-lib v0.0.0-20190801203641-b3f90dc7cabc
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.3.0 // indirect
github.com/tkuchiki/faketime v0.1.1 // indirect
github.com/urfave/cli v0.0.0-20180821064027-934abfb2f102
gopkg.in/yaml.v2 v2.2.2 // indirect
)
+13
View File
@@ -5,16 +5,22 @@ github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITg
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/sprig v2.18.0+incompatible h1:QoGhlbC6pter1jxKnjMFxT8EqsLuDE6FEcNbWEpw+lI=
github.com/Masterminds/sprig v2.18.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/Masterminds/sprig v2.20.0+incompatible h1:dJTKKuUkYW3RMFdQFXPU/s6hg10RgctmTjRcbZ98Ap8=
github.com/Masterminds/sprig v2.20.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/aymerick/raymond v2.0.2+incompatible h1:VEp3GpgdAnv9B2GFyTvqgcKvY+mfKMjPOA3SbKLtnU0=
github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/bouk/monkey v1.0.0/go.mod h1:PG/63f4XEUlVyW1ttIeOJmJhhe1+t9EC/je3eTjvFhE=
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/drone/drone-template-lib v0.0.0-20190801203641-b3f90dc7cabc h1:9OGyB12S8hsgr6zTPEGIqpyMptUXPFSA6kpt+W0BasU=
github.com/drone/drone-template-lib v0.0.0-20190801203641-b3f90dc7cabc/go.mod h1:t/pyHx6y2nrLHJFCxuMPAOq0QwC9p8jimznjjFzmbkE=
github.com/drone/drone-template-lib v1.0.0 h1:PNBBfUhifRnrPCoWBlTitk3jipXdv8u8WLbIf7h7j00=
github.com/drone/drone-template-lib v1.0.0/go.mod h1:Hqy1tgqPH5mtbFOZmow19l4jOkZvp+WZ00cB4W3MJhg=
github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s=
github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0=
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI=
@@ -31,5 +37,12 @@ github.com/urfave/cli v0.0.0-20180821064027-934abfb2f102 h1:Er7kUEUX12vAWCp23Uv6
github.com/urfave/cli v0.0.0-20180821064027-934abfb2f102/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+6
View File
@@ -66,6 +66,11 @@ func main() {
Usage: "automatically build tags",
EnvVar: "PLUGIN_DEFAULT_TAGS,PLUGIN_AUTO_TAG",
},
cli.BoolFlag{
Name: "dump",
Usage: "dump the spec to stdout for debug purposes",
EnvVar: "PLUGIN_DUMP",
},
cli.StringFlag{
Name: "path",
Usage: "git clone path",
@@ -189,6 +194,7 @@ func run(c *cli.Context) error {
Template: c.String("template"),
Spec: c.String("spec"),
IgnoreMissing: c.Bool("ignore-missing"),
Dump: c.Bool("dump"),
},
}
-204
View File
@@ -1,204 +0,0 @@
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/' + std.splitLimit(name, '-', 1)[1];
local extension = if is_windows then '.exe' else '';
{
kind: 'pipeline',
name: tag,
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.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/' + os + '/' + arch + '/' + name + extension,
],
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}" -a -tags netgo -o release/' + os + '/' + arch + '/' + name + extension,
],
when: {
event: ['tag'],
},
},
{
name: 'executable',
image: golang,
pull: 'always',
commands: [
'./release/' + os + '/' + arch + '/' + name + extension + ' --help',
],
},
{
name: 'dryrun',
image: 'plugins/docker:' + tag,
pull: 'always',
settings: {
dry_run: true,
tags: tag,
dockerfile: 'docker/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/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: [test_pipeline_name],
volumes: if is_windows then [{ name: windows_pipe_volume, host: { path: windows_pipe } }],
},
notifications(os='linux', arch='amd64', version='', depends_on=[])::
{
kind: 'pipeline',
name: 'notifications',
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/manifest.tmpl',
ignore_missing: true,
},
},
{
name: 'microbadger',
image: 'plugins/webhook',
pull: 'always',
settings: {
url: { from_secret: 'microbadger_url' },
},
},
],
trigger: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
},
depends_on: depends_on,
},
}
+17 -1
View File
@@ -6,6 +6,7 @@ import (
"log"
"os"
"os/exec"
"runtime"
"strings"
"github.com/drone/drone-template-lib/template"
@@ -50,6 +51,7 @@ type (
Template string
Spec string
IgnoreMissing bool
Dump bool
}
Plugin struct {
@@ -60,6 +62,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{}
@@ -106,6 +116,10 @@ func (p *Plugin) Exec() error {
return errors.Wrap(err, "failed to close tempfile")
}
if p.Config.Dump {
println(spec)
}
args = append(args, "from-spec")
args = append(args, tmpfile.Name())
@@ -113,6 +127,8 @@ func (p *Plugin) Exec() error {
"pushing by spec",
)
} else {
args = append(args, "from-args")
if len(p.Config.Platforms) == 0 {
return errors.New("you must provide platforms")
} else {
@@ -144,7 +160,7 @@ func (p *Plugin) Exec() error {
}
cmd := exec.Command(
"manifest-tool",
mainfestToolPath(),
args...,
)