1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-11-23 21:44:44 +02:00

Migrate to github.com/urfave/cli/v3 (#2951)

This commit is contained in:
6543
2024-07-17 16:26:35 -07:00
committed by GitHub
parent e39345688d
commit cd5f6f71a2
112 changed files with 817 additions and 673 deletions

View File

@@ -31,7 +31,7 @@ import (
std_copy "github.com/moby/moby/pkg/stdcopy"
"github.com/moby/term"
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v3"
backend "go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
"go.woodpecker-ci.org/woodpecker/v2/shared/utils"
@@ -63,7 +63,7 @@ func (e *docker) Name() string {
}
func (e *docker) IsAvailable(ctx context.Context) bool {
if c, ok := ctx.Value(backend.CliContext).(*cli.Context); ok {
if c, ok := ctx.Value(backend.CliCommand).(*cli.Command); ok {
if c.IsSet("backend-docker-host") {
return true
}
@@ -101,7 +101,7 @@ func (e *docker) Flags() []cli.Flag {
// Load new client for Docker Backend using environment variables.
func (e *docker) Load(ctx context.Context) (*backend.BackendInfo, error) {
c, ok := ctx.Value(backend.CliContext).(*cli.Context)
c, ok := ctx.Value(backend.CliCommand).(*cli.Command)
if !ok {
return nil, backend.ErrNoCliContextFound
}

View File

@@ -15,44 +15,44 @@
package docker
import (
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v3"
)
var Flags = []cli.Flag{
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_DOCKER_HOST", "DOCKER_HOST"},
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_HOST", "DOCKER_HOST"),
Name: "backend-docker-host",
Usage: "path to docker socket or url to the docker server",
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_DOCKER_API_VERSION", "DOCKER_API_VERSION"},
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_API_VERSION", "DOCKER_API_VERSION"),
Name: "backend-docker-api-version",
Usage: "the version of the API to reach, leave empty for latest.",
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_DOCKER_CERT_PATH", "DOCKER_CERT_PATH"},
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_CERT_PATH", "DOCKER_CERT_PATH"),
Name: "backend-docker-cert",
Usage: "path to load the TLS certificates for connecting to docker server",
},
&cli.BoolFlag{
EnvVars: []string{"WOODPECKER_BACKEND_DOCKER_TLS_VERIFY", "DOCKER_TLS_VERIFY"},
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_TLS_VERIFY", "DOCKER_TLS_VERIFY"),
Name: "backend-docker-tls-verify",
Usage: "enable or disable TLS verification for connecting to docker server",
Value: true,
},
&cli.BoolFlag{
EnvVars: []string{"WOODPECKER_BACKEND_DOCKER_ENABLE_IPV6"},
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_ENABLE_IPV6"),
Name: "backend-docker-ipv6",
Usage: "backend docker enable IPV6",
Value: false,
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_DOCKER_NETWORK"},
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_NETWORK"),
Name: "backend-docker-network",
Usage: "backend docker network",
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_DOCKER_VOLUMES"},
Sources: cli.EnvVars("WOODPECKER_BACKEND_DOCKER_VOLUMES"),
Name: "backend-docker-volumes",
Usage: "backend docker volumes (comma separated)",
},