diff --git a/.drone.starlark b/.drone.starlark deleted file mode 100644 index a3b43a8..0000000 --- a/.drone.starlark +++ /dev/null @@ -1,260 +0,0 @@ -def main(ctx): - before = testing() - - stages = [ - linux('amd64'), - linux('arm64'), - linux('arm'), - ] - - 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 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' - ] - } - }] diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 917d4d0..0000000 --- a/.drone.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -{"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", "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", "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", "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", "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"], "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"], "trigger": {"ref": ["refs/heads/master", "refs/tags/**", "refs/pull/**"], "status": ["failure"]}} diff --git a/go.mod b/go.mod index 2671bc5..ae0dd86 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,10 @@ module github.com/drone-plugins/drone-ansible +go 1.15 + require ( - github.com/pkg/errors v0.8.1 - github.com/urfave/cli v1.20.0 + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect + github.com/pkg/errors v0.9.1 + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/urfave/cli v1.22.5 ) diff --git a/go.sum b/go.sum index 46b4788..4e36d61 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,22 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= +github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +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=