From c1a8884d62be9f8c1bf7774a134cf6c1282667d0 Mon Sep 17 00:00:00 2001 From: Anbraten Date: Fri, 26 Nov 2021 03:34:48 +0100 Subject: [PATCH] Add backend selection for agent (#463) - add backend selection option - by default it will auto-detect a backend --- agent/runner.go | 2 +- cli/exec/exec.go | 6 +- cmd/agent/agent.go | 17 ++- cmd/agent/flags.go | 6 + pipeline/backend/backend.go | 55 ++++++---- pipeline/backend/docker/convert.go | 8 +- pipeline/backend/docker/docker.go | 28 +++-- pipeline/backend/kubernetes/kubernetes.go | 30 +++-- pipeline/backend/types.go | 116 -------------------- pipeline/backend/types/auth.go | 8 ++ pipeline/backend/types/config.go | 9 ++ pipeline/backend/types/conn.go | 7 ++ pipeline/backend/types/engine.go | 35 ++++++ pipeline/backend/types/network.go | 8 ++ pipeline/backend/types/secret.go | 9 ++ pipeline/backend/types/stage.go | 8 ++ pipeline/backend/types/state.go | 11 ++ pipeline/backend/types/step.go | 35 ++++++ pipeline/backend/types/volume.go | 8 ++ pipeline/frontend/yaml/compiler/compiler.go | 2 +- pipeline/frontend/yaml/compiler/convert.go | 2 +- pipeline/logger.go | 2 +- pipeline/option.go | 2 +- pipeline/parse.go | 2 +- pipeline/pipeline.go | 2 +- pipeline/rpc/client_grpc.go | 2 +- pipeline/rpc/peer.go | 2 +- server/shared/procBuilder.go | 2 +- 28 files changed, 250 insertions(+), 174 deletions(-) delete mode 100644 pipeline/backend/types.go create mode 100644 pipeline/backend/types/auth.go create mode 100644 pipeline/backend/types/config.go create mode 100644 pipeline/backend/types/conn.go create mode 100644 pipeline/backend/types/engine.go create mode 100644 pipeline/backend/types/network.go create mode 100644 pipeline/backend/types/secret.go create mode 100644 pipeline/backend/types/stage.go create mode 100644 pipeline/backend/types/state.go create mode 100644 pipeline/backend/types/step.go create mode 100644 pipeline/backend/types/volume.go diff --git a/agent/runner.go b/agent/runner.go index 5eae87e9a..c8db4b8cc 100644 --- a/agent/runner.go +++ b/agent/runner.go @@ -28,7 +28,7 @@ import ( "google.golang.org/grpc/metadata" "github.com/woodpecker-ci/woodpecker/pipeline" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" "github.com/woodpecker-ci/woodpecker/pipeline/multipart" "github.com/woodpecker-ci/woodpecker/pipeline/rpc" ) diff --git a/cli/exec/exec.go b/cli/exec/exec.go index e0e5f45ca..37ea2eb0f 100644 --- a/cli/exec/exec.go +++ b/cli/exec/exec.go @@ -15,8 +15,8 @@ import ( "github.com/woodpecker-ci/woodpecker/cli/common" "github.com/woodpecker-ci/woodpecker/pipeline" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" "github.com/woodpecker-ci/woodpecker/pipeline/backend/docker" + backend "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" @@ -158,8 +158,8 @@ func execWithAxis(c *cli.Context, axis matrix.Axis) error { compiler.WithSecret(secrets...), compiler.WithEnviron(droneEnv), ).Compile(conf) - engine, err := docker.NewEnv() - if err != nil { + engine := docker.New() + if err = engine.Load(); err != nil { return err } diff --git a/cmd/agent/agent.go b/cmd/agent/agent.go index 66f9d3b6d..790e01359 100644 --- a/cmd/agent/agent.go +++ b/cmd/agent/agent.go @@ -31,7 +31,7 @@ import ( "google.golang.org/grpc/metadata" "github.com/woodpecker-ci/woodpecker/agent" - "github.com/woodpecker-ci/woodpecker/pipeline/backend/docker" + "github.com/woodpecker-ci/woodpecker/pipeline/backend" "github.com/woodpecker-ci/woodpecker/pipeline/rpc" ) @@ -138,13 +138,22 @@ func loop(c *cli.Context) error { return } - // new docker engine - engine, err := docker.NewEnv() + // new engine + engine, err := backend.FindEngine(c.String("backend-engine")) if err != nil { - log.Error().Err(err).Msg("cannot create docker client") + log.Error().Err(err).Msgf("cannot find backend engine '%s'", c.String("backend-engine")) return } + // load enginge (e.g. init api client) + err = engine.Load() + if err != nil { + log.Error().Err(err).Msg("cannot load backend engine") + return + } + + log.Debug().Msgf("loaded %s backend engine", engine.Name()) + r := agent.NewRunner(client, filter, hostname, counter, &engine) if err := r.Run(ctx); err != nil { log.Error().Err(err).Msg("pipeline done with error") diff --git a/cmd/agent/flags.go b/cmd/agent/flags.go index c36d5599b..3270959ad 100644 --- a/cmd/agent/flags.go +++ b/cmd/agent/flags.go @@ -110,4 +110,10 @@ var flags = []cli.Flag{ Usage: "should the grpc server certificate be verified, only valid when WOODPECKER_GRPC_SECURE is true", Value: true, }, + &cli.StringFlag{ + EnvVars: []string{"WOODPECKER_BACKEND"}, + Name: "backend-engine", + Usage: "backend engine to run pipelines on", + Value: "auto-detect", + }, } diff --git a/pipeline/backend/backend.go b/pipeline/backend/backend.go index 65d232800..06c93a8d4 100644 --- a/pipeline/backend/backend.go +++ b/pipeline/backend/backend.go @@ -1,29 +1,44 @@ package backend import ( - "context" - "io" + "fmt" + + "github.com/woodpecker-ci/woodpecker/pipeline/backend/docker" + "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" ) -// Engine defines a container orchestration backend and is used -// to create and manage container resources. -type Engine interface { - // Setup the pipeline environment. - Setup(context.Context, *Config) error +var ( + engines map[string]types.Engine +) - // Exec start the pipeline step. - Exec(context.Context, *Step) error +func init() { + engines = make(map[string]types.Engine) - // Kill the pipeline step. - Kill(context.Context, *Step) error + // TODO: disabled for now as kubernetes backend has not been implemented yet + // kubernetes + // engine = kubernetes.New("", "", "") + // engines[engine.Name()] = engine - // Wait for the pipeline step to complete and returns - // the completion results. - Wait(context.Context, *Step) (*State, error) - - // Tail the pipeline step logs. - Tail(context.Context, *Step) (io.ReadCloser, error) - - // Destroy the pipeline environment. - Destroy(context.Context, *Config) error + // docker + engine := docker.New() + engines[engine.Name()] = engine +} + +func FindEngine(engineName string) (types.Engine, error) { + if engineName == "auto-detect" { + for _, engine := range engines { + if engine.IsAvivable() { + return engine, nil + } + } + + return nil, fmt.Errorf("Can't detect an avivable backend engine") + } + + engine, ok := engines[engineName] + if !ok { + return nil, fmt.Errorf("Backend engine '%s' not found", engineName) + } + + return engine, nil } diff --git a/pipeline/backend/docker/convert.go b/pipeline/backend/docker/convert.go index 8cfe93b17..b17eef16e 100644 --- a/pipeline/backend/docker/convert.go +++ b/pipeline/backend/docker/convert.go @@ -8,11 +8,11 @@ import ( "github.com/docker/docker/api/types/container" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" ) // returns a container configuration. -func toConfig(proc *backend.Step) *container.Config { +func toConfig(proc *types.Step) *container.Config { config := &container.Config{ Image: proc.Image, Labels: proc.Labels, @@ -36,7 +36,7 @@ func toConfig(proc *backend.Step) *container.Config { } // returns a container host configuration. -func toHostConfig(proc *backend.Step) *container.HostConfig { +func toHostConfig(proc *types.Step) *container.HostConfig { config := &container.HostConfig{ Resources: container.Resources{ CPUQuota: proc.CPUQuota, @@ -146,7 +146,7 @@ func toDev(paths []string) []container.DeviceMapping { // helper function that serializes the auth configuration as JSON // base64 payload. -func encodeAuthToBase64(authConfig backend.Auth) (string, error) { +func encodeAuthToBase64(authConfig types.Auth) (string, error) { buf, err := json.Marshal(authConfig) if err != nil { return "", err diff --git a/pipeline/backend/docker/docker.go b/pipeline/backend/docker/docker.go index 982e372c8..1bb6915da 100644 --- a/pipeline/backend/docker/docker.go +++ b/pipeline/backend/docker/docker.go @@ -14,28 +14,38 @@ import ( "github.com/moby/term" "github.com/rs/zerolog/log" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" ) type engine struct { client client.APIClient } -// New returns a new Docker Engine using the given client. -func New(cli client.APIClient) backend.Engine { +// New returns a new Docker Engine. +func New() backend.Engine { return &engine{ - client: cli, + client: nil, } } -// NewEnv returns a new Docker Engine using the client connection -// environment variables. -func NewEnv() (backend.Engine, error) { +func (e *engine) Name() string { + return "docker" +} + +func (e *engine) IsAvivable() bool { + _, err := os.Stat("/.dockerenv") + return os.IsNotExist(err) +} + +// Load new client for Docker Engine using environment variables. +func (e *engine) Load() error { cli, err := client.NewClientWithOpts(client.FromEnv) if err != nil { - return nil, err + return err } - return New(cli), nil + e.client = cli + + return nil } func (e *engine) Setup(_ context.Context, conf *backend.Config) error { diff --git a/pipeline/backend/kubernetes/kubernetes.go b/pipeline/backend/kubernetes/kubernetes.go index 226208e0b..63370803a 100644 --- a/pipeline/backend/kubernetes/kubernetes.go +++ b/pipeline/backend/kubernetes/kubernetes.go @@ -3,8 +3,9 @@ package kubernetes import ( "context" "io" + "os" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" ) type engine struct { @@ -14,7 +15,7 @@ type engine struct { } // New returns a new Kubernetes Engine. -func New(namespace, endpoint, token string) backend.Engine { +func New(namespace, endpoint, token string) types.Engine { return &engine{ namespace: namespace, endpoint: endpoint, @@ -22,40 +23,53 @@ func New(namespace, endpoint, token string) backend.Engine { } } +func (e *engine) Name() string { + return "kubernetes" +} + +func (e *engine) IsAvivable() bool { + host := os.Getenv("KUBERNETES_SERVICE_HOST") + return len(host) > 0 +} + +func (e *engine) Load() error { + return nil +} + // Setup the pipeline environment. -func (e *engine) Setup(context.Context, *backend.Config) error { +func (e *engine) Setup(context.Context, *types.Config) error { // POST /api/v1/namespaces return nil } // Start the pipeline step. -func (e *engine) Exec(context.Context, *backend.Step) error { +func (e *engine) Exec(context.Context, *types.Step) error { // POST /api/v1/namespaces/{namespace}/pods return nil } // DEPRECATED // Kill the pipeline step. -func (e *engine) Kill(context.Context, *backend.Step) error { +func (e *engine) Kill(context.Context, *types.Step) error { return nil } // Wait for the pipeline step to complete and returns // the completion results. -func (e *engine) Wait(context.Context, *backend.Step) (*backend.State, error) { +func (e *engine) Wait(context.Context, *types.Step) (*types.State, error) { // GET /api/v1/watch/namespaces/{namespace}/pods // GET /api/v1/watch/namespaces/{namespace}/pods/{name} return nil, nil } // Tail the pipeline step logs. -func (e *engine) Tail(context.Context, *backend.Step) (io.ReadCloser, error) { +func (e *engine) Tail(context.Context, *types.Step) (io.ReadCloser, error) { // GET /api/v1/namespaces/{namespace}/pods/{name}/log return nil, nil } // Destroy the pipeline environment. -func (e *engine) Destroy(context.Context, *backend.Config) error { +func (e *engine) Destroy(context.Context, *types.Config) error { // DELETE /api/v1/namespaces/{name} return nil } diff --git a/pipeline/backend/types.go b/pipeline/backend/types.go deleted file mode 100644 index e9132d41b..000000000 --- a/pipeline/backend/types.go +++ /dev/null @@ -1,116 +0,0 @@ -package backend - -type ( - // Config defines the runtime configuration of a pipeline. - Config struct { - Stages []*Stage `json:"pipeline"` // pipeline stages - Networks []*Network `json:"networks"` // network definitions - Volumes []*Volume `json:"volumes"` // volume definitions - Secrets []*Secret `json:"secrets"` // secret definitions - } - - // Stage denotes a collection of one or more steps. - Stage struct { - Name string `json:"name,omitempty"` - Alias string `json:"alias,omitempty"` - Steps []*Step `json:"steps,omitempty"` - } - - // Step defines a container process. - Step struct { - Name string `json:"name"` - Alias string `json:"alias,omitempty"` - Image string `json:"image,omitempty"` - Pull bool `json:"pull,omitempty"` - Detached bool `json:"detach,omitempty"` - Privileged bool `json:"privileged,omitempty"` - WorkingDir string `json:"working_dir,omitempty"` - Environment map[string]string `json:"environment,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - Entrypoint []string `json:"entrypoint,omitempty"` - Command []string `json:"command,omitempty"` - ExtraHosts []string `json:"extra_hosts,omitempty"` - Volumes []string `json:"volumes,omitempty"` - Tmpfs []string `json:"tmpfs,omitempty"` - Devices []string `json:"devices,omitempty"` - Networks []Conn `json:"networks,omitempty"` - DNS []string `json:"dns,omitempty"` - DNSSearch []string `json:"dns_search,omitempty"` - MemSwapLimit int64 `json:"memswap_limit,omitempty"` - MemLimit int64 `json:"mem_limit,omitempty"` - ShmSize int64 `json:"shm_size,omitempty"` - CPUQuota int64 `json:"cpu_quota,omitempty"` - CPUShares int64 `json:"cpu_shares,omitempty"` - CPUSet string `json:"cpu_set,omitempty"` - OnFailure bool `json:"on_failure,omitempty"` - OnSuccess bool `json:"on_success,omitempty"` - AuthConfig Auth `json:"auth_config,omitempty"` - NetworkMode string `json:"network_mode,omitempty"` - IpcMode string `json:"ipc_mode,omitempty"` - Sysctls map[string]string `json:"sysctls,omitempty"` - } - - // Auth defines registry authentication credentials. - Auth struct { - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - Email string `json:"email,omitempty"` - } - - // Conn defines a container network connection. - Conn struct { - Name string `json:"name"` - Aliases []string `json:"aliases"` - } - - // Network defines a container network. - Network struct { - Name string `json:"name,omitempty"` - Driver string `json:"driver,omitempty"` - DriverOpts map[string]string `json:"driver_opts,omitempty"` - } - - // Volume defines a container volume. - Volume struct { - Name string `json:"name,omitempty"` - Driver string `json:"driver,omitempty"` - DriverOpts map[string]string `json:"driver_opts,omitempty"` - } - - // Secret defines a runtime secret - Secret struct { - Name string `json:"name,omitempty"` - Value string `json:"value,omitempty"` - Mount string `json:"mount,omitempty"` - Mask bool `json:"mask,omitempty"` - } - - // State defines a container state. - State struct { - // Container exit code - ExitCode int `json:"exit_code"` - // Container exited, true or false - Exited bool `json:"exited"` - // Container is oom killed, true or false - OOMKilled bool `json:"oom_killed"` - } - - // // State defines the pipeline and process state. - // State struct { - // Pipeline struct { - // // Current pipeline step - // Step *Step `json:"step"` - // // Current pipeline error state - // Error error `json:"error"` - // } - // - // Process struct { - // // Container exit code - // ExitCode int `json:"exit_code"` - // // Container exited, true or false - // Exited bool `json:"exited"` - // // Container is oom killed, true or false - // OOMKilled bool `json:"oom_killed"` - // } - // } -) diff --git a/pipeline/backend/types/auth.go b/pipeline/backend/types/auth.go new file mode 100644 index 000000000..473962a2c --- /dev/null +++ b/pipeline/backend/types/auth.go @@ -0,0 +1,8 @@ +package types + +// Auth defines registry authentication credentials. +type Auth struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Email string `json:"email,omitempty"` +} diff --git a/pipeline/backend/types/config.go b/pipeline/backend/types/config.go new file mode 100644 index 000000000..9afc9a401 --- /dev/null +++ b/pipeline/backend/types/config.go @@ -0,0 +1,9 @@ +package types + +// Config defines the runtime configuration of a pipeline. +type Config struct { + Stages []*Stage `json:"pipeline"` // pipeline stages + Networks []*Network `json:"networks"` // network definitions + Volumes []*Volume `json:"volumes"` // volume definitions + Secrets []*Secret `json:"secrets"` // secret definitions +} diff --git a/pipeline/backend/types/conn.go b/pipeline/backend/types/conn.go new file mode 100644 index 000000000..eb882f029 --- /dev/null +++ b/pipeline/backend/types/conn.go @@ -0,0 +1,7 @@ +package types + +// Conn defines a container network connection. +type Conn struct { + Name string `json:"name"` + Aliases []string `json:"aliases"` +} diff --git a/pipeline/backend/types/engine.go b/pipeline/backend/types/engine.go new file mode 100644 index 000000000..7e71773b7 --- /dev/null +++ b/pipeline/backend/types/engine.go @@ -0,0 +1,35 @@ +package types + +import ( + "context" + "io" +) + +// Engine defines a container orchestration backend and is used +// to create and manage container resources. +type Engine interface { + Name() string + + IsAvivable() bool + + Load() error + + // Setup the pipeline environment. + Setup(context.Context, *Config) error + + // Exec start the pipeline step. + Exec(context.Context, *Step) error + + // Kill the pipeline step. + Kill(context.Context, *Step) error + + // Wait for the pipeline step to complete and returns + // the completion results. + Wait(context.Context, *Step) (*State, error) + + // Tail the pipeline step logs. + Tail(context.Context, *Step) (io.ReadCloser, error) + + // Destroy the pipeline environment. + Destroy(context.Context, *Config) error +} diff --git a/pipeline/backend/types/network.go b/pipeline/backend/types/network.go new file mode 100644 index 000000000..86095f40d --- /dev/null +++ b/pipeline/backend/types/network.go @@ -0,0 +1,8 @@ +package types + +// Network defines a container network. +type Network struct { + Name string `json:"name,omitempty"` + Driver string `json:"driver,omitempty"` + DriverOpts map[string]string `json:"driver_opts,omitempty"` +} diff --git a/pipeline/backend/types/secret.go b/pipeline/backend/types/secret.go new file mode 100644 index 000000000..14ebf44ad --- /dev/null +++ b/pipeline/backend/types/secret.go @@ -0,0 +1,9 @@ +package types + +// Secret defines a runtime secret +type Secret struct { + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` + Mount string `json:"mount,omitempty"` + Mask bool `json:"mask,omitempty"` +} diff --git a/pipeline/backend/types/stage.go b/pipeline/backend/types/stage.go new file mode 100644 index 000000000..cb035db39 --- /dev/null +++ b/pipeline/backend/types/stage.go @@ -0,0 +1,8 @@ +package types + +// Stage denotes a collection of one or more steps. +type Stage struct { + Name string `json:"name,omitempty"` + Alias string `json:"alias,omitempty"` + Steps []*Step `json:"steps,omitempty"` +} diff --git a/pipeline/backend/types/state.go b/pipeline/backend/types/state.go new file mode 100644 index 000000000..45a608f35 --- /dev/null +++ b/pipeline/backend/types/state.go @@ -0,0 +1,11 @@ +package types + +// State defines a container state. +type State struct { + // Container exit code + ExitCode int `json:"exit_code"` + // Container exited, true or false + Exited bool `json:"exited"` + // Container is oom killed, true or false + OOMKilled bool `json:"oom_killed"` +} diff --git a/pipeline/backend/types/step.go b/pipeline/backend/types/step.go new file mode 100644 index 000000000..4550043d6 --- /dev/null +++ b/pipeline/backend/types/step.go @@ -0,0 +1,35 @@ +package types + +// Step defines a container process. +type Step struct { + Name string `json:"name"` + Alias string `json:"alias,omitempty"` + Image string `json:"image,omitempty"` + Pull bool `json:"pull,omitempty"` + Detached bool `json:"detach,omitempty"` + Privileged bool `json:"privileged,omitempty"` + WorkingDir string `json:"working_dir,omitempty"` + Environment map[string]string `json:"environment,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Entrypoint []string `json:"entrypoint,omitempty"` + Command []string `json:"command,omitempty"` + ExtraHosts []string `json:"extra_hosts,omitempty"` + Volumes []string `json:"volumes,omitempty"` + Tmpfs []string `json:"tmpfs,omitempty"` + Devices []string `json:"devices,omitempty"` + Networks []Conn `json:"networks,omitempty"` + DNS []string `json:"dns,omitempty"` + DNSSearch []string `json:"dns_search,omitempty"` + MemSwapLimit int64 `json:"memswap_limit,omitempty"` + MemLimit int64 `json:"mem_limit,omitempty"` + ShmSize int64 `json:"shm_size,omitempty"` + CPUQuota int64 `json:"cpu_quota,omitempty"` + CPUShares int64 `json:"cpu_shares,omitempty"` + CPUSet string `json:"cpu_set,omitempty"` + OnFailure bool `json:"on_failure,omitempty"` + OnSuccess bool `json:"on_success,omitempty"` + AuthConfig Auth `json:"auth_config,omitempty"` + NetworkMode string `json:"network_mode,omitempty"` + IpcMode string `json:"ipc_mode,omitempty"` + Sysctls map[string]string `json:"sysctls,omitempty"` +} diff --git a/pipeline/backend/types/volume.go b/pipeline/backend/types/volume.go new file mode 100644 index 000000000..cc9f8654a --- /dev/null +++ b/pipeline/backend/types/volume.go @@ -0,0 +1,8 @@ +package types + +// Volume defines a container volume. +type Volume struct { + Name string `json:"name,omitempty"` + Driver string `json:"driver,omitempty"` + DriverOpts map[string]string `json:"driver_opts,omitempty"` +} diff --git a/pipeline/frontend/yaml/compiler/compiler.go b/pipeline/frontend/yaml/compiler/compiler.go index cf6f8c096..5742edf94 100644 --- a/pipeline/frontend/yaml/compiler/compiler.go +++ b/pipeline/frontend/yaml/compiler/compiler.go @@ -3,7 +3,7 @@ package compiler import ( "fmt" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" "github.com/woodpecker-ci/woodpecker/pipeline/frontend" "github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml" ) diff --git a/pipeline/frontend/yaml/compiler/convert.go b/pipeline/frontend/yaml/compiler/convert.go index 413682426..d43855492 100644 --- a/pipeline/frontend/yaml/compiler/convert.go +++ b/pipeline/frontend/yaml/compiler/convert.go @@ -7,7 +7,7 @@ import ( "github.com/rs/zerolog/log" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" "github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml" ) diff --git a/pipeline/logger.go b/pipeline/logger.go index cc3b4053f..6ac0e6213 100644 --- a/pipeline/logger.go +++ b/pipeline/logger.go @@ -1,7 +1,7 @@ package pipeline import ( - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" "github.com/woodpecker-ci/woodpecker/pipeline/multipart" ) diff --git a/pipeline/option.go b/pipeline/option.go index bdbe9c2d7..a31c1fa36 100644 --- a/pipeline/option.go +++ b/pipeline/option.go @@ -3,7 +3,7 @@ package pipeline import ( "context" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" ) // Option configures a runtime option. diff --git a/pipeline/parse.go b/pipeline/parse.go index 8354a176e..7f9344c42 100644 --- a/pipeline/parse.go +++ b/pipeline/parse.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" ) // Parse parses the pipeline config from an io.Reader. diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index 2a814bd24..48f9741e5 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -8,7 +8,7 @@ import ( "github.com/rs/zerolog/log" "golang.org/x/sync/errgroup" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" "github.com/woodpecker-ci/woodpecker/pipeline/multipart" ) diff --git a/pipeline/rpc/client_grpc.go b/pipeline/rpc/client_grpc.go index 39d359f89..ab9687a4d 100644 --- a/pipeline/rpc/client_grpc.go +++ b/pipeline/rpc/client_grpc.go @@ -10,7 +10,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" "github.com/woodpecker-ci/woodpecker/pipeline/rpc/proto" ) diff --git a/pipeline/rpc/peer.go b/pipeline/rpc/peer.go index c274a3aea..ddaf515a0 100644 --- a/pipeline/rpc/peer.go +++ b/pipeline/rpc/peer.go @@ -3,7 +3,7 @@ package rpc import ( "context" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "github.com/woodpecker-ci/woodpecker/pipeline/backend/types" ) type ( diff --git a/server/shared/procBuilder.go b/server/shared/procBuilder.go index 4de92102a..c614cd626 100644 --- a/server/shared/procBuilder.go +++ b/server/shared/procBuilder.go @@ -24,7 +24,7 @@ import ( "github.com/drone/envsubst" - "github.com/woodpecker-ci/woodpecker/pipeline/backend" + backend "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"