ci: switch to drone-matrix plugin (#86)

This commit is contained in:
Robert Kaussow 2021-09-19 22:09:55 +02:00 committed by GitHub
parent 3a167746e4
commit 0159dd5503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 483 additions and 425 deletions

View File

@ -355,11 +355,11 @@ local PipelineNotifications = {
}, },
{ {
name: 'matrix', name: 'matrix',
image: 'plugins/matrix', image: 'thegeeklab/drone-matrix',
settings: { settings: {
homeserver: { from_secret: 'matrix_homeserver' }, homeserver: { from_secret: 'matrix_homeserver' },
roomid: { from_secret: 'matrix_roomid' }, 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 }}', template: 'Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}) ({{ build.Branch }}) by {{ commit.Author }}<br/> Message: {{ commit.Message }}',
username: { from_secret: 'matrix_username' }, username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' }, password: { from_secret: 'matrix_password' },
}, },

View File

@ -1,492 +1,550 @@
--- ---
kind: pipeline kind: pipeline
name: lint name: lint
platform: platform:
arch: amd64
os: linux os: linux
arch: amd64
steps: steps:
- commands: - name: yapf
- git fetch -tq image: python:3.9
- pip install poetry poetry-dynamic-versioning -qq commands:
- poetry config experimental.new-installer false - git fetch -tq
- poetry install - pip install poetry poetry-dynamic-versioning -qq
- poetry run yapf -dr ./gitbatch - poetry config experimental.new-installer false
environment: - poetry install
PY_COLORS: 1 - poetry run yapf -dr ./gitbatch
image: python:3.9 environment:
name: yapf PY_COLORS: 1
- commands:
- git fetch -tq - name: flake8
- pip install poetry poetry-dynamic-versioning -qq image: python:3.9
- poetry config experimental.new-installer false commands:
- poetry install - git fetch -tq
- poetry run flake8 ./gitbatch - pip install poetry poetry-dynamic-versioning -qq
environment: - poetry config experimental.new-installer false
PY_COLORS: 1 - poetry install
image: python:3.9 - poetry run flake8 ./gitbatch
name: flake8 environment:
PY_COLORS: 1
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
--- ---
depends_on:
- lint
kind: pipeline kind: pipeline
name: test name: test
platform: platform:
arch: amd64
os: linux os: linux
arch: amd64
steps: steps:
- commands: - name: fetch
- git fetch -tq image: python:3.9
image: python:3.9 commands:
name: fetch - git fetch -tq
- commands:
- pip install poetry poetry-dynamic-versioning -qq - name: python36-pytest
- poetry config experimental.new-installer false image: python:3.6
- poetry install commands:
- poetry version - pip install poetry poetry-dynamic-versioning -qq
- poetry run git-batch --help - poetry config experimental.new-installer false
depends_on: - poetry install
- fetch - poetry version
environment: - poetry run git-batch --help
PY_COLORS: 1 environment:
image: python:3.6 PY_COLORS: 1
name: python36-pytest depends_on:
- commands: - fetch
- pip install poetry poetry-dynamic-versioning -qq
- poetry config experimental.new-installer false - name: python37-pytest
- poetry install image: python:3.7
- poetry version commands:
- poetry run git-batch --help - pip install poetry poetry-dynamic-versioning -qq
depends_on: - poetry config experimental.new-installer false
- fetch - poetry install
environment: - poetry version
PY_COLORS: 1 - poetry run git-batch --help
image: python:3.7 environment:
name: python37-pytest PY_COLORS: 1
- commands: depends_on:
- pip install poetry poetry-dynamic-versioning -qq - fetch
- poetry config experimental.new-installer false
- poetry install - name: python38-pytest
- poetry version image: python:3.8
- poetry run git-batch --help commands:
depends_on: - pip install poetry poetry-dynamic-versioning -qq
- fetch - poetry config experimental.new-installer false
environment: - poetry install
PY_COLORS: 1 - poetry version
image: python:3.8 - poetry run git-batch --help
name: python38-pytest environment:
- commands: PY_COLORS: 1
- pip install poetry poetry-dynamic-versioning -qq depends_on:
- poetry config experimental.new-installer false - fetch
- poetry install
- poetry version - name: python39-pytest
- poetry run git-batch --help image: python:3.9
depends_on: commands:
- fetch - pip install poetry poetry-dynamic-versioning -qq
environment: - poetry config experimental.new-installer false
PY_COLORS: 1 - poetry install
image: python:3.9 - poetry version
name: python39-pytest - poetry run git-batch --help
environment:
PY_COLORS: 1
depends_on:
- fetch
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- test - lint
---
kind: pipeline kind: pipeline
name: security name: security
platform: platform:
arch: amd64
os: linux os: linux
arch: amd64
steps: steps:
- commands: - name: bandit
- git fetch -tq image: python:3.9
- pip install poetry poetry-dynamic-versioning -qq commands:
- poetry config experimental.new-installer false - git fetch -tq
- poetry install - pip install poetry poetry-dynamic-versioning -qq
- poetry run bandit -r ./gitbatch -x ./gitbatch/test - poetry config experimental.new-installer false
environment: - poetry install
PY_COLORS: 1 - poetry run bandit -r ./gitbatch -x ./gitbatch/test
image: python:3.9 environment:
name: bandit PY_COLORS: 1
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- security - test
---
kind: pipeline kind: pipeline
name: build-package name: build-package
platform: platform:
arch: amd64
os: linux os: linux
arch: amd64
steps: steps:
- commands: - name: build
- git fetch -tq image: python:3.9
- pip install poetry poetry-dynamic-versioning -qq commands:
- poetry build - git fetch -tq
image: python:3.9 - pip install poetry poetry-dynamic-versioning -qq
name: build - poetry build
- commands:
- cd dist/ && sha256sum * > ../sha256sum.txt - name: checksum
image: alpine image: alpine
name: checksum commands:
- commands: - cd dist/ && sha256sum * > ../sha256sum.txt
- git fetch -tq
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased - name: changelog-generate
unreleased} image: thegeeklab/git-chglog
image: thegeeklab/git-chglog commands:
name: changelog-generate - git fetch -tq
- commands: - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
- prettier CHANGELOG.md
- prettier -w CHANGELOG.md - name: changelog-format
image: thegeeklab/alpine-tools image: thegeeklab/alpine-tools
name: changelog-format commands:
- image: plugins/github-release - prettier CHANGELOG.md
name: publish-github - prettier -w CHANGELOG.md
settings:
api_key: - name: publish-github
from_secret: github_token image: plugins/github-release
files: settings:
- dist/* api_key:
- sha256sum.txt from_secret: github_token
note: CHANGELOG.md files:
overwrite: true - dist/*
title: ${DRONE_TAG} - sha256sum.txt
when: note: CHANGELOG.md
ref: overwrite: true
- refs/tags/** title: ${DRONE_TAG}
- commands: when:
- git fetch -tq ref:
- pip install poetry poetry-dynamic-versioning -qq - refs/tags/**
- poetry publish -n
environment: - name: publish-pypi
POETRY_HTTP_BASIC_PYPI_PASSWORD: image: python:3.9
from_secret: pypi_password commands:
POETRY_HTTP_BASIC_PYPI_USERNAME: - git fetch -tq
from_secret: pypi_username - pip install poetry poetry-dynamic-versioning -qq
image: python:3.9 - poetry publish -n
name: publish-pypi environment:
when: POETRY_HTTP_BASIC_PYPI_PASSWORD:
ref: from_secret: pypi_password
- refs/tags/** POETRY_HTTP_BASIC_PYPI_USERNAME:
from_secret: pypi_username
when:
ref:
- refs/tags/**
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- security - security
---
kind: pipeline kind: pipeline
name: build-container-amd64 name: build-container-amd64
platform: platform:
arch: amd64
os: linux os: linux
arch: amd64
steps: steps:
- commands: - name: build
- git fetch -tq image: python:3.9
- pip install poetry poetry-dynamic-versioning -qq commands:
- poetry build - git fetch -tq
image: python:3.9 - pip install poetry poetry-dynamic-versioning -qq
name: build - poetry build
- depends_on:
- build - name: dryrun
image: thegeeklab/drone-docker:19 image: thegeeklab/drone-docker:19
name: dryrun settings:
settings: dockerfile: docker/Dockerfile.amd64
dockerfile: docker/Dockerfile.amd64 dry_run: true
dry_run: true password:
password: from_secret: docker_password
from_secret: docker_password repo: thegeeklab/${DRONE_REPO_NAME}
repo: thegeeklab/${DRONE_REPO_NAME} username:
username: from_secret: docker_username
from_secret: docker_username when:
when: ref:
ref: - refs/pull/**
- refs/pull/** depends_on:
- depends_on: - build
- dryrun
image: thegeeklab/drone-docker:19 - name: publish-dockerhub
name: publish-dockerhub image: thegeeklab/drone-docker:19
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: amd64 auto_tag_suffix: amd64
dockerfile: docker/Dockerfile.amd64 dockerfile: docker/Dockerfile.amd64
password: password:
from_secret: docker_password from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME} repo: thegeeklab/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- depends_on: depends_on:
- dryrun - dryrun
image: thegeeklab/drone-docker:19
name: publish-quay - name: publish-quay
settings: image: thegeeklab/drone-docker:19
auto_tag: true settings:
auto_tag_suffix: amd64 auto_tag: true
dockerfile: docker/Dockerfile.amd64 auto_tag_suffix: amd64
password: dockerfile: docker/Dockerfile.amd64
from_secret: quay_password password:
registry: quay.io from_secret: quay_password
repo: quay.io/thegeeklab/${DRONE_REPO_NAME} registry: quay.io
username: repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
from_secret: quay_username username:
when: from_secret: quay_username
ref: when:
- refs/heads/main ref:
- refs/tags/** - refs/heads/main
- refs/tags/**
depends_on:
- dryrun
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- security - security
---
kind: pipeline kind: pipeline
name: build-container-arm64 name: build-container-arm64
platform: platform:
arch: arm64
os: linux os: linux
arch: arm64
steps: steps:
- commands: - name: build
- git fetch -tq image: python:3.9
- pip install poetry poetry-dynamic-versioning -qq commands:
- poetry build - git fetch -tq
image: python:3.9 - pip install poetry poetry-dynamic-versioning -qq
name: build - poetry build
- depends_on:
- build - name: dryrun
image: thegeeklab/drone-docker:19 image: thegeeklab/drone-docker:19
name: dryrun settings:
settings: dockerfile: docker/Dockerfile.arm64
dockerfile: docker/Dockerfile.arm64 dry_run: true
dry_run: true password:
password: from_secret: docker_password
from_secret: docker_password repo: thegeeklab/${DRONE_REPO_NAME}
repo: thegeeklab/${DRONE_REPO_NAME} username:
username: from_secret: docker_username
from_secret: docker_username when:
when: ref:
ref: - refs/pull/**
- refs/pull/** depends_on:
- depends_on: - build
- dryrun
image: thegeeklab/drone-docker:19 - name: publish-dockerhub
name: publish-dockerhub image: thegeeklab/drone-docker:19
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm64 auto_tag_suffix: arm64
dockerfile: docker/Dockerfile.arm64 dockerfile: docker/Dockerfile.arm64
password: password:
from_secret: docker_password from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME} repo: thegeeklab/${DRONE_REPO_NAME}
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- depends_on: depends_on:
- dryrun - dryrun
image: thegeeklab/drone-docker:19
name: publish-quay - name: publish-quay
settings: image: thegeeklab/drone-docker:19
auto_tag: true settings:
auto_tag_suffix: arm64 auto_tag: true
dockerfile: docker/Dockerfile.arm64 auto_tag_suffix: arm64
password: dockerfile: docker/Dockerfile.arm64
from_secret: quay_password password:
registry: quay.io from_secret: quay_password
repo: quay.io/thegeeklab/${DRONE_REPO_NAME} registry: quay.io
username: repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
from_secret: quay_username username:
when: from_secret: quay_username
ref: when:
- refs/heads/main ref:
- refs/tags/** - refs/heads/main
- refs/tags/**
depends_on:
- dryrun
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- security - security
---
kind: pipeline kind: pipeline
name: build-container-arm name: build-container-arm
platform: platform:
arch: arm
os: linux os: linux
arch: arm
steps: steps:
- commands: - name: build
- apk add -Uq --no-cache build-base openssl-dev libffi-dev musl-dev python3-dev image: python:3.9-alpine
git cargo commands:
- git fetch -tq - apk add -Uq --no-cache build-base openssl-dev libffi-dev musl-dev python3-dev git cargo
- pip install poetry poetry-dynamic-versioning -qq - git fetch -tq
- poetry build - pip install poetry poetry-dynamic-versioning -qq
environment: - poetry build
CARGO_NET_GIT_FETCH_WITH_CLI: true environment:
image: python:3.9-alpine CARGO_NET_GIT_FETCH_WITH_CLI: true
name: build
- depends_on: - name: dryrun
- build image: thegeeklab/drone-docker:19
image: thegeeklab/drone-docker:19 settings:
name: dryrun dockerfile: docker/Dockerfile.arm
settings: dry_run: true
dockerfile: docker/Dockerfile.arm password:
dry_run: true from_secret: docker_password
password: repo: thegeeklab/${DRONE_REPO_NAME}
from_secret: docker_password username:
repo: thegeeklab/${DRONE_REPO_NAME} from_secret: docker_username
username: when:
from_secret: docker_username ref:
when: - refs/pull/**
ref: depends_on:
- refs/pull/** - build
- depends_on:
- dryrun - name: publish-dockerhub
image: thegeeklab/drone-docker:19 image: thegeeklab/drone-docker:19
name: publish-dockerhub settings:
settings: auto_tag: true
auto_tag: true auto_tag_suffix: arm
auto_tag_suffix: arm dockerfile: docker/Dockerfile.arm
dockerfile: docker/Dockerfile.arm password:
password: from_secret: docker_password
from_secret: docker_password repo: thegeeklab/${DRONE_REPO_NAME}
repo: thegeeklab/${DRONE_REPO_NAME} username:
username: from_secret: docker_username
from_secret: docker_username when:
when: ref:
ref: - refs/heads/main
- refs/heads/main - refs/tags/**
- refs/tags/** depends_on:
- depends_on: - dryrun
- dryrun
image: thegeeklab/drone-docker:19 - name: publish-quay
name: publish-quay image: thegeeklab/drone-docker:19
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm auto_tag_suffix: arm
dockerfile: docker/Dockerfile.arm dockerfile: docker/Dockerfile.arm
password: password:
from_secret: quay_password from_secret: quay_password
registry: quay.io registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME} repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username: username:
from_secret: quay_username from_secret: quay_username
when: when:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
depends_on:
- dryrun
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- build-package - security
- build-container-amd64
- build-container-arm64 ---
- build-container-arm
kind: pipeline kind: pipeline
name: notifications name: notifications
platform: platform:
arch: amd64
os: linux os: linux
arch: amd64
steps: steps:
- image: plugins/manifest - name: manifest-dockerhub
name: manifest-dockerhub image: plugins/manifest
settings: settings:
auto_tag: true auto_tag: true
ignore_missing: true ignore_missing: true
password: password:
from_secret: docker_password from_secret: docker_password
spec: docker/manifest.tmpl spec: docker/manifest.tmpl
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
status: status:
- success - success
- image: plugins/manifest
name: manifest-quay - name: manifest-quay
settings: image: plugins/manifest
auto_tag: true settings:
ignore_missing: true auto_tag: true
password: ignore_missing: true
from_secret: quay_password password:
spec: docker/manifest-quay.tmpl from_secret: quay_password
username: spec: docker/manifest-quay.tmpl
from_secret: quay_username username:
when: from_secret: quay_username
status: when:
- success status:
- environment: - success
DOCKER_PASS:
from_secret: docker_password - name: pushrm-dockerhub
DOCKER_USER: pull: always
from_secret: docker_username image: chko/docker-pushrm:1
PUSHRM_FILE: README.md environment:
PUSHRM_SHORT: GitHub release notification bot DOCKER_PASS:
PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} from_secret: docker_password
image: chko/docker-pushrm:1 DOCKER_USER:
name: pushrm-dockerhub from_secret: docker_username
pull: always PUSHRM_FILE: README.md
when: PUSHRM_SHORT: GitHub release notification bot
status: PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
- success when:
- environment: status:
APIKEY__QUAY_IO: - success
from_secret: quay_token
PUSHRM_FILE: README.md - name: pushrm-quay
PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME} pull: always
image: chko/docker-pushrm:1 image: chko/docker-pushrm:1
name: pushrm-quay environment:
pull: always APIKEY__QUAY_IO:
when: from_secret: quay_token
status: PUSHRM_FILE: README.md
- success PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
- image: plugins/matrix when:
name: matrix status:
settings: - success
homeserver:
from_secret: matrix_homeserver - name: matrix
password: image: thegeeklab/drone-matrix
from_secret: matrix_password settings:
roomid: homeserver:
from_secret: matrix_roomid from_secret: matrix_homeserver
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name password:
}}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: from_secret: matrix_password
{{ build.message }}' roomid:
username: from_secret: matrix_roomid
from_secret: matrix_username template: "Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}) ({{ build.Branch }}) by {{ commit.Author }}<br/> Message: {{ commit.Message }}"
when: username:
status: from_secret: matrix_username
- success when:
- failure status:
- success
- failure
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
status: status:
- success - success
- failure - failure
depends_on:
- build-package
- build-container-amd64
- build-container-arm64
- build-container-arm
--- ---
kind: signature kind: signature
hmac: 548dc52e2af22755c3a228b98382e018f85c35607465d8179d7d6d66f9cd3662 hmac: 6a0d10a83b7384ad3767da9f894f7793ffd21bfa91593fd95e1411ce33a64c2a
... ...