option to disable netrc for non-clone steps

This commit is contained in:
Brad Rydzewski
2020-08-13 17:44:20 -04:00
parent c3fc3fcf3a
commit bde3fbb785
7 changed files with 49 additions and 22 deletions

View File

@@ -92,6 +92,10 @@ type Config struct {
SkipVerify bool `envconfig:"DRONE_SECRET_PLUGIN_SKIP_VERIFY"`
}
Netrc struct {
CloneOnly bool `envconfig:"DRONE_NETRC_CLONE_ONLY"`
}
Registry struct {
Endpoint string `envconfig:"DRONE_REGISTRY_PLUGIN_ENDPOINT"`
Token string `envconfig:"DRONE_REGISTRY_PLUGIN_TOKEN"`

View File

@@ -93,6 +93,11 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
if err == context.Canceled {
break
}
select {
case <-ctx.Done():
return ctx.Err()
default:
}
if err != nil {
logrus.WithError(err).
Errorln("cannot ping the docker daemon")
@@ -111,6 +116,7 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
runner := &runtime.Runner{
Client: cli,
Machine: config.Runner.Name,
Environ: config.Runner.Environ,
Reporter: tracer,
Lookup: resource.Lookup,
Lint: linter.New().Lint,
@@ -120,11 +126,12 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
config.Limit.Trusted,
),
Compiler: &compiler.Compiler{
Clone: config.Runner.Clone,
Privileged: append(config.Runner.Privileged, compiler.Privileged...),
Networks: config.Runner.Networks,
NetworkOpts: config.Runner.NetworkOpts,
Volumes: config.Runner.Volumes,
Clone: config.Runner.Clone,
Privileged: append(config.Runner.Privileged, compiler.Privileged...),
Networks: config.Runner.Networks,
NetworkOpts: config.Runner.NetworkOpts,
NetrcCloneOnly: config.Netrc.CloneOnly,
Volumes: config.Runner.Volumes,
Resources: compiler.Resources{
Memory: config.Resources.Memory,
MemorySwap: config.Resources.MemorySwap,

View File

@@ -66,15 +66,17 @@ func (c *processCommand) run(*kingpin.ParseContext) error {
runner := &runtime.Runner{
Client: cli,
Machine: config.Runner.Name,
Environ: config.Runner.Environ,
Reporter: remote,
Lookup: resource.Lookup,
Lint: linter.New().Lint,
Match: nil,
Compiler: &compiler.Compiler{
Clone: config.Runner.Clone,
Privileged: append(config.Runner.Privileged, compiler.Privileged...),
Networks: config.Runner.Networks,
Volumes: config.Runner.Volumes,
Clone: config.Runner.Clone,
Privileged: append(config.Runner.Privileged, compiler.Privileged...),
Networks: config.Runner.Networks,
NetrcCloneOnly: config.Netrc.CloneOnly,
Volumes: config.Runner.Volumes,
Resources: compiler.Resources{
Memory: config.Resources.Memory,
MemorySwap: config.Resources.MemorySwap,