1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-11-24 08:02:18 +02:00

bump pipeline runner to support network_mode

This commit is contained in:
Brad Rydzewski 2017-06-03 17:29:02 +02:00
parent 911e5f41a3
commit eed03a5803
6 changed files with 50 additions and 44 deletions

View File

@ -50,11 +50,11 @@ func toHostConfig(proc *backend.Step) *container.HostConfig {
// if len(proc.VolumesFrom) != 0 {
// config.VolumesFrom = proc.VolumesFrom
// }
// if len(proc.Network) != 0 {
// config.NetworkMode = container.NetworkMode(
// proc.Network,
// )
// }
if len(proc.NetworkMode) != 0 {
config.NetworkMode = container.NetworkMode(
proc.NetworkMode,
)
}
if len(proc.DNS) != 0 {
config.DNS = proc.DNS
}

View File

@ -103,12 +103,14 @@ func (e *engine) Exec(proc *backend.Step) error {
return err
}
for _, net := range proc.Networks {
err = e.client.NetworkConnect(ctx, net.Name, proc.Name, &network.EndpointSettings{
Aliases: net.Aliases,
})
if err != nil {
return err
if len(proc.NetworkMode) == 0 {
for _, net := range proc.Networks {
err = e.client.NetworkConnect(ctx, net.Name, proc.Name, &network.EndpointSettings{
Aliases: net.Aliases,
})
if err != nil {
return err
}
}
}

View File

@ -44,6 +44,7 @@ type (
OnFailure bool `json:"on_failure,omitempty"`
OnSuccess bool `json:"on_success,omitempty"`
AuthConfig Auth `json:"auth_config,omitempty"`
NetworkMode string `json:"network_mode,omitempty"`
}
// Auth defines registry authentication credentials.

View File

@ -14,11 +14,12 @@ func (c *Compiler) createProcess(name string, container *yaml.Container) *backen
detached bool
workingdir string
workspace = fmt.Sprintf("%s_default:%s", c.prefix, c.base)
privileged = container.Privileged
entrypoint = container.Entrypoint
command = container.Command
image = expandImage(container.Image)
workspace = fmt.Sprintf("%s_default:%s", c.prefix, c.base)
privileged = container.Privileged
entrypoint = container.Entrypoint
command = container.Command
image = expandImage(container.Image)
network_mode = container.NetworkMode
// network = container.Network
)
@ -137,6 +138,7 @@ func (c *Compiler) createProcess(name string, container *yaml.Container) *backen
OnFailure: (len(container.Constraints.Status.Include)+
len(container.Constraints.Status.Exclude) != 0) &&
container.Constraints.Status.Match("failure"),
NetworkMode: network_mode,
}
}

View File

@ -12,6 +12,7 @@ import (
type (
// Config defines a pipeline configuration.
Config struct {
Cache libcompose.Stringorslice
Platform string
Branches Constraint
Workspace Workspace

56
vendor/vendor.json vendored
View File

@ -39,74 +39,74 @@
{
"checksumSHA1": "W3AuK8ocqHwlUajGmQLFvnRhTZE=",
"path": "github.com/cncd/pipeline/pipeline",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "Qu2FreqaMr8Yx2bW9O0cxAGgjr0=",
"checksumSHA1": "rO+djTfB4LrT+FBbpotyUUobOtU=",
"path": "github.com/cncd/pipeline/pipeline/backend",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "0CGXRaYwZhJxGIrGhn8WGpkFqPo=",
"checksumSHA1": "gLqopO27JUHpxbV+jxggCMzqROY=",
"path": "github.com/cncd/pipeline/pipeline/backend/docker",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "8Hj/OZnYZyz5N2hqENCTTaGtkNQ=",
"path": "github.com/cncd/pipeline/pipeline/frontend",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "9opqXFEPe4aCzLgE7WWmcT0luyI=",
"checksumSHA1": "9KYIsY8WlWbrRAP7caEpWT70P9c=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "aDY/KPZW3iFTlpAz3DoYUgNf46A=",
"checksumSHA1": "Pyldit0XriIzyFUmnvjPrghJLzw=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/compiler",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "Q0GkNUFamVYIA1Fd8r0A5M6Gx54=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/linter",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "kx2sPUIMozPC/g6E4w48h3FfH3k=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/matrix",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "L7Q5qJmPITNmvFEEaj5MPwCWFRk=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/types",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "2/3f3oNmxXy5kcrRLCFa24Oc9O4=",
"path": "github.com/cncd/pipeline/pipeline/interrupt",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "uOjTfke7Qxosrivgz/nVTHeIP5g=",
"path": "github.com/cncd/pipeline/pipeline/multipart",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "vWImaniGEUutEvLvNCzTpSRSArg=",
"path": "github.com/cncd/pipeline/pipeline/rpc",
"revision": "c3a088758cdb75599bab803b1c71c604963d3acf",
"revisionTime": "2017-05-16T10:40:40Z"
"revision": "29b52c5e09e461941f262919903e2cc5a49de080",
"revisionTime": "2017-06-03T15:27:13Z"
},
{
"checksumSHA1": "7Qj1DK0ceAXkYztW0l3+L6sn+V8=",