0
0
mirror of https://github.com/thegeeklab/wp-gitea-release.git synced 2024-11-13 22:50:42 +00:00

Merge pull request #35 from tphoney/harness_move

(maint) move to harness.drone.io
This commit is contained in:
TP Honey 2022-12-07 13:48:58 +00:00 committed by GitHub
commit d23c4f699f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 269 additions and 855 deletions

View File

@ -1,14 +0,0 @@
local pipeline = import 'pipeline.libsonnet';
local name = 'drone-gitea-release';
[
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',
]),
]

View File

@ -1,9 +0,0 @@
local pipeline = import 'pipeline.libsonnet';
local name = 'drone-gitea-release';
[
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']),
]

View File

@ -1,273 +0,0 @@
---
kind: pipeline
name: testing
platform:
os: windows
arch: amd64
version: 1803
steps:
- name: vet
pull: always
image: golang:1.13-windowsservercore-1803
commands:
- go vet ./...
environment:
GO111MODULE: on
volumes:
- name: gopath
path: C:\\gopath
- name: test
pull: always
image: golang:1.13-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.13-windowsservercore-1803
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-gitea-release.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.13-windowsservercore-1803
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-gitea-release.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.13-windowsservercore-1803
commands:
- ./release/windows/amd64/drone-gitea-release.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/gitea-release
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/gitea-release
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.13-windowsservercore-1809
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/windows/amd64/drone-gitea-release.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.13-windowsservercore-1809
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/windows/amd64/drone-gitea-release.exe"
environment:
CGO_ENABLED: 0
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.13-windowsservercore-1809
commands:
- ./release/windows/amd64/drone-gitea-release.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/gitea-release
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/gitea-release
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
...

View File

@ -1,332 +1,254 @@
---
kind: pipeline kind: pipeline
type: vm
name: testing name: testing
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
pool:
use: ubuntu
steps: steps:
- name: vet - name: lint
image: golang:1.19
pull: always pull: always
image: golang:1.13
commands: commands:
- go vet ./... - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
environment: - golangci-lint version
GO111MODULE: on - golangci-lint run
volumes: volumes:
- name: gopath - name: gopath
path: /go path: "/go"
- name: test - name: test
pull: always image: golang:1.19
image: golang:1.13
commands: commands:
- go test -cover ./... - go test -cover ./...
environment:
GO111MODULE: on
volumes: volumes:
- name: gopath - name: gopath
path: /go path: "/go"
volumes: volumes:
- name: gopath - name: gopath
temp: {} temp: {}
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- "refs/tags/**" - refs/tags/**
- "refs/pull/**" - refs/pull/**
--- ---
kind: pipeline kind: pipeline
type: vm
name: linux-amd64 name: linux-amd64
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
pool:
use: ubuntu
steps: steps:
- name: build-push - name: environment
image: golang:1.19
pull: always pull: always
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-gitea-release"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.13
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-gitea-release" - go version
- go env
- name: build
image: golang:1.19
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.13
commands: commands:
- ./release/linux/amd64/drone-gitea-release --help - go build -v -ldflags "-X main.version=" -a -tags netgo -o release/linux/amd64/drone-gitea-release .
- name: docker
- name: dryrun image: plugins/docker
pull: always
image: plugins/docker:linux-amd64
settings: settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: docker/Dockerfile.linux.amd64
dry_run: true
password:
from_secret: docker_password
repo: plugins/gitea-release repo: plugins/gitea-release
tags: linux-amd64
username: username:
from_secret: docker_username from_secret: docker_username
when: password:
event: from_secret: docker_password
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-amd64
settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
daemon_off: false depends_on:
dockerfile: docker/Dockerfile.linux.amd64 - testing
password:
from_secret: docker_password
repo: plugins/gitea-release
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- "refs/tags/**" - refs/tags/**
- "refs/pull/**" - refs/pull/**
depends_on:
- testing
--- ---
kind: pipeline kind: pipeline
type: docker
name: linux-arm64 name: linux-arm64
platform: platform:
os: linux os: linux
arch: arm64 arch: arm64
pool:
use: ubuntu_arm64
steps: steps:
- name: build-push - name: environment
image: golang:1.19
pull: always pull: always
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-gitea-release"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.13
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-gitea-release" - go version
- go env
- name: build
image: golang:1.19
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.13
commands: commands:
- ./release/linux/arm64/drone-gitea-release --help - go build -v -ldflags "-X main.version=" -a -tags netgo -o release/linux/arm64/drone-gitea-release .
- name: docker
- name: dryrun image: plugins/docker
pull: always
image: plugins/docker:linux-arm64
settings: settings:
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm64 dockerfile: docker/Dockerfile.linux.arm64
dry_run: true
password:
from_secret: docker_password
repo: plugins/gitea-release repo: plugins/gitea-release
tags: linux-arm64
username: username:
from_secret: docker_username from_secret: docker_username
when: password:
event: from_secret: docker_password
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm64
settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: linux-arm64
daemon_off: false depends_on:
dockerfile: docker/Dockerfile.linux.arm64 - testing
password:
from_secret: docker_password
repo: plugins/gitea-release
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- "refs/tags/**" - refs/tags/**
- "refs/pull/**" - refs/pull/**
depends_on:
- testing
--- ---
kind: pipeline kind: pipeline
name: linux-arm type: vm
name: windows-1809
platform: platform:
os: linux os: windows
arch: arm arch: amd64
pool:
use: windows
steps: steps:
- name: build-push - name: environment
image: golang:1.19
pull: always pull: always
image: golang:1.13
commands:
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-gitea-release"
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
GO111MODULE: on
when:
event:
exclude:
- tag
- name: build-tag
pull: always
image: golang:1.13
commands: commands:
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-gitea-release" - go version
- go env
- name: build
image: golang:1.19
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
GO111MODULE: on
when:
event:
- tag
- name: executable
pull: always
image: golang:1.13
commands: commands:
- ./release/linux/arm/drone-gitea-release --help - go build -v -ldflags "-X main.version=" -a -tags netgo -o release/windows/amd64/drone-gitea-release.exe .
- name: docker
- name: dryrun image: plugins/docker
pull: always
image: plugins/docker:linux-arm
settings: settings:
daemon_off: false dockerfile: docker/Dockerfile.windows.1809
dockerfile: docker/Dockerfile.linux.arm
dry_run: true
password:
from_secret: docker_password
repo: plugins/gitea-release repo: plugins/gitea-release
tags: linux-arm
username: username:
from_secret: docker_username from_secret: docker_username
when: password:
event: from_secret: docker_password
- pull_request
- name: publish
pull: always
image: plugins/docker:linux-arm
settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: windows-1809-amd64
daemon_off: false daemon_off: true
dockerfile: docker/Dockerfile.linux.arm purge: false
password:
from_secret: docker_password
repo: plugins/gitea-release
username:
from_secret: docker_username
when: when:
event: ref:
exclude: - refs/heads/master
- pull_request - refs/tags/**
depends_on:
- testing
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- "refs/tags/**" - refs/tags/**
- "refs/pull/**" - refs/pull/**
depends_on:
- testing
--- ---
kind: pipeline kind: pipeline
name: notifications type: vm
name: windows-ltsc2022
platform:
os: windows
arch: amd64
pool:
use: windows-2022
steps:
- name: environment
image: golang:1.19
pull: always
environment:
CGO_ENABLED: "0"
commands:
- go version
- go env
- name: build
image: golang:1.19
environment:
CGO_ENABLED: "0"
commands:
- go build -v -ldflags "-X main.version=" -a -tags netgo -o release/windows/amd64/drone-gitea-release.exe .
- name: docker
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.windows.ltsc2022
repo: plugins/gitea-release
username:
from_secret: docker_username
password:
from_secret: docker_password
auto_tag: true
auto_tag_suffix: windows-ltsc2022-amd64
daemon_off: true
purge: false
when:
ref:
- refs/heads/master
- refs/tags/**
depends_on:
- testing
trigger:
ref:
- refs/heads/master
- refs/tags/**
- refs/pull/**
---
kind: pipeline
type: vm
name: manifest
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
pool:
use: ubuntu
steps: steps:
- name: manifest - name: manifest
pull: always
image: plugins/manifest image: plugins/manifest
settings: settings:
auto_tag: true auto_tag: "true"
ignore_missing: true username:
from_secret: docker_username
password: password:
from_secret: docker_password from_secret: docker_password
spec: docker/manifest.tmpl spec: docker/manifest.tmpl
username: ignore_missing: true
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: depends_on:
- linux-amd64 - linux-amd64
- linux-arm64 - linux-arm64
- linux-arm - windows-1809
- windows-ltsc2022
... trigger:
ref:
- refs/heads/master
- refs/tags/**

View File

@ -1,9 +0,0 @@
FROM plugins/base:multiarch
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
org.label-schema.name="Drone Gitea Release" \
org.label-schema.vendor="Drone.IO Community" \
org.label-schema.schema-version="1.0"
ADD release/linux/arm/drone-gitea-release /bin/
ENTRYPOINT [ "/bin/drone-gitea-release" ]

View File

@ -1,5 +1,5 @@
# escape=` # escape=`
FROM plugins/base:windows-1803 FROM plugins/base:windows-1809
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" ` LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Gitea Release" ` org.label-schema.name="Drone Gitea Release" `

View File

@ -17,21 +17,15 @@ manifests:
architecture: arm64 architecture: arm64
os: linux os: linux
variant: v8 variant: v8
-
image: plugins/gitea-release:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7
-
image: plugins/gitea-release:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
platform:
architecture: amd64
os: windows
version: 1803
- -
image: plugins/gitea-release:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809 image: plugins/gitea-release:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
platform: platform:
architecture: amd64 architecture: amd64
os: windows os: windows
version: 1809 version: 1809
-
image: plugins/gitea-release:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}ltsc2022-amd64
platform:
architecture: amd64
os: windows
version: ltsc2022-amd64

22
go.mod
View File

@ -1,14 +1,18 @@
module github.com/drone-plugins/drone-gitea-release module github.com/drone-plugins/drone-gitea-release
go 1.14 go 1.19
require ( require (
code.gitea.io/sdk/gitea v0.13.2 code.gitea.io/sdk/gitea v0.15.1
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/joho/godotenv v1.4.0
github.com/joho/godotenv v1.3.0 github.com/sirupsen/logrus v1.9.0
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/urfave/cli v1.22.10
github.com/sirupsen/logrus v1.7.0 golang.org/x/crypto v0.4.0
github.com/urfave/cli v1.22.5 )
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
golang.org/x/sys v0.3.0 // indirect
) )

62
go.sum
View File

@ -1,39 +1,55 @@
code.gitea.io/sdk/gitea v0.13.2 h1:wAnT/J7Z62q3fJXbgnecoaOBh8CM1Qq0/DakWxiv4yA= code.gitea.io/gitea-vet v0.2.1/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE=
code.gitea.io/sdk/gitea v0.13.2/go.mod h1:lee2y8LeV3kQb2iK+hHlMqoadL4bp27QOkOV/hawLKg= code.gitea.io/sdk/gitea v0.15.1 h1:WJreC7YYuxbn0UDaPuWIe/mtiNKTvLN8MLkaw71yx/M=
code.gitea.io/sdk/gitea v0.15.1/go.mod h1:klY2LVI3s3NChzIk/MzMn7G1FHrfU7qd63iSMVoHRBA=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 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-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.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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.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 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk=
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f h1:QdHQnPce6K4XQewki9WNbG5KOROuDzqO3NaYjI1cXJ0= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -3,8 +3,8 @@ package main
import ( import (
"os" "os"
"github.com/sirupsen/logrus"
"github.com/joho/godotenv" "github.com/joho/godotenv"
"github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View File

@ -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,
},
}

View File

@ -3,7 +3,6 @@ package main
import ( import (
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"io/ioutil"
"net/http" "net/http"
"net/http/cookiejar" "net/http/cookiejar"
"os" "os"
@ -164,7 +163,7 @@ func readStringOrFile(input string) (string, error) {
} else if err != nil { } else if err != nil {
return "", err return "", err
} }
result, err := ioutil.ReadFile(input) result, err := os.ReadFile(input)
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -6,16 +6,14 @@ import (
"crypto/sha256" "crypto/sha256"
"crypto/sha512" "crypto/sha512"
"fmt" "fmt"
"golang.org/x/crypto/blake2b"
"golang.org/x/crypto/blake2s"
"hash/adler32" "hash/adler32"
"hash/crc32" "hash/crc32"
"io" "io"
"io/ioutil"
"os" "os"
"os/exec"
"strconv" "strconv"
"strings"
"golang.org/x/crypto/blake2b"
"golang.org/x/crypto/blake2s"
) )
var ( var (
@ -26,17 +24,8 @@ var (
} }
) )
func execute(cmd *exec.Cmd) error {
fmt.Println("+", strings.Join(cmd.Args, " "))
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
return cmd.Run()
}
func checksum(r io.Reader, method string) (string, error) { func checksum(r io.Reader, method string) (string, error) {
b, err := ioutil.ReadAll(r) b, err := io.ReadAll(r)
if err != nil { if err != nil {
return "", err return "", err