- Go 96%
- Dockerfile 4%
|
|
||
|---|---|---|
| internal | ||
| test_data | ||
| .gitignore | ||
| .goreleaser.yaml | ||
| .markdownlint.json | ||
| .prettierrc | ||
| Containerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
| renovate.json | ||
Plugin to define cron jobs in Woodpecker CI
This plugin is intended to run with administrative purpose:
- Automatically enable repositories in Woodpecker CI.
- Define cron jobs based on external configuration.
Sample timer.ini file:
[wptimer]
patch_daily=0 2 * * *
vulnerability=0 1 * * *
RandomDelayMinutes=50
[test-repo]
patch_daily=0 3 * * *
vulnerability=0 1 * * *
The [foo] indicates the repository name suffix, so the timers are applied for
any repository that ends with foo.
The RandomDelayMinutes helps to not concentrate the workload on the server: if
specified, it ignores the minute from the timer definition, instead it generates
a random number within the interval and uses that.
Every other lines are handled as timer input. The value must follow the cron rules.
Usage
It can be used at any event, but it has two meaningful usage.
Use as CI check
The timer.ini file can be syntax checked during like a push or
pull_request events. This is an example to call that.
steps:
- name: Test timer.ini file
image: code.thinkaboutit.tech/pandora/timer.woodpecker
settings:
mode: ci
Use from timer
When the mode is run, it is not just testing the configuration, but it also do
the effective work.
steps:
- name: Make Woodpecker CI administration maintenance
image: code.thinkaboutit.tech/pandora/timer.woodpecker
settings:
mode: run
woodpecker_token:
from_secret: woodpecker-access-token
forgejo_token:
from_secret: forgejo-access-token
The Forgejo token must have read:user, read:organization and
read:repository.
Settings
| Name | Default value | Description |
|---|---|---|
| owner | CI_REPO_OWNER | Owner of the repository where the timer.ini is. |
| repo_name | CI_REPO_NAME | Repository's name where the timer.ini is. |
| timer_source | timer.ini | Path until the timer.ini file. |
| mode | This must be ci or run. |
Following settings are only needed when mode is run.
| Name | Default value | Description |
|---|---|---|
| woodpecker_token | Access token for Woodpecker CI | |
| woodpecker_host | CI_SYSTEM_URL | URL to Woodpecker CI |
| forgejo_token | Access token for Forgejo | |
| forgejo_host | CI_FORGE_URL | URL to Forgejo instance |