diff --git a/.drone.jsonnet b/.drone.jsonnet deleted file mode 100644 index d66c94e..0000000 --- a/.drone.jsonnet +++ /dev/null @@ -1,14 +0,0 @@ -local pipeline = import 'pipeline.libsonnet'; -local name = 'drone-matrix'; - -[ - 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', - ]), -] diff --git a/.drone.windows.jsonnet b/.drone.windows.jsonnet deleted file mode 100644 index 6196337..0000000 --- a/.drone.windows.jsonnet +++ /dev/null @@ -1,9 +0,0 @@ -local pipeline = import 'pipeline.libsonnet'; -local name = 'drone-matrix'; - -[ - 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']), -] diff --git a/.drone.windows.yml b/.drone.windows.yml deleted file mode 100644 index 54c6b4b..0000000 --- a/.drone.windows.yml +++ /dev/null @@ -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-matrix.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-matrix.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-matrix.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/matrix - 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/matrix - 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-matrix.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-matrix.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-matrix.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/matrix - 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/matrix - 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 - -... diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 09b7b01..0000000 --- a/.drone.yml +++ /dev/null @@ -1,332 +0,0 @@ ---- -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 -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-matrix" - 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-matrix" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/amd64/drone-matrix --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/matrix - 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/matrix - username: - from_secret: docker_username - when: - event: - exclude: - - pull_request - -trigger: - ref: - - refs/heads/master - - "refs/tags/**" - - "refs/pull/**" - -depends_on: -- testing - ---- -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-matrix" - 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-matrix" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/arm64/drone-matrix --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/matrix - 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/matrix - username: - from_secret: docker_username - when: - event: - exclude: - - pull_request - -trigger: - ref: - - refs/heads/master - - "refs/tags/**" - - "refs/pull/**" - -depends_on: -- testing - ---- -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-matrix" - 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-matrix" - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - -- name: executable - pull: always - image: golang:1.11 - commands: - - ./release/linux/arm/drone-matrix --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/matrix - 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/matrix - username: - from_secret: docker_username - when: - event: - exclude: - - pull_request - -trigger: - ref: - - refs/heads/master - - "refs/tags/**" - - "refs/pull/**" - -depends_on: -- testing - ---- -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 - -... diff --git a/pipeline.libsonnet b/pipeline.libsonnet deleted file mode 100644 index 54a07b2..0000000 --- a/pipeline.libsonnet +++ /dev/null @@ -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, - }, -}