From d10ad6d8def0aac7177c09b60094ef2b70ed6fd7 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 22 Aug 2023 09:07:13 +0200 Subject: [PATCH] ci: migrate to woodpecker --- .drone.yml | 231 ------------------ .github/settings.yml | 6 +- .prettierignore | 1 - .woodpecker/build-container.yml | 72 ++++++ .woodpecker/build-package.yml | 41 ++++ .woodpecker/notify.yml | 27 ++ .woodpecker/test.yml | 25 ++ ...rfile.multiarch => Containerfile.multiarch | 2 +- README.md | 2 +- 9 files changed, 171 insertions(+), 236 deletions(-) delete mode 100644 .drone.yml create mode 100644 .woodpecker/build-container.yml create mode 100644 .woodpecker/build-package.yml create mode 100644 .woodpecker/notify.yml create mode 100644 .woodpecker/test.yml rename Dockerfile.multiarch => Containerfile.multiarch (86%) diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 1bc7eb5..0000000 --- a/.drone.yml +++ /dev/null @@ -1,231 +0,0 @@ ---- -kind: pipeline -name: test - -platform: - os: linux - arch: amd64 - -steps: - - name: lint - image: koalaman/shellcheck-alpine:stable - commands: - - shellcheck ./wait-for - - - name: test-nc - image: bats/bats - commands: - - bats ./wait-for.bats - - - name: test-bash - image: bats/bats - commands: - - rm -rf /usr/bin/nc - - bats ./wait-for.bats - -trigger: - ref: - - refs/heads/main - - refs/tags/** - - refs/pull/** - ---- -kind: pipeline -name: build-package - -platform: - os: linux - arch: amd64 - -steps: - - name: checksum - image: alpine - commands: - - sha256sum wait-for > 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-github - image: plugins/github-release - settings: - api_key: - from_secret: github_token - files: - - wait-for - - sha256sum.txt - note: CHANGELOG.md - overwrite: true - title: ${DRONE_TAG} - when: - ref: - - refs/tags/** - -trigger: - ref: - - refs/heads/main - - refs/tags/** - - refs/pull/** - -depends_on: - - test - ---- -kind: pipeline -name: build-container - -platform: - os: linux - arch: amd64 - -steps: - - name: dryrun - image: thegeeklab/drone-docker-buildx:23 - settings: - dockerfile: Dockerfile.multiarch - dry_run: true - platforms: - - linux/amd64 - - linux/arm64 - - linux/arm/v7 - - linux/arm/v6 - provenance: false - repo: thegeeklab/${DRONE_REPO_NAME} - when: - ref: - - refs/pull/** - - - name: publish-dockerhub - image: thegeeklab/drone-docker-buildx:23 - settings: - auto_tag: true - dockerfile: Dockerfile.multiarch - password: - from_secret: docker_password - platforms: - - linux/amd64 - - linux/arm64 - - linux/arm/v7 - - linux/arm/v6 - provenance: false - repo: thegeeklab/${DRONE_REPO_NAME} - username: - from_secret: docker_username - when: - ref: - - refs/heads/main - - refs/tags/** - depends_on: - - dryrun - - - name: publish-quay - image: thegeeklab/drone-docker-buildx:23 - settings: - auto_tag: true - dockerfile: Dockerfile.multiarch - password: - from_secret: quay_password - platforms: - - linux/amd64 - - linux/arm64 - - linux/arm/v7 - - linux/arm/v6 - provenance: false - registry: quay.io - repo: quay.io/thegeeklab/${DRONE_REPO_NAME} - username: - from_secret: quay_username - when: - ref: - - refs/heads/main - - refs/tags/** - depends_on: - - dryrun - -trigger: - ref: - - refs/heads/main - - refs/tags/** - - refs/pull/** - -depends_on: - - test - ---- -kind: pipeline -name: notifications - -platform: - os: linux - arch: amd64 - -steps: - - name: pushrm-dockerhub - pull: always - image: chko/docker-pushrm:1 - environment: - DOCKER_PASS: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - PUSHRM_FILE: README.md - PUSHRM_SHORT: Poor-mans docker service synchronizer - PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} - when: - status: - - success - - - name: pushrm-quay - pull: always - 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: thegeeklab/drone-matrix - settings: - homeserver: - from_secret: matrix_homeserver - password: - from_secret: matrix_password - roomid: - from_secret: matrix_roomid - template: "Status: **{{ .Build.Status }}**
Build: [{{ .Repo.Owner }}/{{ .Repo.Name }}]({{ .Build.Link }}){{ if .Build.Branch }} ({{ .Build.Branch }}){{ end }} by {{ .Commit.Author }}
Message: {{ .Commit.Message.Title }}" - username: - from_secret: matrix_username - when: - status: - - success - - failure - -trigger: - ref: - - refs/heads/main - - refs/tags/** - status: - - success - - failure - -depends_on: - - build-container - ---- -kind: signature -hmac: dcda7aed778df0aa478080900afef24612002100c54286b04d82fc22dc534e07 - -... diff --git a/.github/settings.yml b/.github/settings.yml index aaff9a7..4c13ad2 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -50,7 +50,9 @@ branches: required_status_checks: strict: false contexts: - - continuous-integration/drone/pr - enforce_admins: true + - ci/woodpecker/pr/test + - ci/woodpecker/pr/build-package + - ci/woodpecker/pr/docs + enforce_admins: false required_linear_history: true restrictions: null diff --git a/.prettierignore b/.prettierignore index 23a4f05..135c35d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,2 @@ -.drone.yml *.tpl.md LICENSE diff --git a/.woodpecker/build-container.yml b/.woodpecker/build-container.yml new file mode 100644 index 0000000..025ab99 --- /dev/null +++ b/.woodpecker/build-container.yml @@ -0,0 +1,72 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + dryrun: + image: quay.io/thegeeklab/wp-docker-buildx:1 + settings: + containerfile: Dockerfile.multiarch + dry_run: true + platforms: + - linux/amd64 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 + provenance: false + repo: thegeeklab/${CI_REPO_NAME} + when: + - event: [pull_request] + + publish-dockerhub: + group: build + image: quay.io/thegeeklab/wp-docker-buildx:1 + settings: + auto_tag: true + containerfile: Dockerfile.multiarch + password: + from_secret: docker_password + platforms: + - linux/amd64 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 + provenance: false + repo: thegeeklab/${CI_REPO_NAME} + username: + from_secret: docker_username + when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + + publish-quay: + group: build + image: quay.io/thegeeklab/wp-docker-buildx:1 + settings: + auto_tag: true + containerfile: Dockerfile.multiarch + password: + from_secret: quay_password + platforms: + - linux/amd64 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 + provenance: false + registry: quay.io + repo: quay.io/thegeeklab/${CI_REPO_NAME} + username: + from_secret: quay_username + when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +depends_on: + - test diff --git a/.woodpecker/build-package.yml b/.woodpecker/build-package.yml new file mode 100644 index 0000000..7f8e2a5 --- /dev/null +++ b/.woodpecker/build-package.yml @@ -0,0 +1,41 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + checksum: + image: docker.io/alpine + commands: + - sha256sum wait-for > sha256sum.txt + + changelog-generate: + image: quay.io/thegeeklab/git-chglog + commands: + - git fetch -tq + - git-chglog --no-color --no-emoji -o CHANGELOG.md ${CI_COMMIT_TAG:---next-tag unreleased unreleased} + + changelog-format: + image: quay.io/thegeeklab/alpine-tools + commands: + - prettier CHANGELOG.md + - prettier -w CHANGELOG.md + + publish-github: + image: docker.io/plugins/github-release + settings: + api_key: + from_secret: github_token + files: + - wait-for + - sha256sum.txt + note: CHANGELOG.md + overwrite: true + title: ${CI_COMMIT_TAG} + when: + - event: [tag] + +depends_on: + - test diff --git a/.woodpecker/notify.yml b/.woodpecker/notify.yml new file mode 100644 index 0000000..2acf499 --- /dev/null +++ b/.woodpecker/notify.yml @@ -0,0 +1,27 @@ +--- +when: + - event: [tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +runs_on: [success, failure] + +steps: + matrix: + image: quay.io/thegeeklab/wp-matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + username: + from_secret: matrix_username + when: + - status: [success, failure] + +depends_on: + - build-binary + - build-container diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..9a34d08 --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,25 @@ +--- +when: + - event: [pull_request, tag] + - event: [push, manual] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + +steps: + lint: + group: test + image: docker.io/koalaman/shellcheck-alpine:stable + commands: + - shellcheck ./wait-for + + test-ncat: + group: test + image: docker.io/bats/bats + commands: + - bats ./wait-for.bats + + test-bash: + image: docker.io/bats/bats + commands: + - rm -rf /usr/bin/nc + - bats ./wait-for.bats diff --git a/Dockerfile.multiarch b/Containerfile.multiarch similarity index 86% rename from Dockerfile.multiarch rename to Containerfile.multiarch index df4df58..de5d774 100644 --- a/Dockerfile.multiarch +++ b/Containerfile.multiarch @@ -1,4 +1,4 @@ -FROM alpine:3.18@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a +FROM alpine:3.18@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1 LABEL maintainer="Robert Kaussow " LABEL org.opencontainers.image.authors="Robert Kaussow " diff --git a/README.md b/README.md index abe75af..b4af904 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Poor-mans servie synchronizer -[![Build Status](https://img.shields.io/drone/build/thegeeklab/wait-for?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/wait-for) +[![Build Status](https://ci.thegeeklab.de/api/badges/thegeeklab/wait-for/status.svg)](https://ci.thegeeklab.de/repos/thegeeklab/wait-for) [![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/wait-for) [![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/wait-for) [![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/wait-for)](https://github.com/thegeeklab/wait-for/graphs/contributors)