Example for a basic configuration service
Go to file
sebclem 1dd881d2b5
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
Update Dockerfile
2023-07-18 11:07:28 +02:00
.env.example Add filter example 2022-02-27 22:31:48 +01:00
.gitignore Initial 2022-02-27 20:18:27 +01:00
.woodpecker.yml Change for external config 2023-07-06 16:46:53 +02:00
Dockerfile Update Dockerfile 2023-07-18 11:07:28 +02:00
go.mod Change for external config 2023-07-06 16:46:53 +02:00
go.sum Change for external config 2023-07-06 16:46:53 +02:00
main.go Remove signature check 2023-07-07 15:06:57 +02:00
Readme.md Change for external config 2023-07-06 16:46:53 +02:00

Woodpecker CI Configuration Service example

This repository provides a very simplistic example of how to set up an external configuration service for Woodpecker CI The external service gets a HTTP POST request with information about the repo, current build, and the configs that would normally be used. It can then decide to acknowledge the current configs (By returning HTTP 204), or overriding the configurations and returning new ones in the response

Use cases for this system are:

  • Centralized configuration for multiple repositories at once
  • Preprocessing steps in the pipeline like templating, macros or conversion from different pipeline formats to woodpeckers format

This service is written in go, to run it first copy the config example: cp .env.example .env Download the public key from your woodpecker instance from http(s)://your-woodpecker-server/api/signature/public-key and save it to file. Set WOODPECKER_CONFIG_SERVICE_PUBLIC_KEY_FILE to the path to that file and add a filtering regex. The repositories that have a name match the filtering regex will receive the config from central-pipeline-config.yaml, while all other repositories will continue using their original configuration.

Then run using go run ..

Make sure to configure your woodpecker instance with the correct endpoint and configure the same secret. See Woodpeckers documentation here

eg:

# Server
# ...
WOODPECKER_CONFIG_SERVICE_ENDPOINT=http://<service>:8000/ciconfig
WOODPECKER_CONFIG_SERVICE_PUBLIC_KEY_FILE=public-key.pem

For docker, simply mount the woodpecker key to /data/woodpecker.pub