Woodpecker CI plugin library
Go to file
anbraten 090b4571b4 Add & update some env data (#24)
- Some renamings to be more descriptive
- link -> url
- deprecated all old properties

closes #22

Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/24
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: anbraten <anbraten@noreply.codeberg.org>
Co-committed-by: anbraten <anbraten@noreply.codeberg.org>
2024-02-15 18:53:26 +00:00
.woodpecker.yaml chore(deps): update golangci/golangci-lint docker tag to v1.56 2024-02-08 11:06:03 +00:00
commit.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00
flags.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00
forge.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00
go.mod fix(deps): update module golang.org/x/net to v0.21.0 2024-02-08 11:41:26 +00:00
go.sum fix(deps): update module golang.org/x/net to v0.21.0 2024-02-08 11:41:26 +00:00
http.go Initial implementation 2023-01-08 04:53:03 +02:00
LICENSE Initial implementation 2023-01-08 04:53:03 +02:00
logger.go Fix to not log time in output (#3) 2023-01-09 12:33:18 +00:00
metadata_test.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00
metadata.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00
pipeline.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00
plugin_test.go Initial implementation 2023-01-08 04:53:03 +02:00
plugin.go Initial implementation 2023-01-08 04:53:03 +02:00
README.md fix: make readme example compile (#17) 2023-11-15 17:33:12 +00:00
renovate.json Configure Renovate (#4) 2023-10-16 16:52:34 +00:00
repo.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00
step.go Initial implementation 2023-01-08 04:53:03 +02:00
system.go Add & update some env data (#24) 2024-02-15 18:53:26 +00:00

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

package main

import (
	"context"

	"codeberg.org/woodpecker-plugins/go-plugin"
	"github.com/rs/zerolog/log"
	"github.com/urfave/cli/v2"
)

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: &Settings{},
	}

	p.Plugin = plugin.New(plugin.Options{
		Name:        "sample-plugin",
		Description: "Sample plugin",
		Flags:       p.Flags(),
		Execute:     p.Execute,
	})

	p.Run()
}