support for new env plugin

This commit is contained in:
Brad Rydzewski
2019-11-20 10:01:42 -08:00
parent 6c9e3ac5c0
commit 8fa2a23129
10 changed files with 47 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/drone-runners/drone-runner-docker/engine/resource"
"github.com/drone/envsubst"
"github.com/drone/runner-go/environ"
"github.com/drone/runner-go/environ/provider"
"github.com/drone/runner-go/manifest"
"github.com/drone/runner-go/registry"
"github.com/drone/runner-go/secret"
@@ -97,7 +98,7 @@ func (c *compileCommand) run(*kingpin.ParseContext) error {
// compile the pipeline to an intermediate representation.
comp := &compiler.Compiler{
Environ: c.Environ,
Environ: provider.Static(c.Environ),
Labels: c.Labels,
Resources: c.Resources,
Privileged: append(c.Privileged, compiler.Privileged...),

View File

@@ -78,6 +78,12 @@ type Config struct {
CPUSet []string `envconfig:"DRONE_CPU_SET"`
}
Environ struct {
Endpoint string `envconfig:"DRONE_ENV_PLUGIN_ENDPOINT"`
Token string `envconfig:"DRONE_ENV_PLUGIN_TOKEN"`
SkipVerify bool `envconfig:"DRONE_ENV_PLUGIN_SKIP_VERIFY"`
}
Secret struct {
Endpoint string `envconfig:"DRONE_SECRET_PLUGIN_ENDPOINT"`
Token string `envconfig:"DRONE_SECRET_PLUGIN_TOKEN"`

View File

@@ -16,6 +16,7 @@ import (
"github.com/drone-runners/drone-runner-docker/runtime"
"github.com/drone/runner-go/client"
"github.com/drone/runner-go/environ/provider"
"github.com/drone/runner-go/handler/router"
"github.com/drone/runner-go/logger"
loghistory "github.com/drone/runner-go/logger/history"
@@ -120,7 +121,6 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
),
Compiler: &compiler.Compiler{
Clone: config.Runner.Clone,
Environ: config.Runner.Environ,
Privileged: append(config.Runner.Privileged, compiler.Privileged...),
Networks: config.Runner.Networks,
Volumes: config.Runner.Volumes,
@@ -132,6 +132,14 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
CPUShares: config.Resources.CPUShares,
CPUSet: config.Resources.CPUSet,
},
Environ: provider.Combine(
provider.Static(config.Runner.Environ),
provider.External(
config.Environ.Endpoint,
config.Environ.Token,
config.Environ.SkipVerify,
),
),
Registry: registry.Combine(
registry.File(
config.Docker.Config,

View File

@@ -22,6 +22,7 @@ import (
"github.com/drone/drone-go/drone"
"github.com/drone/envsubst"
"github.com/drone/runner-go/environ"
"github.com/drone/runner-go/environ/provider"
"github.com/drone/runner-go/logger"
"github.com/drone/runner-go/manifest"
"github.com/drone/runner-go/pipeline"
@@ -117,7 +118,7 @@ func (c *execCommand) run(*kingpin.ParseContext) error {
// compile the pipeline to an intermediate representation.
comp := &compiler.Compiler{
Environ: c.Environ,
Environ: provider.Static(c.Environ),
Labels: c.Labels,
Resources: c.Resources,
Privileged: append(c.Privileged, compiler.Privileged...),