mirror of
https://codeberg.org/woodpecker-plugins/go-plugin.git
synced 2024-11-24 22:35:39 +01:00
Woodpecker CI plugin library
ab2091b8bc
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/joho/godotenv](https://github.com/joho/godotenv) | require | minor | `v1.4.0` -> `v1.5.1` | --- ### Release Notes <details> <summary>joho/godotenv (github.com/joho/godotenv)</summary> ### [`v1.5.1`](https://github.com/joho/godotenv/releases/tag/v1.5.1): Fix parser regressions from multiline support [Compare Source](https://github.com/joho/godotenv/compare/v1.5.0...v1.5.1) Version 1.5 came with a whole new parser, and with a new parser comes new bugs. Things that were broken in 1.5 that are now fixed: - unquoted variables with interior whitespace no longer split on the first space (and then break the following line if you have one) - inline comments now work again for both quoted and unquoted variables - ` export ` statement filtering was made more robust and matched earlier versions behaviour - `FOO.BAR` key names are permitted again (i have no idea why you'd do it, but it's explicitly supported in ruby dotenv files) There's one breaking change: earlier versions of this library would allow unterminated quoted variables in some instances and return a value (ie `FOO="bar` would set env of `FOO: '"bar'`), this now returns an error. #### What's Changed - Fix bug where internal unquoted whitespace truncates values by [@​joho](https://github.com/joho) in https://github.com/joho/godotenv/pull/205 **Full Changelog**: https://github.com/joho/godotenv/compare/v1.5.0...v1.5.1 ### [`v1.5.0`](https://github.com/joho/godotenv/releases/tag/v1.5.0): - multiline variables [Compare Source](https://github.com/joho/godotenv/compare/v1.4.0...v1.5.0) The big news this release is that godotenv finally, after much procrastination in review, supports multiline variables (fixes [#​64](https://github.com/joho/godotenv/issues/64)). Big shoutout to [@​x1unix](https://github.com/x1unix) for the bulk of the work on the original PR and also to [@​coolaj86](https://github.com/coolaj86) and [@​austinsasko](https://github.com/austinsasko) for some very helpful review and tweaks. Also added a `-o` overload flag (thanks [@​2tef](https://github.com/2tef)) #### What's Changed - Try and fix go get in CI for power8 by [@​joho](https://github.com/joho) in https://github.com/joho/godotenv/pull/157 - Fix typos in comments and extend README by [@​alexandear](https://github.com/alexandear) in https://github.com/joho/godotenv/pull/177 - tune README by [@​bikbah](https://github.com/bikbah) in https://github.com/joho/godotenv/pull/170 - Remove renovate, add dependabot by [@​joho](https://github.com/joho) in https://github.com/joho/godotenv/pull/183 - Setup codeql by [@​joho](https://github.com/joho) in https://github.com/joho/godotenv/pull/186 - Bump actions/checkout from 2 to 3 by [@​dependabot](https://github.com/dependabot) in https://github.com/joho/godotenv/pull/184 - Bump actions/setup-go from 2 to 3 by [@​dependabot](https://github.com/dependabot) in https://github.com/joho/godotenv/pull/185 - Add darwin arm64 build by [@​statik](https://github.com/statik) in https://github.com/joho/godotenv/pull/174 - Sort Go import in README by [@​Doarakko](https://github.com/Doarakko) in https://github.com/joho/godotenv/pull/193 - Fix godoc formatting by [@​joho](https://github.com/joho) in https://github.com/joho/godotenv/pull/197 - fix tiny details by [@​2tef](https://github.com/2tef) in https://github.com/joho/godotenv/pull/199 - Multiline string support by [@​x1unix](https://github.com/x1unix) in https://github.com/joho/godotenv/pull/156 - Update CI to test go 1.20 by [@​joho](https://github.com/joho) in https://github.com/joho/godotenv/pull/201 - fix whitespace with gofmt by [@​2tef](https://github.com/2tef) in https://github.com/joho/godotenv/pull/203 - add overload flag by [@​2tef](https://github.com/2tef) in https://github.com/joho/godotenv/pull/200 - - Fix: ioutil.ReadAll() is deprecated, so removed it's dependency by [@​dreygur](https://github.com/dreygur) in https://github.com/joho/godotenv/pull/202 #### New Contributors - [@​x1unix](https://github.com/x1unix) made their first contribution in https://github.com/joho/godotenv/pull/118 - [@​alexandear](https://github.com/alexandear) made their first contribution in https://github.com/joho/godotenv/pull/177 - [@​bikbah](https://github.com/bikbah) made their first contribution in https://github.com/joho/godotenv/pull/170 - [@​dependabot](https://github.com/dependabot) made their first contribution in https://github.com/joho/godotenv/pull/184 - [@​statik](https://github.com/statik) made their first contribution in https://github.com/joho/godotenv/pull/174 - [@​Doarakko](https://github.com/Doarakko) made their first contribution in https://github.com/joho/godotenv/pull/193 - [@​2tef](https://github.com/2tef) made their first contribution in https://github.com/joho/godotenv/pull/199 - [@​dreygur](https://github.com/dreygur) made their first contribution in https://github.com/joho/godotenv/pull/202 **Full Changelog**: https://github.com/joho/godotenv/compare/v1.4.0...v1.5.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - "before 4am" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMi4wIiwidXBkYXRlZEluVmVyIjoiMzcuMzMuNiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/11 Co-authored-by: woodpecker-bot <woodpecker-bot@obermui.de> Co-committed-by: woodpecker-bot <woodpecker-bot@obermui.de> |
||
---|---|---|
.woodpecker.yaml | ||
commit.go | ||
flags.go | ||
go.mod | ||
go.sum | ||
http.go | ||
LICENSE | ||
logger.go | ||
metadata_test.go | ||
metadata.go | ||
pipeline.go | ||
plugin_test.go | ||
plugin.go | ||
README.md | ||
renovate.json | ||
repo.go | ||
step.go | ||
system.go |
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 |
- |
SOCKS_PROXY |
none | SOCKS5 proxy to use for connections | |
SOCKS_PROXY_OFF |
none | Do not use SOCKS5 proxy |
Creating plugin
import (
"context"
"codeberg.org/woodpecker-plugins/go-plugin"
"github.com/urfave/cli/v2"
"github.com/rs/zerolog/log"
)
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",
EnvVars: []string{"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{}
}
p.Plugin = plugin.New(Options{
Name: "sample-plugin",
Description: "Sample plugin",
Flags: p.Flags(),
Execute: p.Execute,
})
p.Run()
}