mirror of
https://codeberg.org/woodpecker-plugins/go-plugin.git
synced 2025-05-09 11:19:30 +02:00
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:
parent
044f72ed49
commit
e3f4284781
2
go.mod
2
go.mod
@ -8,7 +8,7 @@ require (
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/rs/zerolog v1.34.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
|
||||
)
|
||||
|
||||
|
4
go.sum
4
go.sum
@ -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/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
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.1.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo=
|
||||
github.com/urfave/cli/v3 v3.2.0 h1:m8WIXY0U9LCuUl5r+0fqLWDhNYWt6qvlW+GcF4EoXf8=
|
||||
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/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
@ -78,7 +78,7 @@ func TestMetadata(t *testing.T) {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
err := plugin.app.Run(plugin.ctx, []string{"test"})
|
||||
err := plugin.App.Run(plugin.ctx, []string{"test"})
|
||||
require.NoError(t, err)
|
||||
|
||||
// Repository
|
||||
|
20
pipeline.go
20
pipeline.go
@ -51,7 +51,7 @@ type Pipeline struct {
|
||||
|
||||
func pipelineFlags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.IntFlag{
|
||||
&cli.Int64Flag{
|
||||
Name: "pipeline.number",
|
||||
Usage: "pipeline number",
|
||||
Sources: cli.EnvVars(
|
||||
@ -93,7 +93,7 @@ func pipelineFlags() []cli.Flag {
|
||||
"DRONE_DEPLOY_TO",
|
||||
),
|
||||
},
|
||||
&cli.IntFlag{
|
||||
&cli.Int64Flag{
|
||||
Name: "pipeline.created",
|
||||
Usage: "pipeline creation time",
|
||||
Sources: cli.EnvVars(
|
||||
@ -101,7 +101,7 @@ func pipelineFlags() []cli.Flag {
|
||||
"DRONE_BUILD_CREATED",
|
||||
),
|
||||
},
|
||||
&cli.IntFlag{
|
||||
&cli.Int64Flag{
|
||||
Name: "pipeline.started",
|
||||
Usage: "pipeline start time",
|
||||
Sources: cli.EnvVars(
|
||||
@ -109,7 +109,7 @@ func pipelineFlags() []cli.Flag {
|
||||
"DRONE_BUILD_STARTED",
|
||||
),
|
||||
},
|
||||
&cli.IntFlag{
|
||||
&cli.Int64Flag{
|
||||
Name: "pipeline.finished",
|
||||
Usage: "pipeline finish time",
|
||||
Sources: cli.EnvVars(
|
||||
@ -117,7 +117,7 @@ func pipelineFlags() []cli.Flag {
|
||||
"DRONE_BUILD_FINISHED",
|
||||
),
|
||||
},
|
||||
&cli.IntFlag{
|
||||
&cli.Int64Flag{
|
||||
Name: "pipeline.parent",
|
||||
Usage: "pipeline parent",
|
||||
Sources: cli.EnvVars(
|
||||
@ -146,16 +146,16 @@ func pipelineFromContext(c *cli.Command) Pipeline {
|
||||
}
|
||||
|
||||
return Pipeline{
|
||||
Number: c.Int("pipeline.number"),
|
||||
Number: c.Int64("pipeline.number"),
|
||||
Status: c.String("pipeline.status"),
|
||||
Event: c.String("pipeline.event"),
|
||||
URL: c.String("pipeline.url"),
|
||||
Link: c.String("pipeline.url"),
|
||||
DeployTarget: c.String("pipeline.deploy-target"),
|
||||
Created: time.Unix(c.Int("pipeline.created"), 0),
|
||||
Started: time.Unix(c.Int("pipeline.started"), 0),
|
||||
Finished: time.Unix(c.Int("pipeline.finished"), 0),
|
||||
Parent: c.Int("pipeline.parent"),
|
||||
Created: time.Unix(c.Int64("pipeline.created"), 0),
|
||||
Started: time.Unix(c.Int64("pipeline.started"), 0),
|
||||
Finished: time.Unix(c.Int64("pipeline.finished"), 0),
|
||||
Parent: c.Int64("pipeline.parent"),
|
||||
ChangedFiles: changedFiles,
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ type Options struct {
|
||||
|
||||
// Plugin defines the plugin instance.
|
||||
type Plugin struct {
|
||||
app *cli.Command
|
||||
App *cli.Command
|
||||
execute ExecuteFunc
|
||||
client *http.Client
|
||||
ctx context.Context
|
||||
@ -68,11 +68,11 @@ func New(opt Options) *Plugin {
|
||||
}
|
||||
|
||||
plugin := &Plugin{
|
||||
app: app,
|
||||
App: app,
|
||||
execute: opt.Execute,
|
||||
ctx: opt.Context,
|
||||
}
|
||||
plugin.app.Action = plugin.action
|
||||
plugin.App.Action = plugin.action
|
||||
|
||||
if plugin.ctx == nil {
|
||||
plugin.ctx = context.Background()
|
||||
@ -103,7 +103,7 @@ func (p *Plugin) HTTPClient() *http.Client {
|
||||
|
||||
// Run the plugin.
|
||||
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")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ func TestPlugin(t *testing.T) {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
err := p.app.Run(p.ctx, []string{"test"})
|
||||
err := p.App.Run(p.ctx, []string{"test"})
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, executed)
|
||||
}
|
||||
|
10
step.go
10
step.go
@ -37,14 +37,14 @@ func stepFlags() []cli.Flag {
|
||||
"DRONE_STEP_NUMBER",
|
||||
),
|
||||
},
|
||||
&cli.IntFlag{
|
||||
&cli.Int64Flag{
|
||||
Name: "step.started",
|
||||
Usage: "step start time",
|
||||
Sources: cli.EnvVars(
|
||||
"CI_STEP_STARTED",
|
||||
),
|
||||
},
|
||||
&cli.IntFlag{
|
||||
&cli.Int64Flag{
|
||||
Name: "step.finished",
|
||||
Usage: "step finish time",
|
||||
Sources: cli.EnvVars(
|
||||
@ -56,8 +56,8 @@ func stepFlags() []cli.Flag {
|
||||
|
||||
func stepFromContext(c *cli.Command) Step {
|
||||
return Step{
|
||||
Number: int(c.Int("step.number")),
|
||||
Started: time.Unix(c.Int("step.started"), 0),
|
||||
Finished: time.Unix(c.Int("step.finished"), 0),
|
||||
Number: c.Int("step.number"),
|
||||
Started: time.Unix(c.Int64("step.started"), 0),
|
||||
Finished: time.Unix(c.Int64("step.finished"), 0),
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user