Bump urfave/cli to v3.2.0 (#49)

Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/49
Reviewed-by: Patrick Schratz <pat-s@noreply.codeberg.org>
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
Co-committed-by: Robert Kaussow <mail@thegeeklab.de>
This commit is contained in:
Robert Kaussow 2025-04-24 06:44:11 +00:00 committed by Patrick Schratz
parent 044f72ed49
commit e3f4284781
7 changed files with 24 additions and 24 deletions

2
go.mod
View File

@ -8,7 +8,7 @@ require (
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/rs/zerolog v1.34.0 github.com/rs/zerolog v1.34.0
github.com/stretchr/testify v1.10.0 github.com/stretchr/testify v1.10.0
github.com/urfave/cli/v3 v3.1.1 github.com/urfave/cli/v3 v3.2.0
golang.org/x/net v0.38.0 golang.org/x/net v0.38.0
) )

4
go.sum
View File

@ -17,8 +17,8 @@ github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli/v3 v3.1.1 h1:bNnl8pFI5dxPOjeONvFCDFoECLQsceDG4ejahs4Jtxk= github.com/urfave/cli/v3 v3.2.0 h1:m8WIXY0U9LCuUl5r+0fqLWDhNYWt6qvlW+GcF4EoXf8=
github.com/urfave/cli/v3 v3.1.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= github.com/urfave/cli/v3 v3.2.0/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

View File

@ -78,7 +78,7 @@ func TestMetadata(t *testing.T) {
return nil return nil
}, },
}) })
err := plugin.app.Run(plugin.ctx, []string{"test"}) err := plugin.App.Run(plugin.ctx, []string{"test"})
require.NoError(t, err) require.NoError(t, err)
// Repository // Repository

View File

@ -51,7 +51,7 @@ type Pipeline struct {
func pipelineFlags() []cli.Flag { func pipelineFlags() []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.IntFlag{ &cli.Int64Flag{
Name: "pipeline.number", Name: "pipeline.number",
Usage: "pipeline number", Usage: "pipeline number",
Sources: cli.EnvVars( Sources: cli.EnvVars(
@ -93,7 +93,7 @@ func pipelineFlags() []cli.Flag {
"DRONE_DEPLOY_TO", "DRONE_DEPLOY_TO",
), ),
}, },
&cli.IntFlag{ &cli.Int64Flag{
Name: "pipeline.created", Name: "pipeline.created",
Usage: "pipeline creation time", Usage: "pipeline creation time",
Sources: cli.EnvVars( Sources: cli.EnvVars(
@ -101,7 +101,7 @@ func pipelineFlags() []cli.Flag {
"DRONE_BUILD_CREATED", "DRONE_BUILD_CREATED",
), ),
}, },
&cli.IntFlag{ &cli.Int64Flag{
Name: "pipeline.started", Name: "pipeline.started",
Usage: "pipeline start time", Usage: "pipeline start time",
Sources: cli.EnvVars( Sources: cli.EnvVars(
@ -109,7 +109,7 @@ func pipelineFlags() []cli.Flag {
"DRONE_BUILD_STARTED", "DRONE_BUILD_STARTED",
), ),
}, },
&cli.IntFlag{ &cli.Int64Flag{
Name: "pipeline.finished", Name: "pipeline.finished",
Usage: "pipeline finish time", Usage: "pipeline finish time",
Sources: cli.EnvVars( Sources: cli.EnvVars(
@ -117,7 +117,7 @@ func pipelineFlags() []cli.Flag {
"DRONE_BUILD_FINISHED", "DRONE_BUILD_FINISHED",
), ),
}, },
&cli.IntFlag{ &cli.Int64Flag{
Name: "pipeline.parent", Name: "pipeline.parent",
Usage: "pipeline parent", Usage: "pipeline parent",
Sources: cli.EnvVars( Sources: cli.EnvVars(
@ -146,16 +146,16 @@ func pipelineFromContext(c *cli.Command) Pipeline {
} }
return Pipeline{ return Pipeline{
Number: c.Int("pipeline.number"), Number: c.Int64("pipeline.number"),
Status: c.String("pipeline.status"), Status: c.String("pipeline.status"),
Event: c.String("pipeline.event"), Event: c.String("pipeline.event"),
URL: c.String("pipeline.url"), URL: c.String("pipeline.url"),
Link: c.String("pipeline.url"), Link: c.String("pipeline.url"),
DeployTarget: c.String("pipeline.deploy-target"), DeployTarget: c.String("pipeline.deploy-target"),
Created: time.Unix(c.Int("pipeline.created"), 0), Created: time.Unix(c.Int64("pipeline.created"), 0),
Started: time.Unix(c.Int("pipeline.started"), 0), Started: time.Unix(c.Int64("pipeline.started"), 0),
Finished: time.Unix(c.Int("pipeline.finished"), 0), Finished: time.Unix(c.Int64("pipeline.finished"), 0),
Parent: c.Int("pipeline.parent"), Parent: c.Int64("pipeline.parent"),
ChangedFiles: changedFiles, ChangedFiles: changedFiles,
} }
} }

View File

@ -42,7 +42,7 @@ type Options struct {
// Plugin defines the plugin instance. // Plugin defines the plugin instance.
type Plugin struct { type Plugin struct {
app *cli.Command App *cli.Command
execute ExecuteFunc execute ExecuteFunc
client *http.Client client *http.Client
ctx context.Context ctx context.Context
@ -68,11 +68,11 @@ func New(opt Options) *Plugin {
} }
plugin := &Plugin{ plugin := &Plugin{
app: app, App: app,
execute: opt.Execute, execute: opt.Execute,
ctx: opt.Context, ctx: opt.Context,
} }
plugin.app.Action = plugin.action plugin.App.Action = plugin.action
if plugin.ctx == nil { if plugin.ctx == nil {
plugin.ctx = context.Background() plugin.ctx = context.Background()
@ -103,7 +103,7 @@ func (p *Plugin) HTTPClient() *http.Client {
// Run the plugin. // Run the plugin.
func (p *Plugin) Run() { func (p *Plugin) Run() {
if err := p.app.Run(p.ctx, os.Args); err != nil { if err := p.App.Run(p.ctx, os.Args); err != nil {
log.Error().Err(err).Msg("execution failed") log.Error().Err(err).Msg("execution failed")
os.Exit(1) os.Exit(1)
} }

View File

@ -30,7 +30,7 @@ func TestPlugin(t *testing.T) {
return nil return nil
}, },
}) })
err := p.app.Run(p.ctx, []string{"test"}) err := p.App.Run(p.ctx, []string{"test"})
assert.NoError(t, err) assert.NoError(t, err)
assert.True(t, executed) assert.True(t, executed)
} }

10
step.go
View File

@ -37,14 +37,14 @@ func stepFlags() []cli.Flag {
"DRONE_STEP_NUMBER", "DRONE_STEP_NUMBER",
), ),
}, },
&cli.IntFlag{ &cli.Int64Flag{
Name: "step.started", Name: "step.started",
Usage: "step start time", Usage: "step start time",
Sources: cli.EnvVars( Sources: cli.EnvVars(
"CI_STEP_STARTED", "CI_STEP_STARTED",
), ),
}, },
&cli.IntFlag{ &cli.Int64Flag{
Name: "step.finished", Name: "step.finished",
Usage: "step finish time", Usage: "step finish time",
Sources: cli.EnvVars( Sources: cli.EnvVars(
@ -56,8 +56,8 @@ func stepFlags() []cli.Flag {
func stepFromContext(c *cli.Command) Step { func stepFromContext(c *cli.Command) Step {
return Step{ return Step{
Number: int(c.Int("step.number")), Number: c.Int("step.number"),
Started: time.Unix(c.Int("step.started"), 0), Started: time.Unix(c.Int64("step.started"), 0),
Finished: time.Unix(c.Int("step.finished"), 0), Finished: time.Unix(c.Int64("step.finished"), 0),
} }
} }