Merge branch 'origin/main' into 'next-release/main'

This commit is contained in:
oauth 2024-09-24 20:51:51 +00:00
commit ecbaf5f4b2
2 changed files with 6 additions and 11 deletions

View file

@ -25,6 +25,7 @@ import (
"strings" "strings"
"github.com/drone/envsubst" "github.com/drone/envsubst"
"github.com/oklog/ulid/v2"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/urfave/cli/v3" "github.com/urfave/cli/v3"
@ -170,6 +171,9 @@ func execWithAxis(ctx context.Context, c *cli.Command, file, repoPath string, ax
return err return err
} }
// emulate server behavior https://github.com/woodpecker-ci/woodpecker/blob/eebaa10d104cbc3fa7ce4c0e344b0b7978405135/server/pipeline/stepbuilder/stepBuilder.go#L289-L295
prefix := "wp_" + ulid.Make().String()
// configure volumes for local execution // configure volumes for local execution
volumes := c.StringSlice("volumes") volumes := c.StringSlice("volumes")
if c.Bool("local") { if c.Bool("local") {
@ -184,7 +188,7 @@ func execWithAxis(ctx context.Context, c *cli.Command, file, repoPath string, ax
workspacePath = c.String("workspace-path") workspacePath = c.String("workspace-path")
} }
volumes = append(volumes, c.String("prefix")+"_default:"+workspaceBase) volumes = append(volumes, prefix+"_default:"+workspaceBase)
volumes = append(volumes, repoPath+":"+path.Join(workspaceBase, workspacePath)) volumes = append(volumes, repoPath+":"+path.Join(workspaceBase, workspacePath))
} }
@ -221,9 +225,7 @@ func execWithAxis(ctx context.Context, c *cli.Command, file, repoPath string, ax
compiler.WithNetworks( compiler.WithNetworks(
c.StringSlice("network")..., c.StringSlice("network")...,
), ),
compiler.WithPrefix( compiler.WithPrefix(prefix),
c.String("prefix"),
),
compiler.WithProxy(compiler.ProxyOptions{ compiler.WithProxy(compiler.ProxyOptions{
NoProxy: c.String("backend-no-proxy"), NoProxy: c.String("backend-no-proxy"),
HTTPProxy: c.String("backend-http-proxy"), HTTPProxy: c.String("backend-http-proxy"),

View file

@ -48,13 +48,6 @@ var flags = []cli.Flag{
Name: "network", Name: "network",
Usage: "external networks", Usage: "external networks",
}, },
&cli.StringFlag{
Sources: cli.EnvVars("WOODPECKER_PREFIX"),
Name: "prefix",
Value: "woodpecker",
Usage: "prefix used for containers, volumes, networks, ... created by woodpecker",
Hidden: true,
},
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Sources: cli.EnvVars("WOODPECKER_PLUGINS_PRIVILEGED"), Sources: cli.EnvVars("WOODPECKER_PLUGINS_PRIVILEGED"),
Name: "plugins-privileged", Name: "plugins-privileged",