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

Add backend selection for agent (#463)

- add backend selection option
- by default it will auto-detect a backend
This commit is contained in:
Anbraten
2021-11-26 03:34:48 +01:00
committed by GitHub
parent 65e10d46b3
commit c1a8884d62
28 changed files with 250 additions and 174 deletions

View File

@@ -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