mirror of
https://github.com/thegeeklab/wp-matrix.git
synced 2024-11-21 14:20:41 +00:00
refactor: apply repo structure after fork
This commit is contained in:
parent
07a9c8081c
commit
7b9c47ce4c
27
.chglog/CHANGELOG.tpl.md
Executable file
27
.chglog/CHANGELOG.tpl.md
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
{{ range .Versions -}}
|
||||||
|
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
|
||||||
|
|
||||||
|
{{ range .CommitGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
|
||||||
|
{{ $subjects := list }}
|
||||||
|
{{ range .Commits -}}
|
||||||
|
{{ if not (has .Subject $subjects) -}}
|
||||||
|
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
||||||
|
{{ $subjects = append $subjects .Subject -}}
|
||||||
|
{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if .NoteGroups -}}
|
||||||
|
{{ range .NoteGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
|
||||||
|
{{ range .Notes }}
|
||||||
|
{{ .Body }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
25
.chglog/config.yml
Executable file
25
.chglog/config.yml
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
style: github
|
||||||
|
template: CHANGELOG.tpl.md
|
||||||
|
info:
|
||||||
|
title: CHANGELOG
|
||||||
|
repository_url: https://github.com/thegeeklab/drone-matrix
|
||||||
|
options:
|
||||||
|
commit_groups:
|
||||||
|
title_maps:
|
||||||
|
feat: Features
|
||||||
|
fix: Bug Fixes
|
||||||
|
perf: Performance Improvements
|
||||||
|
refactor: Code Refactoring
|
||||||
|
chore: Others
|
||||||
|
test: Testing
|
||||||
|
ci: CI Pipeline
|
||||||
|
docs: Documentation
|
||||||
|
header:
|
||||||
|
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
|
||||||
|
pattern_maps:
|
||||||
|
- Type
|
||||||
|
- Scope
|
||||||
|
- Subject
|
||||||
|
notes:
|
||||||
|
keywords:
|
||||||
|
- BREAKING CHANGE
|
394
.drone.jsonnet
Normal file
394
.drone.jsonnet
Normal file
@ -0,0 +1,394 @@
|
|||||||
|
local PipelineTest = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
image_pull_secrets: ['docker_config'],
|
||||||
|
name: 'test',
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'staticcheck',
|
||||||
|
image: 'golang:1.16',
|
||||||
|
commands: [
|
||||||
|
'go run honnef.co/go/tools/cmd/staticcheck ./...',
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
{
|
||||||
|
name: 'gopath',
|
||||||
|
path: '/go',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'lint',
|
||||||
|
image: 'golang:1.16',
|
||||||
|
commands: [
|
||||||
|
'go run golang.org/x/lint/golint -set_exit_status ./...',
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
{
|
||||||
|
name: 'gopath',
|
||||||
|
path: '/go',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'vet',
|
||||||
|
image: 'golang:1.16',
|
||||||
|
commands: [
|
||||||
|
'go vet ./...',
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
{
|
||||||
|
name: 'gopath',
|
||||||
|
path: '/go',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'test',
|
||||||
|
image: 'golang:1.16',
|
||||||
|
commands: [
|
||||||
|
'go test -cover ./...',
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
{
|
||||||
|
name: 'gopath',
|
||||||
|
path: '/go',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
{
|
||||||
|
name: 'gopath',
|
||||||
|
temp: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
local PipelineBuildBinaries = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
image_pull_secrets: ['docker_config'],
|
||||||
|
name: 'build-binaries',
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'build',
|
||||||
|
image: 'techknowlogick/xgo:go-1.16.x',
|
||||||
|
commands: [
|
||||||
|
'[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
|
||||||
|
'mkdir -p release/',
|
||||||
|
"cd cmd/drone-matrix && xgo -ldflags \"-s -w -X main.version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out drone-matrix .",
|
||||||
|
'mv /build/* /drone/src/release/',
|
||||||
|
'ls -l /drone/src/release/',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'executable',
|
||||||
|
image: 'alpine',
|
||||||
|
commands: [
|
||||||
|
'$(find release/ -executable -type f | grep drone-matrix-linux-amd64) --help',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'compress',
|
||||||
|
image: 'alpine',
|
||||||
|
commands: [
|
||||||
|
'apk add upx',
|
||||||
|
'find release/ -maxdepth 1 -executable -type f -exec upx {} \\;',
|
||||||
|
'ls -lh release/',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'checksum',
|
||||||
|
image: 'alpine',
|
||||||
|
commands: [
|
||||||
|
'cd release/ && sha256sum * > sha256sum.txt',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'changelog-generate',
|
||||||
|
image: 'thegeeklab/git-chglog',
|
||||||
|
commands: [
|
||||||
|
'git fetch -tq',
|
||||||
|
'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'changelog-format',
|
||||||
|
image: 'thegeeklab/alpine-tools',
|
||||||
|
commands: [
|
||||||
|
'prettier CHANGELOG.md',
|
||||||
|
'prettier -w CHANGELOG.md',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish',
|
||||||
|
image: 'plugins/github-release',
|
||||||
|
settings: {
|
||||||
|
overwrite: true,
|
||||||
|
api_key: {
|
||||||
|
from_secret: 'github_token',
|
||||||
|
},
|
||||||
|
files: ['release/*'],
|
||||||
|
title: '${DRONE_TAG}',
|
||||||
|
note: 'CHANGELOG.md',
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
ref: [
|
||||||
|
'refs/tags/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
'test',
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineBuildContainer(arch='amd64') = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
image_pull_secrets: ['docker_config'],
|
||||||
|
name: 'build-container-' + arch,
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: arch,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'build',
|
||||||
|
image: 'golang:1.16',
|
||||||
|
commands: [
|
||||||
|
'[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
|
||||||
|
'go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/' + arch + '/drone-matrix ./cmd/drone-matrix',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'dryrun',
|
||||||
|
image: 'thegeeklab/drone-docker:19',
|
||||||
|
settings: {
|
||||||
|
config: { from_secret: 'docker_config' },
|
||||||
|
dry_run: true,
|
||||||
|
dockerfile: 'docker/Dockerfile.' + arch,
|
||||||
|
repo: 'thegeeklab/${DRONE_REPO_NAME}',
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
},
|
||||||
|
depends_on: ['build'],
|
||||||
|
when: {
|
||||||
|
ref: ['refs/pull/**'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish-dockerhub',
|
||||||
|
image: 'thegeeklab/drone-docker:19',
|
||||||
|
settings: {
|
||||||
|
config: { from_secret: 'docker_config' },
|
||||||
|
auto_tag: true,
|
||||||
|
auto_tag_suffix: arch,
|
||||||
|
dockerfile: 'docker/Dockerfile.' + arch,
|
||||||
|
repo: 'thegeeklab/${DRONE_REPO_NAME}',
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
ref: ['refs/heads/main', 'refs/tags/**'],
|
||||||
|
},
|
||||||
|
depends_on: ['dryrun'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish-quay',
|
||||||
|
image: 'thegeeklab/drone-docker:19',
|
||||||
|
settings: {
|
||||||
|
config: { from_secret: 'docker_config' },
|
||||||
|
auto_tag: true,
|
||||||
|
auto_tag_suffix: arch,
|
||||||
|
dockerfile: 'docker/Dockerfile.' + arch,
|
||||||
|
registry: 'quay.io',
|
||||||
|
repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
|
||||||
|
username: { from_secret: 'quay_username' },
|
||||||
|
password: { from_secret: 'quay_password' },
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
ref: ['refs/heads/main', 'refs/tags/**'],
|
||||||
|
},
|
||||||
|
depends_on: ['dryrun'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
'test',
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineDocs = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: 'docs',
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
concurrency: {
|
||||||
|
limit: 1,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'markdownlint',
|
||||||
|
image: 'thegeeklab/markdownlint-cli',
|
||||||
|
commands: [
|
||||||
|
"markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'spellcheck',
|
||||||
|
image: 'node:lts-alpine',
|
||||||
|
commands: [
|
||||||
|
'npm install -g spellchecker-cli',
|
||||||
|
"spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions",
|
||||||
|
],
|
||||||
|
environment: {
|
||||||
|
FORCE_COLOR: true,
|
||||||
|
NPM_CONFIG_LOGLEVEL: 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish',
|
||||||
|
image: 'plugins/gh-pages',
|
||||||
|
settings: {
|
||||||
|
username: { from_secret: 'github_username' },
|
||||||
|
password: { from_secret: 'github_token' },
|
||||||
|
pages_directory: '_docs/',
|
||||||
|
target_branch: 'docs',
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
ref: ['refs/heads/main'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
'build-binaries',
|
||||||
|
'build-container-amd64',
|
||||||
|
'build-container-arm64',
|
||||||
|
'build-container-arm',
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineNotifications = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
image_pull_secrets: ['docker_config'],
|
||||||
|
name: 'notifications',
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
image: 'plugins/manifest',
|
||||||
|
name: 'manifest-dockerhub',
|
||||||
|
settings: {
|
||||||
|
ignore_missing: true,
|
||||||
|
auto_tag: true,
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
spec: 'docker/manifest.tmpl',
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
status: ['success'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
image: 'plugins/manifest',
|
||||||
|
name: 'manifest-quay',
|
||||||
|
settings: {
|
||||||
|
ignore_missing: true,
|
||||||
|
auto_tag: true,
|
||||||
|
username: { from_secret: 'quay_username' },
|
||||||
|
password: { from_secret: 'quay_password' },
|
||||||
|
spec: 'docker/manifest-quay.tmpl',
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
status: ['success'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'pushrm-dockerhub',
|
||||||
|
image: 'chko/docker-pushrm:1',
|
||||||
|
environment: {
|
||||||
|
DOCKER_PASS: {
|
||||||
|
from_secret: 'docker_password',
|
||||||
|
},
|
||||||
|
DOCKER_USER: {
|
||||||
|
from_secret: 'docker_username',
|
||||||
|
},
|
||||||
|
PUSHRM_FILE: 'README.md',
|
||||||
|
PUSHRM_SHORT: 'Drone plugin to to send messages to Matrix',
|
||||||
|
PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}',
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
status: ['success'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'pushrm-quay',
|
||||||
|
image: 'chko/docker-pushrm:1',
|
||||||
|
environment: {
|
||||||
|
APIKEY__QUAY_IO: {
|
||||||
|
from_secret: 'quay_token',
|
||||||
|
},
|
||||||
|
PUSHRM_FILE: 'README.md',
|
||||||
|
PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
status: ['success'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'matrix',
|
||||||
|
image: 'plugins/matrix',
|
||||||
|
settings: {
|
||||||
|
homeserver: { from_secret: 'matrix_homeserver' },
|
||||||
|
roomid: { from_secret: 'matrix_roomid' },
|
||||||
|
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
|
||||||
|
username: { from_secret: 'matrix_username' },
|
||||||
|
password: { from_secret: 'matrix_password' },
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
status: ['success', 'failure'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
'docs',
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/main', 'refs/tags/**'],
|
||||||
|
status: ['success', 'failure'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
PipelineTest,
|
||||||
|
PipelineBuildBinaries,
|
||||||
|
PipelineBuildContainer(arch='amd64'),
|
||||||
|
PipelineBuildContainer(arch='arm64'),
|
||||||
|
PipelineBuildContainer(arch='arm'),
|
||||||
|
PipelineDocs,
|
||||||
|
PipelineNotifications,
|
||||||
|
]
|
342
.drone.star
342
.drone.star
@ -1,342 +0,0 @@
|
|||||||
def main(ctx):
|
|
||||||
before = testing(ctx)
|
|
||||||
|
|
||||||
stages = [
|
|
||||||
linux(ctx, "amd64"),
|
|
||||||
linux(ctx, "arm64"),
|
|
||||||
linux(ctx, "arm"),
|
|
||||||
windows(ctx, "1909"),
|
|
||||||
windows(ctx, "1903"),
|
|
||||||
windows(ctx, "1809"),
|
|
||||||
]
|
|
||||||
|
|
||||||
after = manifest(ctx) + gitter(ctx)
|
|
||||||
|
|
||||||
for b in before:
|
|
||||||
for s in stages:
|
|
||||||
s["depends_on"].append(b["name"])
|
|
||||||
|
|
||||||
for s in stages:
|
|
||||||
for a in after:
|
|
||||||
a["depends_on"].append(s["name"])
|
|
||||||
|
|
||||||
return before + stages + after
|
|
||||||
|
|
||||||
def testing(ctx):
|
|
||||||
return [{
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "docker",
|
|
||||||
"name": "testing",
|
|
||||||
"platform": {
|
|
||||||
"os": "linux",
|
|
||||||
"arch": "amd64",
|
|
||||||
},
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "staticcheck",
|
|
||||||
"image": "golang:1.15",
|
|
||||||
"pull": "always",
|
|
||||||
"commands": [
|
|
||||||
"go run honnef.co/go/tools/cmd/staticcheck ./...",
|
|
||||||
],
|
|
||||||
"volumes": [
|
|
||||||
{
|
|
||||||
"name": "gopath",
|
|
||||||
"path": "/go",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lint",
|
|
||||||
"image": "golang:1.15",
|
|
||||||
"commands": [
|
|
||||||
"go run golang.org/x/lint/golint -set_exit_status ./...",
|
|
||||||
],
|
|
||||||
"volumes": [
|
|
||||||
{
|
|
||||||
"name": "gopath",
|
|
||||||
"path": "/go",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "vet",
|
|
||||||
"image": "golang:1.15",
|
|
||||||
"commands": [
|
|
||||||
"go vet ./...",
|
|
||||||
],
|
|
||||||
"volumes": [
|
|
||||||
{
|
|
||||||
"name": "gopath",
|
|
||||||
"path": "/go",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test",
|
|
||||||
"image": "golang:1.15",
|
|
||||||
"commands": [
|
|
||||||
"go test -cover ./...",
|
|
||||||
],
|
|
||||||
"volumes": [
|
|
||||||
{
|
|
||||||
"name": "gopath",
|
|
||||||
"path": "/go",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"volumes": [
|
|
||||||
{
|
|
||||||
"name": "gopath",
|
|
||||||
"temp": {},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"trigger": {
|
|
||||||
"ref": [
|
|
||||||
"refs/heads/master",
|
|
||||||
"refs/tags/**",
|
|
||||||
"refs/pull/**",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}]
|
|
||||||
|
|
||||||
def linux(ctx, arch):
|
|
||||||
if ctx.build.event == "tag":
|
|
||||||
build = [
|
|
||||||
'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/linux/%s/drone-matrix ./cmd/drone-matrix' % (ctx.build.ref.replace("refs/tags/v", ""), arch),
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
build = [
|
|
||||||
'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/linux/%s/drone-matrix ./cmd/drone-matrix' % (ctx.build.commit[0:8], arch),
|
|
||||||
]
|
|
||||||
|
|
||||||
steps = [
|
|
||||||
{
|
|
||||||
"name": "environment",
|
|
||||||
"image": "golang:1.15",
|
|
||||||
"pull": "always",
|
|
||||||
"environment": {
|
|
||||||
"CGO_ENABLED": "0",
|
|
||||||
},
|
|
||||||
"commands": [
|
|
||||||
"go version",
|
|
||||||
"go env",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "build",
|
|
||||||
"image": "golang:1.15",
|
|
||||||
"environment": {
|
|
||||||
"CGO_ENABLED": "0",
|
|
||||||
},
|
|
||||||
"commands": build,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "executable",
|
|
||||||
"image": "golang:1.15",
|
|
||||||
"commands": [
|
|
||||||
"./release/linux/%s/drone-matrix --help" % (arch),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
if ctx.build.event != "pull_request":
|
|
||||||
steps.append({
|
|
||||||
"name": "docker",
|
|
||||||
"image": "plugins/docker",
|
|
||||||
"settings": {
|
|
||||||
"dockerfile": "docker/Dockerfile.linux.%s" % (arch),
|
|
||||||
"repo": "plugins/matrix",
|
|
||||||
"username": {
|
|
||||||
"from_secret": "docker_username",
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"from_secret": "docker_password",
|
|
||||||
},
|
|
||||||
"auto_tag": True,
|
|
||||||
"auto_tag_suffix": "linux-%s" % (arch),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "docker",
|
|
||||||
"name": "linux-%s" % (arch),
|
|
||||||
"platform": {
|
|
||||||
"os": "linux",
|
|
||||||
"arch": arch,
|
|
||||||
},
|
|
||||||
"steps": steps,
|
|
||||||
"depends_on": [],
|
|
||||||
"trigger": {
|
|
||||||
"ref": [
|
|
||||||
"refs/heads/master",
|
|
||||||
"refs/tags/**",
|
|
||||||
"refs/pull/**",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def windows(ctx, version):
|
|
||||||
docker = [
|
|
||||||
"echo $env:PASSWORD | docker login --username $env:USERNAME --password-stdin",
|
|
||||||
]
|
|
||||||
|
|
||||||
if ctx.build.event == "tag":
|
|
||||||
build = [
|
|
||||||
'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/windows/amd64/drone-matrix.exe ./cmd/drone-matrix' % (ctx.build.ref.replace("refs/tags/v", "")),
|
|
||||||
]
|
|
||||||
|
|
||||||
docker = docker + [
|
|
||||||
"docker build --pull -f docker/Dockerfile.windows.%s -t plugins/matrix:%s-windows-%s-amd64 ." % (version, ctx.build.ref.replace("refs/tags/v", ""), version),
|
|
||||||
"docker run --rm plugins/matrix:%s-windows-%s-amd64 --help" % (ctx.build.ref.replace("refs/tags/v", ""), version),
|
|
||||||
"docker push plugins/matrix:%s-windows-%s-amd64" % (ctx.build.ref.replace("refs/tags/v", ""), version),
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
build = [
|
|
||||||
'go build -v -ldflags "-X main.version=%s" -a -tags netgo -o release/windows/amd64/drone-matrix.exe ./cmd/drone-matrix' % (ctx.build.commit[0:8]),
|
|
||||||
]
|
|
||||||
|
|
||||||
docker = docker + [
|
|
||||||
"docker build --pull -f docker/Dockerfile.windows.%s -t plugins/matrix:windows-%s-amd64 ." % (version, version),
|
|
||||||
"docker run --rm plugins/matrix:windows-%s-amd64 --help" % (version),
|
|
||||||
"docker push plugins/matrix:windows-%s-amd64" % (version),
|
|
||||||
]
|
|
||||||
|
|
||||||
return {
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "ssh",
|
|
||||||
"name": "windows-%s" % (version),
|
|
||||||
"platform": {
|
|
||||||
"os": "windows",
|
|
||||||
},
|
|
||||||
"server": {
|
|
||||||
"host": {
|
|
||||||
"from_secret": "windows_server_%s" % (version),
|
|
||||||
},
|
|
||||||
"user": {
|
|
||||||
"from_secret": "windows_username",
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"from_secret": "windows_password",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "environment",
|
|
||||||
"environment": {
|
|
||||||
"CGO_ENABLED": "0",
|
|
||||||
},
|
|
||||||
"commands": [
|
|
||||||
"go version",
|
|
||||||
"go env",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "build",
|
|
||||||
"environment": {
|
|
||||||
"CGO_ENABLED": "0",
|
|
||||||
},
|
|
||||||
"commands": build,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "executable",
|
|
||||||
"commands": [
|
|
||||||
"./release/windows/amd64/drone-matrix.exe --help",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "docker",
|
|
||||||
"environment": {
|
|
||||||
"USERNAME": {
|
|
||||||
"from_secret": "docker_username",
|
|
||||||
},
|
|
||||||
"PASSWORD": {
|
|
||||||
"from_secret": "docker_password",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"commands": docker,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"depends_on": [],
|
|
||||||
"trigger": {
|
|
||||||
"ref": [
|
|
||||||
"refs/heads/master",
|
|
||||||
"refs/tags/**",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def manifest(ctx):
|
|
||||||
return [{
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "docker",
|
|
||||||
"name": "manifest",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "manifest",
|
|
||||||
"image": "plugins/manifest",
|
|
||||||
"settings": {
|
|
||||||
"auto_tag": "true",
|
|
||||||
"username": {
|
|
||||||
"from_secret": "docker_username",
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"from_secret": "docker_password",
|
|
||||||
},
|
|
||||||
"spec": "docker/manifest.tmpl",
|
|
||||||
"ignore_missing": "true",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "microbadger",
|
|
||||||
"image": "plugins/webhook",
|
|
||||||
"settings": {
|
|
||||||
"urls": {
|
|
||||||
"from_secret": "microbadger_url",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"depends_on": [],
|
|
||||||
"trigger": {
|
|
||||||
"ref": [
|
|
||||||
"refs/heads/master",
|
|
||||||
"refs/tags/**",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}]
|
|
||||||
|
|
||||||
def gitter(ctx):
|
|
||||||
return [{
|
|
||||||
"kind": "pipeline",
|
|
||||||
"type": "docker",
|
|
||||||
"name": "gitter",
|
|
||||||
"clone": {
|
|
||||||
"disable": True,
|
|
||||||
},
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "gitter",
|
|
||||||
"image": "plugins/gitter",
|
|
||||||
"settings": {
|
|
||||||
"webhook": {
|
|
||||||
"from_secret": "gitter_webhook",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"depends_on": [
|
|
||||||
"manifest",
|
|
||||||
],
|
|
||||||
"trigger": {
|
|
||||||
"ref": [
|
|
||||||
"refs/heads/master",
|
|
||||||
"refs/tags/**",
|
|
||||||
],
|
|
||||||
"status": [
|
|
||||||
"failure",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}]
|
|
477
.drone.yml
Normal file
477
.drone.yml
Normal file
@ -0,0 +1,477 @@
|
|||||||
|
---
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
kind: pipeline
|
||||||
|
name: test
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- commands:
|
||||||
|
- go run honnef.co/go/tools/cmd/staticcheck ./...
|
||||||
|
image: golang:1.16
|
||||||
|
name: staticcheck
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
- commands:
|
||||||
|
- go run golang.org/x/lint/golint -set_exit_status ./...
|
||||||
|
image: golang:1.16
|
||||||
|
name: lint
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
- commands:
|
||||||
|
- go vet ./...
|
||||||
|
image: golang:1.16
|
||||||
|
name: vet
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
- commands:
|
||||||
|
- go test -cover ./...
|
||||||
|
image: golang:1.16
|
||||||
|
name: test
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
temp: {}
|
||||||
|
---
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
kind: pipeline
|
||||||
|
name: build-binaries
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- commands:
|
||||||
|
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
|
||||||
|
- mkdir -p release/
|
||||||
|
- cd cmd/drone-matrix && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags
|
||||||
|
netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out drone-matrix
|
||||||
|
.
|
||||||
|
- mv /build/* /drone/src/release/
|
||||||
|
- ls -l /drone/src/release/
|
||||||
|
image: techknowlogick/xgo:go-1.16.x
|
||||||
|
name: build
|
||||||
|
- commands:
|
||||||
|
- $(find release/ -executable -type f | grep drone-matrix-linux-amd64) --help
|
||||||
|
image: alpine
|
||||||
|
name: executable
|
||||||
|
- commands:
|
||||||
|
- apk add upx
|
||||||
|
- find release/ -maxdepth 1 -executable -type f -exec upx {} \;
|
||||||
|
- ls -lh release/
|
||||||
|
image: alpine
|
||||||
|
name: compress
|
||||||
|
- commands:
|
||||||
|
- cd release/ && sha256sum * > sha256sum.txt
|
||||||
|
image: alpine
|
||||||
|
name: checksum
|
||||||
|
- commands:
|
||||||
|
- git fetch -tq
|
||||||
|
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased
|
||||||
|
unreleased}
|
||||||
|
image: thegeeklab/git-chglog
|
||||||
|
name: changelog-generate
|
||||||
|
- commands:
|
||||||
|
- prettier CHANGELOG.md
|
||||||
|
- prettier -w CHANGELOG.md
|
||||||
|
image: thegeeklab/alpine-tools
|
||||||
|
name: changelog-format
|
||||||
|
- image: plugins/github-release
|
||||||
|
name: publish
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: github_token
|
||||||
|
files:
|
||||||
|
- release/*
|
||||||
|
note: CHANGELOG.md
|
||||||
|
overwrite: true
|
||||||
|
title: ${DRONE_TAG}
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/tags/**
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
---
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
kind: pipeline
|
||||||
|
name: build-container-amd64
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- commands:
|
||||||
|
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
|
||||||
|
- go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/amd64/drone-matrix
|
||||||
|
./cmd/drone-matrix
|
||||||
|
image: golang:1.16
|
||||||
|
name: build
|
||||||
|
- depends_on:
|
||||||
|
- build
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: dryrun
|
||||||
|
settings:
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.amd64
|
||||||
|
dry_run: true
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/pull/**
|
||||||
|
- depends_on:
|
||||||
|
- dryrun
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: publish-dockerhub
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: amd64
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.amd64
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- depends_on:
|
||||||
|
- dryrun
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: publish-quay
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: amd64
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.amd64
|
||||||
|
password:
|
||||||
|
from_secret: quay_password
|
||||||
|
registry: quay.io
|
||||||
|
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: quay_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
---
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
kind: pipeline
|
||||||
|
name: build-container-arm64
|
||||||
|
platform:
|
||||||
|
arch: arm64
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- commands:
|
||||||
|
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
|
||||||
|
- go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm64/drone-matrix
|
||||||
|
./cmd/drone-matrix
|
||||||
|
image: golang:1.16
|
||||||
|
name: build
|
||||||
|
- depends_on:
|
||||||
|
- build
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: dryrun
|
||||||
|
settings:
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.arm64
|
||||||
|
dry_run: true
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/pull/**
|
||||||
|
- depends_on:
|
||||||
|
- dryrun
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: publish-dockerhub
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: arm64
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.arm64
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- depends_on:
|
||||||
|
- dryrun
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: publish-quay
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: arm64
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.arm64
|
||||||
|
password:
|
||||||
|
from_secret: quay_password
|
||||||
|
registry: quay.io
|
||||||
|
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: quay_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
---
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
kind: pipeline
|
||||||
|
name: build-container-arm
|
||||||
|
platform:
|
||||||
|
arch: arm
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- commands:
|
||||||
|
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
|
||||||
|
- go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm/drone-matrix
|
||||||
|
./cmd/drone-matrix
|
||||||
|
image: golang:1.16
|
||||||
|
name: build
|
||||||
|
- depends_on:
|
||||||
|
- build
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: dryrun
|
||||||
|
settings:
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.arm
|
||||||
|
dry_run: true
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/pull/**
|
||||||
|
- depends_on:
|
||||||
|
- dryrun
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: publish-dockerhub
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: arm
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.arm
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- depends_on:
|
||||||
|
- dryrun
|
||||||
|
image: thegeeklab/drone-docker:19
|
||||||
|
name: publish-quay
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: arm
|
||||||
|
config:
|
||||||
|
from_secret: docker_config
|
||||||
|
dockerfile: docker/Dockerfile.arm
|
||||||
|
password:
|
||||||
|
from_secret: quay_password
|
||||||
|
registry: quay.io
|
||||||
|
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: quay_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
---
|
||||||
|
concurrency:
|
||||||
|
limit: 1
|
||||||
|
depends_on:
|
||||||
|
- build-binaries
|
||||||
|
- build-container-amd64
|
||||||
|
- build-container-arm64
|
||||||
|
- build-container-arm
|
||||||
|
kind: pipeline
|
||||||
|
name: docs
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- commands:
|
||||||
|
- markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
|
||||||
|
image: thegeeklab/markdownlint-cli
|
||||||
|
name: markdownlint
|
||||||
|
- commands:
|
||||||
|
- npm install -g spellchecker-cli
|
||||||
|
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary
|
||||||
|
-p spell indefinite-article syntax-urls --no-suggestions
|
||||||
|
environment:
|
||||||
|
FORCE_COLOR: true
|
||||||
|
NPM_CONFIG_LOGLEVEL: error
|
||||||
|
image: node:lts-alpine
|
||||||
|
name: spellcheck
|
||||||
|
- image: plugins/gh-pages
|
||||||
|
name: publish
|
||||||
|
settings:
|
||||||
|
pages_directory: _docs/
|
||||||
|
password:
|
||||||
|
from_secret: github_token
|
||||||
|
target_branch: docs
|
||||||
|
username:
|
||||||
|
from_secret: github_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
---
|
||||||
|
depends_on:
|
||||||
|
- docs
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
kind: pipeline
|
||||||
|
name: notifications
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- image: plugins/manifest
|
||||||
|
name: manifest-dockerhub
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
spec: docker/manifest.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- image: plugins/manifest
|
||||||
|
name: manifest-quay
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
password:
|
||||||
|
from_secret: quay_password
|
||||||
|
spec: docker/manifest-quay.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: quay_username
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- environment:
|
||||||
|
DOCKER_PASS:
|
||||||
|
from_secret: docker_password
|
||||||
|
DOCKER_USER:
|
||||||
|
from_secret: docker_username
|
||||||
|
PUSHRM_FILE: README.md
|
||||||
|
PUSHRM_SHORT: Drone plugin to to send messages to Matrix
|
||||||
|
PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
image: chko/docker-pushrm:1
|
||||||
|
name: pushrm-dockerhub
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- environment:
|
||||||
|
APIKEY__QUAY_IO:
|
||||||
|
from_secret: quay_token
|
||||||
|
PUSHRM_FILE: README.md
|
||||||
|
PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
||||||
|
image: chko/docker-pushrm:1
|
||||||
|
name: pushrm-quay
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- image: plugins/matrix
|
||||||
|
name: matrix
|
||||||
|
settings:
|
||||||
|
homeserver:
|
||||||
|
from_secret: matrix_homeserver
|
||||||
|
password:
|
||||||
|
from_secret: matrix_password
|
||||||
|
roomid:
|
||||||
|
from_secret: matrix_roomid
|
||||||
|
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name
|
||||||
|
}}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message:
|
||||||
|
{{ build.message }}'
|
||||||
|
username:
|
||||||
|
from_secret: matrix_username
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/main
|
||||||
|
- refs/tags/**
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
---
|
||||||
|
kind: signature
|
||||||
|
hmac: 2a628319305f254a9f63d020eb220a5154b770c0da48a8c33ab944df476abade
|
||||||
|
|
||||||
|
...
|
9
.github/issue_template.md
vendored
9
.github/issue_template.md
vendored
@ -1,9 +0,0 @@
|
|||||||
<!-- PLEASE READ BEFORE DELETING
|
|
||||||
|
|
||||||
Bugs or Issues? Due to the high number of false positive issues we receive,
|
|
||||||
please do not create a GitHub issue until you have discussed and verified
|
|
||||||
with community support at:
|
|
||||||
|
|
||||||
https://discourse.drone.io/
|
|
||||||
|
|
||||||
-->
|
|
0
.github/pull_request_template.md
vendored
0
.github/pull_request_template.md
vendored
48
.github/settings.yml
vendored
48
.github/settings.yml
vendored
@ -1,15 +1,15 @@
|
|||||||
repository:
|
repository:
|
||||||
name: drone-matrix
|
name: drone-matrix
|
||||||
description: Drone plugin for sending Matrix notifications
|
description: Drone plugin to add comments to GitHub Issues and Pull Requests
|
||||||
homepage: http://plugins.drone.io/drone-plugins/drone-matrix
|
homepage: https://drone-plugin-index.geekdocs.de/plugins/drone-matrix
|
||||||
topics: drone, drone-plugin
|
topics: drone, drone-plugin
|
||||||
|
|
||||||
private: false
|
private: false
|
||||||
has_issues: true
|
has_issues: true
|
||||||
has_wiki: false
|
has_wiki: false
|
||||||
has_downloads: false
|
has_downloads: true
|
||||||
|
|
||||||
default_branch: master
|
default_branch: main
|
||||||
|
|
||||||
allow_squash_merge: true
|
allow_squash_merge: true
|
||||||
allow_merge_commit: true
|
allow_merge_commit: true
|
||||||
@ -19,6 +19,9 @@ labels:
|
|||||||
- name: bug
|
- name: bug
|
||||||
color: d73a4a
|
color: d73a4a
|
||||||
description: Something isn't working
|
description: Something isn't working
|
||||||
|
- name: documentation
|
||||||
|
color: 0075ca
|
||||||
|
description: Improvements or additions to documentation
|
||||||
- name: duplicate
|
- name: duplicate
|
||||||
color: cfd3d7
|
color: cfd3d7
|
||||||
description: This issue or pull request already exists
|
description: This issue or pull request already exists
|
||||||
@ -37,41 +40,26 @@ labels:
|
|||||||
- name: question
|
- name: question
|
||||||
color: d876e3
|
color: d876e3
|
||||||
description: Further information is requested
|
description: Further information is requested
|
||||||
- name: renovate
|
|
||||||
color: e99695
|
|
||||||
description: Automated action from Renovate
|
|
||||||
- name: wontfix
|
- name: wontfix
|
||||||
color: ffffff
|
color: ffffff
|
||||||
description: This will not be worked on
|
description: This will not be worked on
|
||||||
|
|
||||||
teams:
|
|
||||||
- name: Admins
|
|
||||||
permission: admin
|
|
||||||
- name: Captain
|
|
||||||
permission: admin
|
|
||||||
- name: Maintainers
|
|
||||||
permission: push
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
- name: master
|
- name: main
|
||||||
protection:
|
protection:
|
||||||
required_pull_request_reviews:
|
required_pull_request_reviews: null
|
||||||
required_approving_review_count: 1
|
|
||||||
dismiss_stale_reviews: false
|
|
||||||
require_code_owner_reviews: false
|
|
||||||
dismissal_restrictions:
|
|
||||||
teams:
|
|
||||||
- Admins
|
|
||||||
- Captain
|
|
||||||
required_status_checks:
|
required_status_checks:
|
||||||
strict: true
|
strict: false
|
||||||
contexts:
|
contexts:
|
||||||
- continuous-integration/drone/pr
|
- continuous-integration/drone/pr
|
||||||
enforce_admins: false
|
enforce_admins: null
|
||||||
|
restrictions: null
|
||||||
|
- name: docs
|
||||||
|
protection:
|
||||||
|
required_pull_request_reviews: null
|
||||||
|
required_status_checks: null
|
||||||
|
enforce_admins: true
|
||||||
restrictions:
|
restrictions:
|
||||||
apps:
|
|
||||||
- renovate
|
|
||||||
users: []
|
users: []
|
||||||
teams:
|
teams:
|
||||||
- Admins
|
- bot
|
||||||
- Maintainers
|
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,4 +2,4 @@
|
|||||||
/drone-matrix*
|
/drone-matrix*
|
||||||
|
|
||||||
coverage.out
|
coverage.out
|
||||||
.drone.yml
|
CHANGELOG.md
|
||||||
|
6
.markdownlint.yml
Normal file
6
.markdownlint.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
default: True
|
||||||
|
MD013: False
|
||||||
|
MD041: False
|
||||||
|
MD004:
|
||||||
|
style: dash
|
2
.prettierignore
Normal file
2
.prettierignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.drone.yml
|
||||||
|
*.tpl.md
|
31
CONTRIBUTING.md
Normal file
31
CONTRIBUTING.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
If you think you have found a **security issue**, please do not mention it in this repository.
|
||||||
|
Instead, send an email to security@thegeeklab.de with as many details as possible so it can be handled confidential.
|
||||||
|
|
||||||
|
## Bug Reports and Feature Requests
|
||||||
|
|
||||||
|
If you have found a **bug** or have a **feature request** please use the search first in case a similar issue already exists.
|
||||||
|
If not, please create an issue in this repository
|
||||||
|
|
||||||
|
## Code
|
||||||
|
|
||||||
|
If you would like to fix a bug or implement a feature, please fork the repository and create a Pull Request.
|
||||||
|
|
||||||
|
Before you start any Pull Request, it is recommended that you create an issue to discuss first if you have any
|
||||||
|
doubts about requirement or implementation. That way you can be sure that the maintainer(s) agree on what to change and how,
|
||||||
|
and you can hopefully get a quick merge afterwards.
|
||||||
|
|
||||||
|
Pull Requests can only be merged once all status checks are green.
|
||||||
|
|
||||||
|
## Do not force push to your Pull Request branch
|
||||||
|
|
||||||
|
Please do not force push to your Pull Requests branch after you have created your Pull Request, as doing so makes it harder for us to review your work.
|
||||||
|
Pull Requests will always be squashed by us when we merge your work. Commit as many times as you need in your Pull Request branch.
|
||||||
|
|
||||||
|
## Re-requesting a review
|
||||||
|
|
||||||
|
Please do not ping your reviewer(s) by mentioning them in a new comment. Instead, use the re-request review functionality.
|
||||||
|
Read more about this in the [GitHub docs, Re-requesting a review](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request#re-requesting-a-review).
|
5
LICENSE
5
LICENSE
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
@ -178,7 +179,7 @@
|
|||||||
APPENDIX: How to apply the Apache License to your work.
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
To apply the Apache License to your work, attach the following
|
||||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
replaced with your own identifying information. (Don't include
|
replaced with your own identifying information. (Don't include
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
comment syntax for the file format. We also recommend that a
|
comment syntax for the file format. We also recommend that a
|
||||||
@ -186,7 +187,7 @@
|
|||||||
same "printed page" as the copyright notice for easier
|
same "printed page" as the copyright notice for easier
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright {yyyy} {name of copyright owner}
|
Copyright 2021 Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
53
README.md
53
README.md
@ -1,47 +1,22 @@
|
|||||||
# drone-matrix
|
# drone-matrix
|
||||||
|
|
||||||
[![Build Status](http://cloud.drone.io/api/badges/drone-plugins/drone-matrix/status.svg)](http://cloud.drone.io/drone-plugins/drone-matrix)
|
Drone plugin to to send messages to Matrix
|
||||||
[![Gitter chat](https://badges.gitter.im/drone/drone.png)](https://gitter.im/drone/drone)
|
|
||||||
[![Join the discussion at https://discourse.drone.io](https://img.shields.io/badge/discourse-forum-orange.svg)](https://discourse.drone.io)
|
|
||||||
[![Drone questions at https://stackoverflow.com](https://img.shields.io/badge/drone-stackoverflow-orange.svg)](https://stackoverflow.com/questions/tagged/drone.io)
|
|
||||||
[![](https://images.microbadger.com/badges/image/plugins/matrix.svg)](https://microbadger.com/images/plugins/matrix "Get your own image badge on microbadger.com")
|
|
||||||
[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-matrix?status.svg)](http://godoc.org/github.com/drone-plugins/drone-matrix)
|
|
||||||
[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-matrix)](https://goreportcard.com/report/github.com/drone-plugins/drone-matrix)
|
|
||||||
|
|
||||||
Drone plugin for sending build notifications to [Matrix](https://matrix.org/). 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-matrix/).
|
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-matrix?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-matrix)
|
||||||
|
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-matrix)
|
||||||
|
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-matrix)
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/drone-matrix)](https://goreportcard.com/report/github.com/thegeeklab/drone-matrix)
|
||||||
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/graphs/contributors)
|
||||||
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-matrix)
|
||||||
|
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/blob/main/LICENSE)
|
||||||
|
|
||||||
## Build
|
Drone plugin to to send messages to a Matrix room. You can find the full documentation at You can find the full documentation at [https://drone-plugin-index.geekdocs.de](https://drone-plugin-index.geekdocs.de/plugins/drone-matrix).
|
||||||
|
|
||||||
Build the binary with the following command:
|
## Contributors
|
||||||
|
|
||||||
```console
|
Special thanks goes to all [contributors](https://github.com/thegeeklab/drone-matrix/graphs/contributors). If you would like to contribute,
|
||||||
export GOOS=linux
|
please see the [instructions](https://github.com/thegeeklab/drone-matrix/blob/main/CONTRIBUTING.md).
|
||||||
export GOARCH=amd64
|
|
||||||
export CGO_ENABLED=0
|
|
||||||
export GO111MODULE=on
|
|
||||||
|
|
||||||
go build -v -a -tags netgo -o release/linux/amd64/drone-matrix
|
## License
|
||||||
```
|
|
||||||
|
|
||||||
## Docker
|
This project is licensed under the MIT License - see the [LICENSE](https://github.com/thegeeklab/drone-matrix/blob/main/LICENSE) file for details.
|
||||||
|
|
||||||
Build the Docker image with the following command:
|
|
||||||
|
|
||||||
```console
|
|
||||||
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/matrix .
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```console
|
|
||||||
docker run --rm \
|
|
||||||
-e PLUGIN_ROOMID=0123456789abcdef:matrix.org \
|
|
||||||
-e PLUGIN_USERNAME=yourbot \
|
|
||||||
-e PLUGIN_PASSWORD=p455w0rd \
|
|
||||||
-v $(pwd):$(pwd) \
|
|
||||||
-w $(pwd) \
|
|
||||||
plugins/matrix
|
|
||||||
```
|
|
||||||
|
72
_docs/_index.md
Normal file
72
_docs/_index.md
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
title: drone-docker
|
||||||
|
---
|
||||||
|
|
||||||
|
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-matrix?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-matrix)
|
||||||
|
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-matrix)
|
||||||
|
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-matrix)
|
||||||
|
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/graphs/contributors)
|
||||||
|
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-matrix)
|
||||||
|
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-matrix)](https://github.com/thegeeklab/drone-matrix/blob/main/LICENSE)
|
||||||
|
|
||||||
|
Drone plugin to add comments to GitHub Issues and Pull Requests.
|
||||||
|
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
<!-- spellchecker-disable -->
|
||||||
|
{{< toc >}}
|
||||||
|
<!-- spellchecker-enable -->
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Build the binary with the following command:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
export GOOS=linux
|
||||||
|
export GOARCH=amd64
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-matrix
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the Docker image with the following command:
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-matrix .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker run --rm \
|
||||||
|
-e PLUGIN_ROOMID=0123456789abcdef:matrix.org \
|
||||||
|
-e PLUGIN_USERNAME=yourbot \
|
||||||
|
-e PLUGIN_PASSWORD=p455w0rd \
|
||||||
|
-v $(pwd):$(pwd) \
|
||||||
|
-w $(pwd) \
|
||||||
|
plugins/matrix
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
username
|
||||||
|
: sets username for authentication
|
||||||
|
|
||||||
|
password
|
||||||
|
: sets password for authentication
|
||||||
|
|
||||||
|
user_id
|
||||||
|
: sets userid for authentication
|
||||||
|
|
||||||
|
access_token
|
||||||
|
: sets access token for authentication
|
||||||
|
|
||||||
|
homeserver
|
||||||
|
: sets matrix home server url to use (default `https://matrix.org`)
|
||||||
|
|
||||||
|
roomid
|
||||||
|
: sets roomid to send messages to
|
||||||
|
|
||||||
|
template
|
||||||
|
: sets message template; used default template `build {{ build.status }} [{{ repo.owner }}/{{ repo.name }}#{{ truncate build.commit 8 }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}`
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2020, the Drone Plugins project authors.
|
// Copyright (c) 2020, the Drone Plugins project authors.
|
||||||
// Please see the AUTHORS file for details. All rights reserved.
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
// Use of this source code is governed by an Apache 2.0 license that can be
|
// Use of this source code is governed by an Apache 2.0 license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@ -15,45 +16,45 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "username",
|
Name: "username",
|
||||||
Usage: "username for authentication",
|
|
||||||
EnvVars: []string{"PLUGIN_USERNAME", "MATRIX_USERNAME"},
|
EnvVars: []string{"PLUGIN_USERNAME", "MATRIX_USERNAME"},
|
||||||
|
Usage: "sets username for authentication",
|
||||||
Destination: &settings.Username,
|
Destination: &settings.Username,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "password",
|
Name: "password",
|
||||||
Usage: "password for authentication",
|
|
||||||
EnvVars: []string{"PLUGIN_PASSWORD", "MATRIX_PASSWORD"},
|
EnvVars: []string{"PLUGIN_PASSWORD", "MATRIX_PASSWORD"},
|
||||||
|
Usage: "sets password for authentication",
|
||||||
Destination: &settings.Password,
|
Destination: &settings.Password,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "userid",
|
Name: "userid",
|
||||||
Usage: "userid for authentication",
|
|
||||||
EnvVars: []string{"PLUGIN_USERID,PLUGIN_USER_ID", "MATRIX_USERID", "MATRIX_USER_ID"},
|
EnvVars: []string{"PLUGIN_USERID,PLUGIN_USER_ID", "MATRIX_USERID", "MATRIX_USER_ID"},
|
||||||
|
Usage: "sets userid for authentication",
|
||||||
Destination: &settings.UserID,
|
Destination: &settings.UserID,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "accesstoken",
|
Name: "accesstoken",
|
||||||
Usage: "accesstoken for authentication",
|
|
||||||
EnvVars: []string{"PLUGIN_ACCESSTOKEN,PLUGIN_ACCESS_TOKEN", "MATRIX_ACCESSTOKEN", "MATRIX_ACCESS_TOKEN"},
|
EnvVars: []string{"PLUGIN_ACCESSTOKEN,PLUGIN_ACCESS_TOKEN", "MATRIX_ACCESSTOKEN", "MATRIX_ACCESS_TOKEN"},
|
||||||
|
Usage: "sets access token for authentication",
|
||||||
Destination: &settings.AccessToken,
|
Destination: &settings.AccessToken,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "homeserver",
|
Name: "homeserver",
|
||||||
Usage: "matrix home server",
|
|
||||||
EnvVars: []string{"PLUGIN_HOMESERVER", "MATRIX_HOMESERVER"},
|
EnvVars: []string{"PLUGIN_HOMESERVER", "MATRIX_HOMESERVER"},
|
||||||
|
Usage: "sets matrix home server url to use",
|
||||||
Value: "https://matrix.org",
|
Value: "https://matrix.org",
|
||||||
Destination: &settings.Homeserver,
|
Destination: &settings.Homeserver,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "roomid",
|
Name: "roomid",
|
||||||
Usage: "roomid to send messages",
|
|
||||||
EnvVars: []string{"PLUGIN_ROOMID", "MATRIX_ROOMID"},
|
EnvVars: []string{"PLUGIN_ROOMID", "MATRIX_ROOMID"},
|
||||||
|
Usage: "sets roomid to send messages to",
|
||||||
Destination: &settings.RoomID,
|
Destination: &settings.RoomID,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "template",
|
Name: "template",
|
||||||
Usage: "template for the message",
|
|
||||||
EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"},
|
EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"},
|
||||||
|
Usage: "sets message template",
|
||||||
Value: "Build {{ build.status }} [{{ repo.Owner }}/{{ repo.Name }}#{{ truncate build.commit 8 }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}",
|
Value: "Build {{ build.status }} [{{ repo.Owner }}/{{ repo.Name }}#{{ truncate build.commit 8 }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}",
|
||||||
Destination: &settings.Template,
|
Destination: &settings.Template,
|
||||||
},
|
},
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
// Copyright (c) 2020, the Drone Plugins project authors.
|
// Copyright (c) 2020, the Drone Plugins project authors.
|
||||||
// Please see the AUTHORS file for details. All rights reserved.
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
// Use of this source code is governed by an Apache 2.0 license that can be
|
// Use of this source code is governed by an Apache 2.0 license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// DO NOT MODIFY THIS FILE DIRECTLY
|
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
8
cmd/drone-matrix/tools.go
Normal file
8
cmd/drone-matrix/tools.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// +build tools
|
||||||
|
|
||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "golang.org/x/lint/golint"
|
||||||
|
_ "honnef.co/go/tools/cmd/staticcheck"
|
||||||
|
)
|
11
docker/Dockerfile.amd64
Normal file
11
docker/Dockerfile.amd64
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM alpine:3.14@sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a
|
||||||
|
|
||||||
|
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
LABEL org.opencontainers.image.title="drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
|
||||||
|
ADD release/amd64/drone-matrix /bin/
|
||||||
|
ENTRYPOINT [ "/bin/drone-matrix" ]
|
11
docker/Dockerfile.arm
Normal file
11
docker/Dockerfile.arm
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM arm32v7/alpine:3.14@sha256:e12ff876f0075740ed3d7bdf788107ae84c1b3dd6dc98b3baea41088aba5236f
|
||||||
|
|
||||||
|
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
LABEL org.opencontainers.image.title="drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
|
||||||
|
ADD release/arm/drone-matrix /bin/
|
||||||
|
ENTRYPOINT [ "/bin/drone-matrix" ]
|
11
docker/Dockerfile.arm64
Normal file
11
docker/Dockerfile.arm64
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM arm64v8/alpine:3.14@sha256:b06a5cf61b2956088722c4f1b9a6f71dfe95f0b1fe285d44195452b8a1627de7
|
||||||
|
|
||||||
|
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||||
|
LABEL org.opencontainers.image.title="drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-matrix"
|
||||||
|
|
||||||
|
ADD release/arm64/drone-matrix /bin/
|
||||||
|
ENTRYPOINT [ "/bin/drone-matrix" ]
|
@ -1,9 +0,0 @@
|
|||||||
FROM plugins/base:multiarch
|
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
|
|
||||||
org.label-schema.name="Drone Matrix" \
|
|
||||||
org.label-schema.vendor="Drone.IO Community" \
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
ADD release/linux/amd64/drone-matrix /bin/
|
|
||||||
ENTRYPOINT [ "/bin/drone-matrix" ]
|
|
@ -1,9 +0,0 @@
|
|||||||
FROM plugins/base:multiarch
|
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
|
|
||||||
org.label-schema.name="Drone Matrix" \
|
|
||||||
org.label-schema.vendor="Drone.IO Community" \
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
ADD release/linux/arm/drone-matrix /bin/
|
|
||||||
ENTRYPOINT [ "/bin/drone-matrix" ]
|
|
@ -1,9 +0,0 @@
|
|||||||
FROM plugins/base:multiarch
|
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" \
|
|
||||||
org.label-schema.name="Drone Matrix" \
|
|
||||||
org.label-schema.vendor="Drone.IO Community" \
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
ADD release/linux/arm64/drone-matrix /bin/
|
|
||||||
ENTRYPOINT [ "/bin/drone-matrix" ]
|
|
@ -1,10 +0,0 @@
|
|||||||
# escape=`
|
|
||||||
FROM plugins/base:windows-1809-amd64
|
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
|
||||||
org.label-schema.name="Drone Matrix" `
|
|
||||||
org.label-schema.vendor="Drone.IO Community" `
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
|
|
||||||
ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
|
|
@ -1,10 +0,0 @@
|
|||||||
# escape=`
|
|
||||||
FROM plugins/base:windows-1903-amd64
|
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
|
||||||
org.label-schema.name="Drone Matrix" `
|
|
||||||
org.label-schema.vendor="Drone.IO Community" `
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
|
|
||||||
ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
|
|
@ -1,10 +0,0 @@
|
|||||||
# escape=`
|
|
||||||
FROM plugins/base:windows-1909-amd64
|
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
|
||||||
org.label-schema.name="Drone Matrix" `
|
|
||||||
org.label-schema.vendor="Drone.IO Community" `
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
|
|
||||||
ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
|
|
@ -1,10 +0,0 @@
|
|||||||
# escape=`
|
|
||||||
FROM plugins/base:windows-2004-amd64
|
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
|
||||||
org.label-schema.name="Drone Matrix" `
|
|
||||||
org.label-schema.vendor="Drone.IO Community" `
|
|
||||||
org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
ADD release/windows/amd64/drone-matrix.exe C:/bin/drone-matrix.exe
|
|
||||||
ENTRYPOINT [ "C:\\bin\\drone-matrix.exe" ]
|
|
24
docker/manifest-quay.tmpl
Normal file
24
docker/manifest-quay.tmpl
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
- image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
|
||||||
|
- image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
|
||||||
|
platform:
|
||||||
|
architecture: arm64
|
||||||
|
os: linux
|
||||||
|
variant: v8
|
||||||
|
|
||||||
|
- image: quay.io/thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
@ -1,44 +1,24 @@
|
|||||||
image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
manifests:
|
manifests:
|
||||||
- image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
- image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
- image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
|
||||||
|
- image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
|
||||||
platform:
|
platform:
|
||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
- image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
|
||||||
|
- image: thegeeklab/drone-matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
|
||||||
platform:
|
platform:
|
||||||
architecture: arm
|
architecture: arm
|
||||||
os: linux
|
os: linux
|
||||||
variant: v7
|
variant: v7
|
||||||
- image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-2004-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: windows
|
|
||||||
version: 2004
|
|
||||||
- image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: windows
|
|
||||||
version: 1909
|
|
||||||
- image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: windows
|
|
||||||
version: 1903
|
|
||||||
- image: plugins/matrix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: windows
|
|
||||||
version: 1809
|
|
||||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module github.com/drone-plugins/drone-matrix
|
module github.com/drone-plugins/drone-matrix
|
||||||
|
|
||||||
go 1.15
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/drone-plugins/drone-plugin-lib v0.4.0
|
github.com/drone-plugins/drone-plugin-lib v0.4.0
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2020, the Drone Plugins project authors.
|
// Copyright (c) 2020, the Drone Plugins project authors.
|
||||||
// Please see the AUTHORS file for details. All rights reserved.
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
// Use of this source code is governed by an Apache 2.0 license that can be
|
// Use of this source code is governed by an Apache 2.0 license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2020, the Drone Plugins project authors.
|
// Copyright (c) 2020, the Drone Plugins project authors.
|
||||||
// Please see the AUTHORS file for details. All rights reserved.
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
// Use of this source code is governed by an Apache 2.0 license that can be
|
// Use of this source code is governed by an Apache 2.0 license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2020, the Drone Plugins project authors.
|
// Copyright (c) 2020, the Drone Plugins project authors.
|
||||||
// Please see the AUTHORS file for details. All rights reserved.
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
// Use of this source code is governed by an Apache 2.0 license that can be
|
// Use of this source code is governed by an Apache 2.0 license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2020, the Drone Plugins project authors.
|
// Copyright (c) 2020, the Drone Plugins project authors.
|
||||||
// Please see the AUTHORS file for details. All rights reserved.
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
// Use of this source code is governed by an Apache 2.0 license that can be
|
// Use of this source code is governed by an Apache 2.0 license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -1,26 +1,4 @@
|
|||||||
{
|
{
|
||||||
"extends": [
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"config:base",
|
"extends": ["github>thegeeklab/renovate-presets:golang"]
|
||||||
":automergeMinor",
|
|
||||||
":automergeDigest"
|
|
||||||
],
|
|
||||||
"enabledManagers": [
|
|
||||||
"dockerfile",
|
|
||||||
"gomod"
|
|
||||||
],
|
|
||||||
"dockerfile": {
|
|
||||||
"fileMatch": [
|
|
||||||
"docker/Dockerfile\\.linux\\.(arm|arm64|amd64|multiarch)",
|
|
||||||
"docker/Dockerfile\\.windows\\.(1809|1903|1909|2004)"
|
|
||||||
],
|
|
||||||
"pinDigests": true
|
|
||||||
},
|
|
||||||
"gomod": {
|
|
||||||
"postUpdateOptions": [
|
|
||||||
"gomodTidy"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"labels": [
|
|
||||||
"renovate"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user