mirror of
https://github.com/thegeeklab/wp-ansible.git
synced 2024-11-22 10:00:38 +00:00
Merge pull request #24 from drone-plugins/starlark-integration
Integrate starlark and latest windows version
This commit is contained in:
commit
6d3d914eb2
@ -1,14 +0,0 @@
|
||||
local pipeline = import 'pipeline.libsonnet';
|
||||
local name = 'drone-ansible';
|
||||
|
||||
[
|
||||
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',
|
||||
]),
|
||||
]
|
372
.drone.starlark
Normal file
372
.drone.starlark
Normal file
@ -0,0 +1,372 @@
|
||||
def main(ctx):
|
||||
before = testing()
|
||||
|
||||
stages = [
|
||||
linux('amd64'),
|
||||
linux('arm64'),
|
||||
linux('arm'),
|
||||
windows('1903'),
|
||||
windows('1809'),
|
||||
]
|
||||
|
||||
after = manifest() + gitter()
|
||||
|
||||
for b in before:
|
||||
for s in stages:
|
||||
s['depends_on'].append(b['name'])
|
||||
|
||||
for s in stages:
|
||||
for a in after:
|
||||
a['depends_on'].append(s['name'])
|
||||
|
||||
return before + stages + after
|
||||
|
||||
def testing():
|
||||
return [{
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'testing',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'vet',
|
||||
'image': 'golang:1.12',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'go vet ./...'
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/go'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'test',
|
||||
'image': 'golang:1.12',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'go test -cover ./...'
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/go'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'temp': {}
|
||||
}
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**'
|
||||
]
|
||||
}
|
||||
}]
|
||||
|
||||
def linux(arch):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'linux-%s' % arch,
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': arch,
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'build-push',
|
||||
'image': 'golang:1.12',
|
||||
'pull': 'always',
|
||||
'environment': {
|
||||
'CGO_ENABLED': '0'
|
||||
},
|
||||
'commands': [
|
||||
'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/%s/drone-ansible' % arch
|
||||
],
|
||||
'when': {
|
||||
'event': {
|
||||
'exclude': [
|
||||
'tag'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'build-tag',
|
||||
'image': 'golang:1.12',
|
||||
'pull': 'always',
|
||||
'environment': {
|
||||
'CGO_ENABLED': '0'
|
||||
},
|
||||
'commands': [
|
||||
'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/%s/drone-ansible' % arch
|
||||
],
|
||||
'when': {
|
||||
'event': [
|
||||
'tag'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'executable',
|
||||
'image': 'golang:1.12',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'./release/linux/%s/drone-ansible --help' % arch
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'dryrun',
|
||||
'image': 'plugins/docker',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'dry_run': True,
|
||||
'tags': 'linux-%s' % arch,
|
||||
'dockerfile': 'docker/Dockerfile.linux.%s' % arch,
|
||||
'repo': 'plugins/ansible',
|
||||
'username': {
|
||||
'from_secret': 'docker_username'
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'docker_password'
|
||||
}
|
||||
},
|
||||
'when': {
|
||||
'event': [
|
||||
'pull_request'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'publish',
|
||||
'image': 'plugins/docker',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'auto_tag': True,
|
||||
'auto_tag_suffix': 'linux-%s' % arch,
|
||||
'dockerfile': 'docker/Dockerfile.linux.%s' % arch,
|
||||
'repo': 'plugins/ansible',
|
||||
'username': {
|
||||
'from_secret': 'docker_username'
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'docker_password'
|
||||
}
|
||||
},
|
||||
'when': {
|
||||
'event': {
|
||||
'exclude': [
|
||||
'pull_request'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
'depends_on': [],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
def windows(version):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'ssh',
|
||||
'name': 'windows-%s' % version,
|
||||
'platform': {
|
||||
'os': 'windows'
|
||||
},
|
||||
'server': {
|
||||
'host': {
|
||||
'from_secret': 'windows_server_%s' % version
|
||||
},
|
||||
'user': {
|
||||
'from_secret': 'windows_username'
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'windows_password'
|
||||
},
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'build-push',
|
||||
'environment': {
|
||||
'CGO_ENABLED': '0'
|
||||
},
|
||||
'commands': [
|
||||
'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/windows/amd64/drone-ansible.exe',
|
||||
],
|
||||
'when': {
|
||||
'event': {
|
||||
'exclude': [
|
||||
'tag'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'build-tag',
|
||||
'environment': {
|
||||
'CGO_ENABLED': '0'
|
||||
},
|
||||
'commands': [
|
||||
'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/windows/amd64/drone-ansible.exe',
|
||||
],
|
||||
'when': {
|
||||
'event': [
|
||||
'tag'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'executable',
|
||||
'commands': [
|
||||
'./release/windows/amd64/drone-ansible.exe --help',
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'latest',
|
||||
'environment': {
|
||||
'USERNAME': {
|
||||
'from_secret': 'docker_username'
|
||||
},
|
||||
'PASSWORD': {
|
||||
'from_secret': 'docker_password'
|
||||
},
|
||||
},
|
||||
'commands': [
|
||||
'echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin',
|
||||
'docker build --pull -f docker/Dockerfile.windows.%s -t plugins/ansible:windows-%s-amd64 .' % (version, version),
|
||||
'docker run --rm plugins/ansible:windows-%s-amd64 --help' % version,
|
||||
'docker push plugins/ansible:windows-%s-amd64' % version,
|
||||
],
|
||||
'when': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'tagged',
|
||||
'environment': {
|
||||
'USERNAME': {
|
||||
'from_secret': 'docker_username'
|
||||
},
|
||||
'PASSWORD': {
|
||||
'from_secret': 'docker_password'
|
||||
},
|
||||
},
|
||||
'commands': [
|
||||
'echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin',
|
||||
'docker build --pull -f docker/Dockerfile.windows.%s -t plugins/ansible:${DRONE_TAG##v}-windows-%s-amd64 .' % (version, version),
|
||||
'docker run --rm plugins/ansible:${DRONE_TAG##v}-windows-%s-amd64 --help' % version,
|
||||
'docker push plugins/ansible:${DRONE_TAG##v}-windows-%s-amd64' % version,
|
||||
],
|
||||
'when': {
|
||||
'ref': [
|
||||
'refs/tags/**',
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
'depends_on': [],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
def manifest():
|
||||
return [{
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'manifest',
|
||||
'steps': [
|
||||
{
|
||||
'name': 'manifest',
|
||||
'image': 'plugins/manifest',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'auto_tag': 'true',
|
||||
'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': {
|
||||
'urls': {
|
||||
'from_secret': 'microbadger_url'
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
'depends_on': [],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**'
|
||||
]
|
||||
}
|
||||
}]
|
||||
|
||||
def gitter():
|
||||
return [{
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'gitter',
|
||||
'clone': {
|
||||
'disable': True
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'gitter',
|
||||
'image': 'plugins/gitter',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'webhook': {
|
||||
'from_secret': 'gitter_webhook'
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'manifest'
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**'
|
||||
],
|
||||
'status': [
|
||||
'failure'
|
||||
]
|
||||
}
|
||||
}]
|
@ -1,9 +0,0 @@
|
||||
local pipeline = import 'pipeline.libsonnet';
|
||||
local name = 'drone-ansible';
|
||||
|
||||
[
|
||||
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']),
|
||||
]
|
@ -1,273 +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-ansible.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-ansible.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-ansible.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/ansible
|
||||
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/ansible
|
||||
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-ansible.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-ansible.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-ansible.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/ansible
|
||||
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/ansible
|
||||
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:
|
||||
auto_tag: true
|
||||
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:
|
||||
urls:
|
||||
from_secret: microbadger_url
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
|
||||
depends_on:
|
||||
- windows-1803
|
||||
- windows-1809
|
||||
|
||||
...
|
338
.drone.yml
338
.drone.yml
@ -1,332 +1,16 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: testing
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: vet
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- go vet ./...
|
||||
environment:
|
||||
GO111MODULE: on
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
- name: test
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- go test -cover ./...
|
||||
environment:
|
||||
GO111MODULE: on
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
volumes:
|
||||
- name: gopath
|
||||
temp: {}
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
{"kind": "pipeline", "type": "docker", "name": "testing", "platform": {"os": "linux", "arch": "amd64"}, "steps": [{"name": "vet", "image": "golang:1.12", "pull": "always", "commands": ["go vet ./..."], "volumes": [{"name": "gopath", "path": "/go"}]}, {"name": "test", "image": "golang:1.12", "pull": "always", "commands": ["go test -cover ./..."], "volumes": [{"name": "gopath", "path": "/go"}]}], "volumes": [{"name": "gopath", "temp": {}}], "trigger": {"ref": ["refs/heads/master", "refs/tags/**", "refs/pull/**"]}}
|
||||
---
|
||||
kind: pipeline
|
||||
name: linux-amd64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: build-push
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-ansible"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build-tag
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-ansible"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: executable
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- ./release/linux/amd64/drone-ansible --help
|
||||
|
||||
- name: dryrun
|
||||
pull: always
|
||||
image: plugins/docker:linux-amd64
|
||||
settings:
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
dry_run: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/ansible
|
||||
tags: linux-amd64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
|
||||
- name: publish
|
||||
pull: always
|
||||
image: plugins/docker:linux-amd64
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/ansible
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
depends_on:
|
||||
- testing
|
||||
|
||||
{"kind": "pipeline", "type": "docker", "name": "linux-amd64", "platform": {"os": "linux", "arch": "amd64"}, "steps": [{"name": "build-push", "image": "golang:1.12", "pull": "always", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-ansible"], "when": {"event": {"exclude": ["tag"]}}}, {"name": "build-tag", "image": "golang:1.12", "pull": "always", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-ansible"], "when": {"event": ["tag"]}}, {"name": "executable", "image": "golang:1.12", "pull": "always", "commands": ["./release/linux/amd64/drone-ansible --help"]}, {"name": "dryrun", "image": "plugins/docker", "pull": "always", "settings": {"dry_run": true, "tags": "linux-amd64", "dockerfile": "docker/Dockerfile.linux.amd64", "repo": "plugins/ansible", "username": {"from_secret": "docker_username"}, "password": {"from_secret": "docker_password"}}, "when": {"event": ["pull_request"]}}, {"name": "publish", "image": "plugins/docker", "pull": "always", "settings": {"auto_tag": true, "auto_tag_suffix": "linux-amd64", "dockerfile": "docker/Dockerfile.linux.amd64", "repo": "plugins/ansible", "username": {"from_secret": "docker_username"}, "password": {"from_secret": "docker_password"}}, "when": {"event": {"exclude": ["pull_request"]}}}], "depends_on": ["testing"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**", "refs/pull/**"]}}
|
||||
---
|
||||
kind: pipeline
|
||||
name: linux-arm64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: build-push
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-ansible"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build-tag
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-ansible"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: executable
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- ./release/linux/arm64/drone-ansible --help
|
||||
|
||||
- name: dryrun
|
||||
pull: always
|
||||
image: plugins/docker:linux-arm64
|
||||
settings:
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
dry_run: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/ansible
|
||||
tags: linux-arm64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
|
||||
- name: publish
|
||||
pull: always
|
||||
image: plugins/docker:linux-arm64
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/ansible
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
depends_on:
|
||||
- testing
|
||||
|
||||
{"kind": "pipeline", "type": "docker", "name": "linux-arm64", "platform": {"os": "linux", "arch": "arm64"}, "steps": [{"name": "build-push", "image": "golang:1.12", "pull": "always", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-ansible"], "when": {"event": {"exclude": ["tag"]}}}, {"name": "build-tag", "image": "golang:1.12", "pull": "always", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-ansible"], "when": {"event": ["tag"]}}, {"name": "executable", "image": "golang:1.12", "pull": "always", "commands": ["./release/linux/arm64/drone-ansible --help"]}, {"name": "dryrun", "image": "plugins/docker", "pull": "always", "settings": {"dry_run": true, "tags": "linux-arm64", "dockerfile": "docker/Dockerfile.linux.arm64", "repo": "plugins/ansible", "username": {"from_secret": "docker_username"}, "password": {"from_secret": "docker_password"}}, "when": {"event": ["pull_request"]}}, {"name": "publish", "image": "plugins/docker", "pull": "always", "settings": {"auto_tag": true, "auto_tag_suffix": "linux-arm64", "dockerfile": "docker/Dockerfile.linux.arm64", "repo": "plugins/ansible", "username": {"from_secret": "docker_username"}, "password": {"from_secret": "docker_password"}}, "when": {"event": {"exclude": ["pull_request"]}}}], "depends_on": ["testing"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**", "refs/pull/**"]}}
|
||||
---
|
||||
kind: pipeline
|
||||
name: linux-arm
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm
|
||||
|
||||
steps:
|
||||
- name: build-push
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-ansible"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build-tag
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-ansible"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: executable
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- ./release/linux/arm/drone-ansible --help
|
||||
|
||||
- name: dryrun
|
||||
pull: always
|
||||
image: plugins/docker:linux-arm
|
||||
settings:
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
dry_run: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/ansible
|
||||
tags: linux-arm
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
|
||||
- name: publish
|
||||
pull: always
|
||||
image: plugins/docker:linux-arm
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/ansible
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
depends_on:
|
||||
- testing
|
||||
|
||||
{"kind": "pipeline", "type": "docker", "name": "linux-arm", "platform": {"os": "linux", "arch": "arm"}, "steps": [{"name": "build-push", "image": "golang:1.12", "pull": "always", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-ansible"], "when": {"event": {"exclude": ["tag"]}}}, {"name": "build-tag", "image": "golang:1.12", "pull": "always", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-ansible"], "when": {"event": ["tag"]}}, {"name": "executable", "image": "golang:1.12", "pull": "always", "commands": ["./release/linux/arm/drone-ansible --help"]}, {"name": "dryrun", "image": "plugins/docker", "pull": "always", "settings": {"dry_run": true, "tags": "linux-arm", "dockerfile": "docker/Dockerfile.linux.arm", "repo": "plugins/ansible", "username": {"from_secret": "docker_username"}, "password": {"from_secret": "docker_password"}}, "when": {"event": ["pull_request"]}}, {"name": "publish", "image": "plugins/docker", "pull": "always", "settings": {"auto_tag": true, "auto_tag_suffix": "linux-arm", "dockerfile": "docker/Dockerfile.linux.arm", "repo": "plugins/ansible", "username": {"from_secret": "docker_username"}, "password": {"from_secret": "docker_password"}}, "when": {"event": {"exclude": ["pull_request"]}}}], "depends_on": ["testing"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**", "refs/pull/**"]}}
|
||||
---
|
||||
kind: pipeline
|
||||
name: notifications
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: manifest
|
||||
pull: always
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
auto_tag: true
|
||||
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:
|
||||
urls:
|
||||
from_secret: microbadger_url
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
- linux-arm64
|
||||
- linux-arm
|
||||
|
||||
...
|
||||
{"kind": "pipeline", "type": "ssh", "name": "windows-1903", "platform": {"os": "windows"}, "server": {"host": {"from_secret": "windows_server_1903"}, "user": {"from_secret": "windows_username"}, "password": {"from_secret": "windows_password"}}, "steps": [{"name": "build-push", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-ansible.exe"], "when": {"event": {"exclude": ["tag"]}}}, {"name": "build-tag", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-ansible.exe"], "when": {"event": ["tag"]}}, {"name": "executable", "commands": ["./release/windows/amd64/drone-ansible.exe --help"]}, {"name": "latest", "environment": {"USERNAME": {"from_secret": "docker_username"}, "PASSWORD": {"from_secret": "docker_password"}}, "commands": ["echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin", "docker build --pull -f docker/Dockerfile.windows.1903 -t plugins/ansible:windows-1903-amd64 .", "docker run --rm plugins/ansible:windows-1903-amd64 --help", "docker push plugins/ansible:windows-1903-amd64"], "when": {"ref": ["refs/heads/master"]}}, {"name": "tagged", "environment": {"USERNAME": {"from_secret": "docker_username"}, "PASSWORD": {"from_secret": "docker_password"}}, "commands": ["echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin", "docker build --pull -f docker/Dockerfile.windows.1903 -t plugins/ansible:${DRONE_TAG##v}-windows-1903-amd64 .", "docker run --rm plugins/ansible:${DRONE_TAG##v}-windows-1903-amd64 --help", "docker push plugins/ansible:${DRONE_TAG##v}-windows-1903-amd64"], "when": {"ref": ["refs/tags/**"]}}], "depends_on": ["testing"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**"]}}
|
||||
---
|
||||
{"kind": "pipeline", "type": "ssh", "name": "windows-1809", "platform": {"os": "windows"}, "server": {"host": {"from_secret": "windows_server_1809"}, "user": {"from_secret": "windows_username"}, "password": {"from_secret": "windows_password"}}, "steps": [{"name": "build-push", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-ansible.exe"], "when": {"event": {"exclude": ["tag"]}}}, {"name": "build-tag", "environment": {"CGO_ENABLED": "0"}, "commands": ["go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-ansible.exe"], "when": {"event": ["tag"]}}, {"name": "executable", "commands": ["./release/windows/amd64/drone-ansible.exe --help"]}, {"name": "latest", "environment": {"USERNAME": {"from_secret": "docker_username"}, "PASSWORD": {"from_secret": "docker_password"}}, "commands": ["echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin", "docker build --pull -f docker/Dockerfile.windows.1809 -t plugins/ansible:windows-1809-amd64 .", "docker run --rm plugins/ansible:windows-1809-amd64 --help", "docker push plugins/ansible:windows-1809-amd64"], "when": {"ref": ["refs/heads/master"]}}, {"name": "tagged", "environment": {"USERNAME": {"from_secret": "docker_username"}, "PASSWORD": {"from_secret": "docker_password"}}, "commands": ["echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin", "docker build --pull -f docker/Dockerfile.windows.1809 -t plugins/ansible:${DRONE_TAG##v}-windows-1809-amd64 .", "docker run --rm plugins/ansible:${DRONE_TAG##v}-windows-1809-amd64 --help", "docker push plugins/ansible:${DRONE_TAG##v}-windows-1809-amd64"], "when": {"ref": ["refs/tags/**"]}}], "depends_on": ["testing"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**"]}}
|
||||
---
|
||||
{"kind": "pipeline", "type": "docker", "name": "manifest", "steps": [{"name": "manifest", "image": "plugins/manifest", "pull": "always", "settings": {"auto_tag": "true", "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": {"urls": {"from_secret": "microbadger_url"}}}], "depends_on": ["linux-amd64", "linux-arm64", "linux-arm", "windows-1903", "windows-1809"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**"]}}
|
||||
---
|
||||
{"kind": "pipeline", "type": "docker", "name": "gitter", "clone": {"disable": true}, "steps": [{"name": "gitter", "image": "plugins/gitter", "pull": "always", "settings": {"webhook": {"from_secret": "gitter_webhook"}}}], "depends_on": ["manifest", "linux-amd64", "linux-arm64", "linux-arm", "windows-1903", "windows-1809"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**", "refs/pull/**"], "status": ["failure"]}}
|
||||
|
26
.gitignore
vendored
26
.gitignore
vendored
@ -1,30 +1,4 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
release/
|
||||
vendor/
|
||||
|
||||
coverage.out
|
||||
drone-ansible
|
||||
|
@ -1,5 +1,5 @@
|
||||
# escape=`
|
||||
FROM plugins/base:windows-1809
|
||||
FROM plugins/base:windows-1809-amd64
|
||||
|
||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
org.label-schema.name="Drone Ansible" `
|
||||
|
@ -1,5 +1,5 @@
|
||||
# escape=`
|
||||
FROM plugins/base:windows-1803
|
||||
FROM plugins/base:windows-1903-amd64
|
||||
|
||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
org.label-schema.name="Drone Ansible" `
|
@ -6,31 +6,26 @@ tags:
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
- image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
- image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
variant: v8
|
||||
-
|
||||
image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||
- image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||
platform:
|
||||
architecture: arm
|
||||
os: linux
|
||||
variant: v7
|
||||
-
|
||||
image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
||||
- image: plugins/ansible:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1903-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
version: 1803
|
||||
-
|
||||
image: plugins/ansible:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
|
||||
version: 1903
|
||||
- image: plugins/ansible:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1809-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
|
@ -1,205 +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,
|
||||
auto_tag: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'microbadger',
|
||||
image: 'plugins/webhook',
|
||||
pull: 'always',
|
||||
settings: {
|
||||
urls: { from_secret: 'microbadger_url' },
|
||||
},
|
||||
},
|
||||
],
|
||||
trigger: {
|
||||
ref: [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
depends_on: depends_on,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user