only expose netrc when private repo

This commit is contained in:
Brad Rydzewski 2017-03-19 17:07:21 +08:00
parent b6321a4137
commit da1193734c
4 changed files with 46 additions and 26 deletions

View file

@ -464,7 +464,14 @@ func (b *builder) Build() ([]*buildItem, error) {
// TODO ability to customize the escalated plugins
compiler.WithEscalated("plugins/docker", "plugins/gcr", "plugins/ecr"),
compiler.WithLocal(false),
compiler.WithNetrc(b.Netrc.Login, b.Netrc.Password, b.Netrc.Machine),
compiler.WithOption(
compiler.WithNetrc(
b.Netrc.Login,
b.Netrc.Password,
b.Netrc.Machine,
),
b.Repo.IsPrivate,
),
compiler.WithPrefix(
fmt.Sprintf(
"%d_%d",

View file

@ -28,9 +28,11 @@ func (c *Compiler) createProcess(name string, container *yaml.Container) *backen
},
}
volumes := []string{
workspace,
var volumes []string
if !c.local {
volumes = append(volumes, workspace)
}
volumes = append(volumes, c.volumes...)
for _, volume := range container.Volumes.Volumes {
volumes = append(volumes, volume.String())
}

View file

@ -12,6 +12,17 @@ import (
// Option configures a compiler option.
type Option func(*Compiler)
// WithOption configures the compiler with the given option if
// boolean b evaluates to true.
func WithOption(option Option, b bool) Option {
switch {
case b:
return option
default:
return func(compiler *Compiler) {}
}
}
// WithVolumes configutes the compiler with default volumes that
// are mounted to each container in the pipeline.
func WithVolumes(volumes ...string) Option {

46
vendor/vendor.json vendored
View file

@ -28,68 +28,68 @@
{
"checksumSHA1": "W3AuK8ocqHwlUajGmQLFvnRhTZE=",
"path": "github.com/cncd/pipeline/pipeline",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "Qu2FreqaMr8Yx2bW9O0cxAGgjr0=",
"path": "github.com/cncd/pipeline/pipeline/backend",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "0CGXRaYwZhJxGIrGhn8WGpkFqPo=",
"path": "github.com/cncd/pipeline/pipeline/backend/docker",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "/8wE+cVb7T4PQZgpLNu0DHzKGuE=",
"path": "github.com/cncd/pipeline/pipeline/frontend",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "O0sulBQAHJeNLg3lO38Cq5uf/eg=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "srNvtlujHSHC8YXrnFPdy5V7qoQ=",
"checksumSHA1": "ftyr9EJQl9D5OvzOcqGBS6stt0g=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/compiler",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "Q0GkNUFamVYIA1Fd8r0A5M6Gx54=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/linter",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "kx2sPUIMozPC/g6E4w48h3FfH3k=",
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/matrix",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "2/3f3oNmxXy5kcrRLCFa24Oc9O4=",
"path": "github.com/cncd/pipeline/pipeline/interrupt",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "uOjTfke7Qxosrivgz/nVTHeIP5g=",
"path": "github.com/cncd/pipeline/pipeline/multipart",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "MratmNKJ78/IhWvDsZphN01CtmE=",
"path": "github.com/cncd/pipeline/pipeline/rpc",
"revision": "3614f41e777232289a3cd479c2301274556e3346",
"revisionTime": "2017-03-14T15:17:46Z"
"revision": "addc99dad68008570994f8de318101adfe4161a6",
"revisionTime": "2017-03-19T09:04:25Z"
},
{
"checksumSHA1": "7Qj1DK0ceAXkYztW0l3+L6sn+V8=",