mirror of
https://github.com/thegeeklab/drone-s3-sync.git
synced 2024-11-25 00:10:39 +00:00
Add a reliable version and integrate libsonnet definition
This commit is contained in:
parent
4652f703b9
commit
d0a571de4e
177
.drone.jsonnet
177
.drone.jsonnet
@ -1,169 +1,14 @@
|
||||
local PipelineTesting = {
|
||||
kind: "pipeline",
|
||||
name: "testing",
|
||||
platform: {
|
||||
os: "linux",
|
||||
arch: "amd64",
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: "vet",
|
||||
image: "golang:1.11",
|
||||
pull: "always",
|
||||
environment: {
|
||||
GO111MODULE: "on",
|
||||
},
|
||||
commands: [
|
||||
"go vet ./...",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "test",
|
||||
image: "golang:1.11",
|
||||
pull: "always",
|
||||
environment: {
|
||||
GO111MODULE: "on",
|
||||
},
|
||||
commands: [
|
||||
"go test -cover ./...",
|
||||
],
|
||||
},
|
||||
],
|
||||
trigger: {
|
||||
branch: [ "master" ],
|
||||
},
|
||||
};
|
||||
|
||||
local PipelineBuild(os="linux", arch="amd64") = {
|
||||
kind: "pipeline",
|
||||
name: os + "-" + arch,
|
||||
platform: {
|
||||
os: os,
|
||||
arch: arch,
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: "build-push",
|
||||
image: "golang:1.11",
|
||||
pull: "always",
|
||||
environment: {
|
||||
CGO_ENABLED: "0",
|
||||
GO111MODULE: "on",
|
||||
},
|
||||
commands: [
|
||||
"go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-s3-sync",
|
||||
],
|
||||
when: {
|
||||
event: [ "push", "pull_request" ],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "build-tag",
|
||||
image: "golang:1.11",
|
||||
pull: "always",
|
||||
environment: {
|
||||
CGO_ENABLED: "0",
|
||||
GO111MODULE: "on",
|
||||
},
|
||||
commands: [
|
||||
"go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-s3-sync",
|
||||
],
|
||||
when: {
|
||||
event: [ "tag" ],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "executable",
|
||||
image: "golang:1.11",
|
||||
pull: "always",
|
||||
commands: [
|
||||
"./release/" + os + "/" + arch + "/drone-s3-sync --help",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "dryrun",
|
||||
image: "plugins/docker:" + os + "-" + arch,
|
||||
pull: "always",
|
||||
settings: {
|
||||
dry_run: true,
|
||||
tags: os + "-" + arch,
|
||||
dockerfile: "docker/Dockerfile." + os + "." + arch,
|
||||
repo: "plugins/s3-sync",
|
||||
username: { "from_secret": "docker_username" },
|
||||
password: { "from_secret": "docker_password" },
|
||||
},
|
||||
when: {
|
||||
event: [ "pull_request" ],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "publish",
|
||||
image: "plugins/docker:" + os + "-" + arch,
|
||||
pull: "always",
|
||||
settings: {
|
||||
auto_tag: true,
|
||||
auto_tag_suffix: os + "-" + arch,
|
||||
dockerfile: "docker/Dockerfile." + os + "." + arch,
|
||||
repo: "plugins/s3-sync",
|
||||
username: { "from_secret": "docker_username" },
|
||||
password: { "from_secret": "docker_password" },
|
||||
},
|
||||
when: {
|
||||
event: [ "push", "tag" ],
|
||||
},
|
||||
},
|
||||
],
|
||||
depends_on: [
|
||||
"testing",
|
||||
],
|
||||
trigger: {
|
||||
branch: [ "master" ],
|
||||
},
|
||||
};
|
||||
|
||||
local PipelineNotifications = {
|
||||
kind: "pipeline",
|
||||
name: "notifications",
|
||||
platform: {
|
||||
os: "linux",
|
||||
arch: "amd64",
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: "manifest",
|
||||
image: "plugins/manifest:1",
|
||||
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:1",
|
||||
pull: "always",
|
||||
settings: {
|
||||
url: { "from_secret": "microbadger_url" },
|
||||
},
|
||||
},
|
||||
],
|
||||
depends_on: [
|
||||
"linux-amd64",
|
||||
"linux-arm64",
|
||||
"linux-arm",
|
||||
],
|
||||
trigger: {
|
||||
branch: [ "master" ],
|
||||
event: [ "push", "tag" ],
|
||||
},
|
||||
};
|
||||
local pipeline = import 'pipeline.libsonnet';
|
||||
local name = 'drone-s3-sync';
|
||||
|
||||
[
|
||||
PipelineTesting,
|
||||
PipelineBuild("linux", "amd64"),
|
||||
PipelineBuild("linux", "arm64"),
|
||||
PipelineBuild("linux", "arm"),
|
||||
PipelineNotifications,
|
||||
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
.drone.windows.jsonnet
Normal file
9
.drone.windows.jsonnet
Normal file
@ -0,0 +1,9 @@
|
||||
local pipeline = import 'pipeline.libsonnet';
|
||||
local name = 'drone-s3-sync';
|
||||
|
||||
[
|
||||
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,30 +1,73 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: windows-amd64
|
||||
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
|
||||
image: golang:1.11-windowsservercore-1803
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/windows/amd64/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-s3-sync.exe"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build-tag
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
image: golang:1.11-windowsservercore-1803
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/windows/amd64/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-s3-sync.exe"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
@ -34,43 +77,196 @@ steps:
|
||||
|
||||
- name: executable
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
image: golang:1.11-windowsservercore-1803
|
||||
commands:
|
||||
- ./release/windows/amd64/drone-s3-sync --help
|
||||
- ./release/windows/amd64/drone-s3-sync.exe --help
|
||||
|
||||
- name: dryrun
|
||||
pull: always
|
||||
image: plugins/docker:windows-amd64
|
||||
image: plugins/docker:windows-1803
|
||||
settings:
|
||||
dockerfile: docker/Dockerfile.windows.amd64
|
||||
daemon_off: true
|
||||
dockerfile: docker/Dockerfile.windows.1803
|
||||
dry_run: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/s3-sync
|
||||
tags: windows-amd64
|
||||
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-amd64
|
||||
image: plugins/docker:windows-1803
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: windows-amd64
|
||||
dockerfile: docker/Dockerfile.windows.amd64
|
||||
auto_tag_suffix: windows-1803
|
||||
daemon_off: true
|
||||
dockerfile: docker/Dockerfile.windows.1803
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: plugins/s3-sync
|
||||
username:
|
||||
from_secret: docker_username
|
||||
volumes:
|
||||
- name: docker_pipe
|
||||
path: \\\\.\\pipe\\docker_engine
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
volumes:
|
||||
- name: docker_pipe
|
||||
host:
|
||||
path: \\\\.\\pipe\\docker_engine
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
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-s3-sync.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-s3-sync.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-s3-sync.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/s3-sync
|
||||
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/s3-sync
|
||||
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
|
||||
|
||||
...
|
||||
|
88
.drone.yml
88
.drone.yml
@ -14,6 +14,9 @@ steps:
|
||||
- go vet ./...
|
||||
environment:
|
||||
GO111MODULE: on
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
- name: test
|
||||
pull: always
|
||||
@ -22,10 +25,19 @@ steps:
|
||||
- go test -cover ./...
|
||||
environment:
|
||||
GO111MODULE: on
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
volumes:
|
||||
- name: gopath
|
||||
temp: {}
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
@ -40,20 +52,20 @@ steps:
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-s3-sync"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build-tag
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-s3-sync"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
@ -71,6 +83,7 @@ steps:
|
||||
pull: always
|
||||
image: plugins/docker:linux-amd64
|
||||
settings:
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
dry_run: true
|
||||
password:
|
||||
@ -89,6 +102,7 @@ steps:
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
@ -97,12 +111,14 @@ steps:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
depends_on:
|
||||
- testing
|
||||
@ -120,20 +136,20 @@ steps:
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-s3-sync"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build-tag
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-s3-sync"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
@ -151,6 +167,7 @@ steps:
|
||||
pull: always
|
||||
image: plugins/docker:linux-arm64
|
||||
settings:
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
dry_run: true
|
||||
password:
|
||||
@ -169,6 +186,7 @@ steps:
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
@ -177,12 +195,14 @@ steps:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
depends_on:
|
||||
- testing
|
||||
@ -200,20 +220,20 @@ steps:
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-s3-sync"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build-tag
|
||||
pull: always
|
||||
image: golang:1.11
|
||||
commands:
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-s3-sync"
|
||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-s3-sync"
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
GO111MODULE: on
|
||||
@ -231,6 +251,7 @@ steps:
|
||||
pull: always
|
||||
image: plugins/docker:linux-arm
|
||||
settings:
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
dry_run: true
|
||||
password:
|
||||
@ -249,6 +270,7 @@ steps:
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm
|
||||
daemon_off: false
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
password:
|
||||
from_secret: docker_password
|
||||
@ -257,12 +279,14 @@ steps:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
depends_on:
|
||||
- testing
|
||||
@ -278,7 +302,7 @@ platform:
|
||||
steps:
|
||||
- name: manifest
|
||||
pull: always
|
||||
image: plugins/manifest:1
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
ignore_missing: true
|
||||
password:
|
||||
@ -289,17 +313,15 @@ steps:
|
||||
|
||||
- name: microbadger
|
||||
pull: always
|
||||
image: plugins/webhook:1
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
url:
|
||||
from_secret: microbadger_url
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
|
@ -1,10 +1,10 @@
|
||||
# escape=`
|
||||
FROM plugins/base:windows-amd64
|
||||
FROM plugins/base:windows-1803
|
||||
|
||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
org.label-schema.name="Drone S3 Sync" `
|
||||
org.label-schema.vendor="Drone.IO Community" `
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
ADD release\drone-s3-sync.exe c:\drone-s3-sync.exe
|
||||
ENTRYPOINT [ "c:\\drone-s3-sync.exe" ]
|
||||
ADD release/windows/amd64/drone-s3-sync.exe C:/bin/drone-s3-sync.exe
|
||||
ENTRYPOINT [ "C:\\bin\\drone-s3-sync.exe" ]
|
10
docker/Dockerfile.windows.1809
Normal file
10
docker/Dockerfile.windows.1809
Normal file
@ -0,0 +1,10 @@
|
||||
# escape=`
|
||||
FROM plugins/base:windows-1809
|
||||
|
||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
org.label-schema.name="Drone S3 Sync" `
|
||||
org.label-schema.vendor="Drone.IO Community" `
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
ADD release/windows/amd64/drone-s3-sync.exe C:/bin/drone-s3-sync.exe
|
||||
ENTRYPOINT [ "C:\\bin\\drone-s3-sync.exe" ]
|
@ -24,8 +24,14 @@ manifests:
|
||||
os: linux
|
||||
variant: v7
|
||||
-
|
||||
image: plugins/s3-sync:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-amd64
|
||||
image: plugins/s3-sync:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1803
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
variant: 1809
|
||||
version: 1803
|
||||
-
|
||||
image: plugins/s3-sync:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1809
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
version: 1809
|
||||
|
6
main.go
6
main.go
@ -9,14 +9,16 @@ import (
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var build = "0" // build number set at compile-time
|
||||
var (
|
||||
version = "unknown"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "s3 sync plugin"
|
||||
app.Usage = "s3 sync plugin"
|
||||
app.Action = run
|
||||
app.Version = fmt.Sprintf("1.1.0+%s", build)
|
||||
app.Version = version
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "endpoint",
|
||||
|
204
pipeline.libsonnet
Normal file
204
pipeline.libsonnet
Normal file
@ -0,0 +1,204 @@
|
||||
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,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user