Skip to content

Commit

Permalink
Support all backends for cli exec (#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
anbraten authored Feb 26, 2022
1 parent 52d8097 commit 1cc8122
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
13 changes: 9 additions & 4 deletions cli/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

"github.com/woodpecker-ci/woodpecker/cli/common"
"github.com/woodpecker-ci/woodpecker/pipeline"
"github.com/woodpecker-ci/woodpecker/pipeline/backend/docker"
backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types"
"github.com/woodpecker-ci/woodpecker/pipeline/backend"
backendTypes "github.com/woodpecker-ci/woodpecker/pipeline/backend/types"
"github.com/woodpecker-ci/woodpecker/pipeline/frontend"
"github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml"
"github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml/compiler"
Expand Down Expand Up @@ -180,7 +180,12 @@ func execWithAxis(c *cli.Context, file, repoPath string, axis matrix.Axis) error
compiler.WithSecret(secrets...),
compiler.WithEnviron(droneEnv),
).Compile(conf)
engine := docker.New()

engine, err := backend.FindEngine(c.String("backend-engine"))
if err != nil {
return err
}

if err = engine.Load(); err != nil {
return err
}
Expand Down Expand Up @@ -273,7 +278,7 @@ func convertPathForWindows(path string) string {
return filepath.ToSlash(path)
}

var defaultLogger = pipeline.LogFunc(func(proc *backend.Step, rc multipart.Reader) error {
var defaultLogger = pipeline.LogFunc(func(proc *backendTypes.Step, rc multipart.Reader) error {
part, err := rc.NextPart()
if err != nil {
return err
Expand Down
10 changes: 8 additions & 2 deletions cli/exec/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,23 @@ var flags = []cli.Flag{
Usage: "external networks",
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_DOCKER_PREFIX"},
EnvVars: []string{"WOODPECKER_PREFIX"},
Name: "prefix",
Value: "woodpecker",
Usage: "prefix containers created by woodpecker",
Usage: "prefix used for containers, volumes, networks, ... created by woodpecker",
Hidden: true,
},
&cli.StringSliceFlag{
Name: "privileged",
Usage: "privileged plugins",
Value: cli.NewStringSlice(constant.PrivilegedPlugins...),
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND"},
Name: "backend-engine",
Usage: "backend engine to run pipelines on",
Value: "auto-detect",
},

//
// Please note the below flags should match the flags from
Expand Down

0 comments on commit 1cc8122

Please # to comment.