Merge pull request #17 from drone-plugins/improve-config
Drop renovate, proper version definition, unified jsonnet config
This commit is contained in:
commit
46d9dc135d
177
.drone.jsonnet
177
.drone.jsonnet
@ -1,169 +1,14 @@
|
|||||||
local PipelineTesting = {
|
local pipeline = import 'pipeline.libsonnet';
|
||||||
kind: "pipeline",
|
local name = 'drone-hugo';
|
||||||
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-hugo ./cmd/drone-hugo",
|
|
||||||
],
|
|
||||||
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-hugo ./cmd/drone-hugo",
|
|
||||||
],
|
|
||||||
when: {
|
|
||||||
event: [ "tag" ],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "executable",
|
|
||||||
image: "golang:1.11",
|
|
||||||
pull: "always",
|
|
||||||
commands: [
|
|
||||||
"./release/" + os + "/" + arch + "/drone-hugo --help",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "dryrun",
|
|
||||||
image: "plugins/docker:" + os + "-" + arch,
|
|
||||||
pull: "always",
|
|
||||||
settings: {
|
|
||||||
dry_run: true,
|
|
||||||
tags: os + "-" + arch,
|
|
||||||
dockerfile: "docker/Dockerfile." + os + "." + arch,
|
|
||||||
repo: "plugins/hugo",
|
|
||||||
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/hugo",
|
|
||||||
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" ],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
[
|
[
|
||||||
PipelineTesting,
|
pipeline.test('linux', 'amd64'),
|
||||||
PipelineBuild("linux", "amd64"),
|
pipeline.build(name, 'linux', 'amd64'),
|
||||||
PipelineBuild("linux", "arm64"),
|
pipeline.build(name, 'linux', 'arm64'),
|
||||||
PipelineBuild("linux", "arm"),
|
pipeline.build(name, 'linux', 'arm'),
|
||||||
PipelineNotifications,
|
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-hugo';
|
||||||
|
|
||||||
|
[
|
||||||
|
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
|
kind: pipeline
|
||||||
name: windows-amd64
|
name: testing
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: windows
|
os: windows
|
||||||
arch: amd64
|
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:
|
steps:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11-windowsservercore-1803
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/windows/amd64/drone-hugo" ./cmd/drone-hugo
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-hugo.exe"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11-windowsservercore-1803
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/windows/amd64/drone-hugo" ./cmd/drone-hugo
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-hugo.exe"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -34,43 +77,196 @@ steps:
|
|||||||
|
|
||||||
- name: executable
|
- name: executable
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11-windowsservercore-1803
|
||||||
commands:
|
commands:
|
||||||
- ./release/windows/amd64/drone-hugo --help
|
- ./release/windows/amd64/drone-hugo.exe --help
|
||||||
|
|
||||||
- name: dryrun
|
- name: dryrun
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:windows-amd64
|
image: plugins/docker:windows-1803
|
||||||
settings:
|
settings:
|
||||||
dockerfile: docker/Dockerfile.windows.amd64
|
daemon_off: true
|
||||||
|
dockerfile: docker/Dockerfile.windows.1803
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: plugins/hugo
|
repo: plugins/hugo
|
||||||
tags: windows-amd64
|
tags: windows-1803
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
- name: publish
|
- name: publish
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:windows-amd64
|
image: plugins/docker:windows-1803
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: windows-amd64
|
auto_tag_suffix: windows-1803
|
||||||
dockerfile: docker/Dockerfile.windows.amd64
|
daemon_off: true
|
||||||
|
dockerfile: docker/Dockerfile.windows.1803
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: plugins/hugo
|
repo: plugins/hugo
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_pipe
|
||||||
|
host:
|
||||||
|
path: \\\\.\\pipe\\docker_engine
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- 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-hugo.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-hugo.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-hugo.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/hugo
|
||||||
|
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/hugo
|
||||||
|
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 ./...
|
- go vet ./...
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
pull: always
|
pull: always
|
||||||
@ -22,10 +25,19 @@ steps:
|
|||||||
- go test -cover ./...
|
- go test -cover ./...
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
temp: {}
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@ -40,20 +52,20 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-hugo ./cmd/drone-hugo"
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-hugo"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/amd64/drone-hugo ./cmd/drone-hugo"
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-hugo"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -71,6 +83,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:linux-amd64
|
image: plugins/docker:linux-amd64
|
||||||
settings:
|
settings:
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.amd64
|
dockerfile: docker/Dockerfile.linux.amd64
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
@ -89,6 +102,7 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64
|
auto_tag_suffix: linux-amd64
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.amd64
|
dockerfile: docker/Dockerfile.linux.amd64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -97,12 +111,14 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- testing
|
- testing
|
||||||
@ -120,20 +136,20 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-hugo ./cmd/drone-hugo"
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-hugo"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm64/drone-hugo ./cmd/drone-hugo"
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-hugo"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -151,6 +167,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:linux-arm64
|
image: plugins/docker:linux-arm64
|
||||||
settings:
|
settings:
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm64
|
dockerfile: docker/Dockerfile.linux.arm64
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
@ -169,6 +186,7 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-arm64
|
auto_tag_suffix: linux-arm64
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm64
|
dockerfile: docker/Dockerfile.linux.arm64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -177,12 +195,14 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- testing
|
- testing
|
||||||
@ -200,20 +220,20 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-hugo ./cmd/drone-hugo"
|
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-hugo"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- pull_request
|
- tag
|
||||||
|
|
||||||
- name: build-tag
|
- name: build-tag
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.11
|
image: golang:1.11
|
||||||
commands:
|
commands:
|
||||||
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/linux/arm/drone-hugo ./cmd/drone-hugo"
|
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-hugo"
|
||||||
environment:
|
environment:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
@ -231,6 +251,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/docker:linux-arm
|
image: plugins/docker:linux-arm
|
||||||
settings:
|
settings:
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm
|
dockerfile: docker/Dockerfile.linux.arm
|
||||||
dry_run: true
|
dry_run: true
|
||||||
password:
|
password:
|
||||||
@ -249,6 +270,7 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-arm
|
auto_tag_suffix: linux-arm
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/Dockerfile.linux.arm
|
dockerfile: docker/Dockerfile.linux.arm
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -257,12 +279,14 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
|
- "refs/tags/**"
|
||||||
|
- "refs/pull/**"
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- testing
|
- testing
|
||||||
@ -278,7 +302,7 @@ platform:
|
|||||||
steps:
|
steps:
|
||||||
- name: manifest
|
- name: manifest
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/manifest:1
|
image: plugins/manifest
|
||||||
settings:
|
settings:
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
@ -289,17 +313,15 @@ steps:
|
|||||||
|
|
||||||
- name: microbadger
|
- name: microbadger
|
||||||
pull: always
|
pull: always
|
||||||
image: plugins/webhook:1
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
url:
|
url:
|
||||||
from_secret: microbadger_url
|
from_secret: microbadger_url
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
ref:
|
||||||
- master
|
- refs/heads/master
|
||||||
event:
|
- "refs/tags/**"
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- linux-amd64
|
- linux-amd64
|
||||||
|
167
DOCS.md
167
DOCS.md
@ -1,167 +0,0 @@
|
|||||||
drone-hugo
|
|
||||||
|
|
||||||
[![GitHub release](https://img.shields.io/github/release/drone-plugins/drone-hugo.svg)](https://github.com/plugins/hugo/releases) ![](https://img.shields.io/badge/hugo%20version-v0.42-ff69b4.svg)
|
|
||||||
|
|
||||||
**Automatically create static web page files using Hugo within your drone pipeline!**
|
|
||||||
|
|
||||||
plugins/hugo is:
|
|
||||||
|
|
||||||
- **Easy** to implement in your existing pipeline using `.drone.yml`
|
|
||||||
- **Small** 21mb image size
|
|
||||||
- **Highly configurable**
|
|
||||||
|
|
||||||
## Basic Usage with Drone CI
|
|
||||||
|
|
||||||
The example below demonstrates how you can use the plugin to automatically create static web page files using Hugo. **It's as easy as pie!**
|
|
||||||
|
|
||||||
```yml
|
|
||||||
pipeline:
|
|
||||||
hugo:
|
|
||||||
image: plugins/hugo:latest
|
|
||||||
validate: true
|
|
||||||
```
|
|
||||||
|
|
||||||
`validate` allows you to check your configuration file for errors before generating the files.
|
|
||||||
|
|
||||||
### Customize source, output, theme, config, layout OR content directory paths
|
|
||||||
|
|
||||||
You can customize the paths for e. g. the theme, layout, content directory and output directory and much more!
|
|
||||||
|
|
||||||
```yml
|
|
||||||
pipeline:
|
|
||||||
hugo:
|
|
||||||
image: plugins/hugo:latest
|
|
||||||
+ config: path/to/config
|
|
||||||
+ content: path/to/content/
|
|
||||||
+ layout: path/to/layout
|
|
||||||
+ output: path/to/public
|
|
||||||
+ source: path/to/source
|
|
||||||
+ theme: path/themes/THEMENAME/
|
|
||||||
validate: true
|
|
||||||
```
|
|
||||||
|
|
||||||
### Set hostname (and path) to the root
|
|
||||||
|
|
||||||
You can also define a base URL directly in the pipeline, which is used when generating the files.
|
|
||||||
|
|
||||||
```yml
|
|
||||||
pipeline:
|
|
||||||
hugo:
|
|
||||||
image: plugins/hugo:latest
|
|
||||||
config: path/to/config
|
|
||||||
content: path/to/content/
|
|
||||||
output: path/to/public
|
|
||||||
source: path/to/source
|
|
||||||
theme: path/themes/THEMENAME/
|
|
||||||
+ url: https://example.com
|
|
||||||
validate: true
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build sites and include expired, drafts or future content
|
|
||||||
|
|
||||||
You can set the `buildDrafts`, `buildExpired`, `buildFuture` settings to configure the generated files.
|
|
||||||
|
|
||||||
- `buildDrafts` - include content marked as draft
|
|
||||||
- `buildExpired` - include expired content
|
|
||||||
- `buildFuture` - include content with publishdate in the future
|
|
||||||
|
|
||||||
```yml
|
|
||||||
pipeline:
|
|
||||||
hugo:
|
|
||||||
image: plugins/hugo:latest
|
|
||||||
+ buildDrafts: true
|
|
||||||
+ buildExpired: true
|
|
||||||
+ buildFuture: true
|
|
||||||
config: path/to/config
|
|
||||||
content: path/to/content/
|
|
||||||
output: path/to/public
|
|
||||||
source: path/to/source
|
|
||||||
theme: path/themes/THEMENAME/
|
|
||||||
url: https://example.com
|
|
||||||
validate: true
|
|
||||||
```
|
|
||||||
|
|
||||||
### **Example**: Generate Hugo static files and publish them to remote directory using scp
|
|
||||||
|
|
||||||
Here is a short example of how to define a pipeline that automatically generates the static web page files with Hugo and then copies them to a remote server via scp. This makes publishing websites a breeze!
|
|
||||||
|
|
||||||
```yml
|
|
||||||
pipeline:
|
|
||||||
build:
|
|
||||||
image: plugins/hugo:latest
|
|
||||||
output: site # Output path
|
|
||||||
validate: true
|
|
||||||
when:
|
|
||||||
branch: [ master ]
|
|
||||||
publish:
|
|
||||||
image: appleboy/drone-scp
|
|
||||||
host: example.com
|
|
||||||
username: webuser
|
|
||||||
password: xxxxxxx
|
|
||||||
port: 54321
|
|
||||||
target: /var/www/ # Path to your web directory
|
|
||||||
source: site/* # Copy all files from output path
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also use secrets to hide credentials:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
pipeline:
|
|
||||||
build:
|
|
||||||
image: plugins/hugo:latest
|
|
||||||
output: site # Output path
|
|
||||||
validate: true
|
|
||||||
when:
|
|
||||||
branch: [ master ]
|
|
||||||
publish:
|
|
||||||
image: appleboy/drone-scp
|
|
||||||
+ secrets: [ ssh_username, ssh_password ]
|
|
||||||
host: example.com
|
|
||||||
- username: webuser
|
|
||||||
- password: xxxxxxx
|
|
||||||
port: 54321
|
|
||||||
target: /var/www/ # Path to your web directory
|
|
||||||
source: site/* # Copy all files from output path
|
|
||||||
```
|
|
||||||
|
|
||||||
## Basic Usage using a Docker Container
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run --rm \
|
|
||||||
-e PLUGIN_VERSION=0.40.2 \
|
|
||||||
-e PLUGIN_BUILDDRAFTS=false \
|
|
||||||
-e PLUGIN_BUILDEXPIRED=false \
|
|
||||||
-e PLUGIN_BUILDFUTURE=false \
|
|
||||||
-e PLUGIN_CONFIG=false \
|
|
||||||
-e PLUGIN_CONTENT=false \
|
|
||||||
-e PLUGIN_LAYOUT=false \
|
|
||||||
-e PLUGIN_OUTPUT=false \
|
|
||||||
-e PLUGIN_SOURCE=false \
|
|
||||||
-e PLUGIN_THEME=false \
|
|
||||||
-e PLUGIN_OUTPUT=false \
|
|
||||||
-e PLUGIN_VALIDATE=false \
|
|
||||||
-v $(pwd):$(pwd) \
|
|
||||||
-w $(pwd) \
|
|
||||||
plugins/hugo:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameter Reference
|
|
||||||
|
|
||||||
`hugoVersion` - the hugo version to be used, if not set use v.<HUGO_VERSION>
|
|
||||||
`buildDrafts` - include content marked as draft<br>
|
|
||||||
`buildExpired` - include expired content<br>
|
|
||||||
`buildFuture` - include content with publishdate in the future<br>
|
|
||||||
`config` - config file (default is path/config.yaml|json|toml)<br>
|
|
||||||
`content` - filesystem path to content directory<br>
|
|
||||||
`layout` - filesystem path to layout directory<br>
|
|
||||||
`output` - filesystem path to write files to<br>
|
|
||||||
`source` - filesystem path to read files relative from<br>
|
|
||||||
`theme` - theme to use (located in /themes/THEMENAME/)<br>
|
|
||||||
`url` - hostname (and path) to the root<br>
|
|
||||||
`validate` - validate config file before generation
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
You have suggestions for improvements or features you miss? You are welcome to express all your wishes here. Just create a new Issue and it will be taken care of quickly!
|
|
||||||
|
|
||||||
If you are a developer yourself, you can also contribute code! Further information will follow shortly.
|
|
20
Makefile
20
Makefile
@ -1,20 +0,0 @@
|
|||||||
.PHONY: test build amd64 arm64 arm i386
|
|
||||||
|
|
||||||
test:
|
|
||||||
dep ensure
|
|
||||||
go test ./...
|
|
||||||
|
|
||||||
build: .drone.sh
|
|
||||||
./.drone.sh
|
|
||||||
|
|
||||||
amd64: Dockerfile
|
|
||||||
docker build -t "plugins/hugo:amd64" .
|
|
||||||
|
|
||||||
arm64: Dockerfile.arm64
|
|
||||||
docker build -t "plugins/hugo:arm64" .
|
|
||||||
|
|
||||||
arm: Dockerfile.arm
|
|
||||||
docker build -t "plugins/hugo:arm" .
|
|
||||||
|
|
||||||
arm: Dockerfile.i386
|
|
||||||
docker build -t "plugins/hugo:i386" .
|
|
24
README.md
24
README.md
@ -8,27 +8,35 @@
|
|||||||
[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-hugo?status.svg)](http://godoc.org/github.com/drone-plugins/drone-hugo)
|
[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-hugo?status.svg)](http://godoc.org/github.com/drone-plugins/drone-hugo)
|
||||||
[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-hugo)](https://goreportcard.com/report/github.com/drone-plugins/drone-hugo)
|
[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-hugo)](https://goreportcard.com/report/github.com/drone-plugins/drone-hugo)
|
||||||
|
|
||||||
Automatically create static web page files using [hugo](https://github.com/gohugoio/hugo) within your drone pipeline! For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-hugo/).
|
Automatically create static web page files using [Hugo](https://github.com/gohugoio/hugo) within your Drone pipeline. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-hugo/).
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
Build the binaries with the following commands:
|
Build the binary with the following command:
|
||||||
|
|
||||||
```go
|
```console
|
||||||
make build
|
export GOOS=linux
|
||||||
|
export GOARCH=amd64
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-hugo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
Build the Docker image with the following commands:
|
Build the Docker image with the following command:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
make [amd64,arm64,amd] hugo=0.00.0
|
docker build \
|
||||||
|
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||||
|
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||||
|
--file docker/Dockerfile.linux.amd64 --tag plugins/hugo .
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e PLUGIN_HUGO_VERSION=0.00.0 \
|
-e PLUGIN_HUGO_VERSION=0.00.0 \
|
||||||
-e PLUGIN_BUILDDRAFTS=false \
|
-e PLUGIN_BUILDDRAFTS=false \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/base:windows-amd64
|
FROM plugins/base:windows-1803
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
org.label-schema.name="Drone Mercurial" `
|
org.label-schema.name="Drone Mercurial" `
|
12
docker/Dockerfile.windows.1809
Normal file
12
docker/Dockerfile.windows.1809
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/base:windows-1809
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Mercurial" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
# TODO: install required tools
|
||||||
|
|
||||||
|
ADD release\drone-hugo.exe c:\drone-hugo.exe
|
||||||
|
ENTRYPOINT [ "c:\\drone-hugo.exe" ]
|
@ -24,8 +24,14 @@ manifests:
|
|||||||
os: linux
|
os: linux
|
||||||
variant: v7
|
variant: v7
|
||||||
-
|
-
|
||||||
image: plugins/hugo:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-amd64
|
image: plugins/hugo:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1803
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
variant: 1809
|
version: 1803
|
||||||
|
-
|
||||||
|
image: plugins/hugo:{{#if build.tag}}{{trimPrefix build.tag "v"}}-{{/if}}windows-1809
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1809
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/drone-plugins/drone-hugo"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
version = "0.0.0"
|
version = "unknown"
|
||||||
build = "0"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -19,7 +16,7 @@ func main() {
|
|||||||
app.Name = "hugo plugin"
|
app.Name = "hugo plugin"
|
||||||
app.Usage = "hugo plugin"
|
app.Usage = "hugo plugin"
|
||||||
app.Action = run
|
app.Action = run
|
||||||
app.Version = fmt.Sprintf("%s+%s", version, build)
|
app.Version = version
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "buildDrafts",
|
Name: "buildDrafts",
|
||||||
@ -102,8 +99,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func run(c *cli.Context) error {
|
func run(c *cli.Context) error {
|
||||||
plugin := hugo.Plugin{
|
plugin := Plugin{
|
||||||
Config: hugo.Config{
|
Config: Config{
|
||||||
HugoVersion: c.String("hugoVersion"),
|
HugoVersion: c.String("hugoVersion"),
|
||||||
BuildDrafts: c.Bool("buildDrafts"),
|
BuildDrafts: c.Bool("buildDrafts"),
|
||||||
BuildExpired: c.Bool("buildExpired"),
|
BuildExpired: c.Bool("buildExpired"),
|
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,
|
||||||
|
},
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package hugo
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"config:base"
|
|
||||||
],
|
|
||||||
"docker": {
|
|
||||||
"fileMatch": [
|
|
||||||
"/docker/Dockerfile"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"labels": [
|
|
||||||
"renovate"
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user