mirror of
https://codeberg.org/woodpecker-plugins/go-plugin
synced 2026-06-04 18:23:54 +08:00
e8db412499537258c4b59a67a3bdf726592d2408
This PR was opened by the [ready-release-go](https://github.com/woodpecker-ci/plugin-ready-release-go) plugin. When you're ready to do a release, you can merge this pull-request and a new release with version `1.0.3` will be created automatically. If you're not ready to do a release yet, that's fine, whenever you add more changes to `main` this pull-request will be updated. ## Options - [ ] Mark this version as a release candidate ## [1.0.3](https://codeberg.org/woodpecker-plugins/go-plugin/releases/tag/v1.0.3) - 2026-03-07 ### 📦️ Dependency - fix(deps): update module github.com/urfave/cli/v3 to v3.7.0 [[#80](https://codeberg.org/woodpecker-plugins/go-plugin/pulls/80)] - chore(deps): update docker.io/woodpeckerci/plugin-ready-release-go docker tag to v4 [[#78](https://codeberg.org/woodpecker-plugins/go-plugin/pulls/78)] - fix(deps): update module golang.org/x/net to v0.51.0 [[#79](https://codeberg.org/woodpecker-plugins/go-plugin/pulls/79)] - chore(deps): update dependency go to v1.26.0 [[#74](https://codeberg.org/woodpecker-plugins/go-plugin/pulls/74)] - chore(deps): update golang docker tag to v1.26 [[#75](https://codeberg.org/woodpecker-plugins/go-plugin/pulls/75)] - fix(deps): update module golang.org/x/net to v0.50.0 [[#76](https://codeberg.org/woodpecker-plugins/go-plugin/pulls/76)] Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/77 Reviewed-by: Lauris BH <lafriks@noreply.codeberg.org> Co-authored-by: oauth <woodpecker-bot@obermui.de> Co-committed-by: oauth <woodpecker-bot@obermui.de>
Library for creating Woodpecker CI plugins
Provides basic structure and helpers to load Woodpecker CI environment variables while also supporting reading Drone CI environment variables where available.
Adds logging support based on zerolog library and allows configurable HTTP client library.
Builtin settings
| Settings Name | Environment variable | Default | Description | |
|---|---|---|---|---|
log_level |
- | info |
Sets log level (panic, fatal, error, warn, info, debug, trace) |
|
skip_verify |
- | false |
- | Skip verification of TLS certificate |
SOCKS_PROXY |
none | SOCKS5 proxy to use for connections | ||
SOCKS_PROXY_OFF |
none | Do not use SOCKS5 proxy |
Creating plugin
package main
import (
"context"
"codeberg.org/woodpecker-plugins/go-plugin"
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v3"
)
type Settings struct {
// TODO: Plugin settings
SampleFlag string
}
type Plugin struct {
*plugin.Plugin
Settings *Settings
}
func (p *Plugin) Flags() []cli.Flag {
return []cli.Flag{
// TODO: Add flags
&cli.StringFlag{
Name: "sample.flag",
Usage: "sample flag",
Sources: cli.EnvVars("PLUGIN_SAMPLE_FLAG"),
Destination: &p.Settings.SampleFlag,
},
}
}
func (p *Plugin) Execute(ctx context.Context) error {
// TODO: Implement execution
log.Debug().Msg("executed")
return nil
}
func main() {
p := &Plugin{
Settings: &Settings{},
}
p.Plugin = plugin.New(plugin.Options{
Name: "sample-plugin",
Description: "Sample plugin",
Flags: p.Flags(),
Execute: p.Execute,
})
p.Run()
}
Description
Languages
Go
97%
Makefile
2%
Nix
1%