https://github.com/woodpecker-ci/example-config-service
Example for a basic configuration service
https://github.com/woodpecker-ci/example-config-service
example go golang service woodpecker-ci woodpeckerci
Last synced: about 1 year ago
JSON representation
Example for a basic configuration service
- Host: GitHub
- URL: https://github.com/woodpecker-ci/example-config-service
- Owner: woodpecker-ci
- Archived: true
- Created: 2022-02-27T20:08:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-05T11:04:35.000Z (about 2 years ago)
- Last Synced: 2025-03-25T23:34:53.593Z (over 1 year ago)
- Topics: example, go, golang, service, woodpecker-ci, woodpeckerci
- Language: Go
- Homepage:
- Size: 109 KB
- Stars: 3
- Watchers: 7
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Archived
Please checkout the new extensions sample which includes this config extension [here](https://github.com/woodpecker-ci/example-extensions)
# 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](https://woodpecker-ci.org/docs/administration/external-configuration-api)
eg:
```shell
# Server
# ...
WOODPECKER_CONFIG_SERVICE_ENDPOINT=http://:8000/ciconfig
WOODPECKER_CONFIG_SERVICE_PUBLIC_KEY_FILE=public-key.pem
```