source tmate binary from docker image
This commit is contained in:
@@ -37,6 +37,7 @@ type compileCommand struct {
|
||||
Labels map[string]string
|
||||
Secrets map[string]string
|
||||
Resources compiler.Resources
|
||||
Tmate compiler.Tmate
|
||||
Clone bool
|
||||
Config string
|
||||
}
|
||||
@@ -101,6 +102,7 @@ func (c *compileCommand) run(*kingpin.ParseContext) error {
|
||||
Environ: provider.Static(c.Environ),
|
||||
Labels: c.Labels,
|
||||
Resources: c.Resources,
|
||||
Tmate: c.Tmate,
|
||||
Privileged: append(c.Privileged, compiler.Privileged...),
|
||||
Networks: c.Networks,
|
||||
Volumes: c.Volumes,
|
||||
@@ -192,6 +194,13 @@ func registerCompile(app *kingpin.Application) {
|
||||
cmd.Flag("docker-config", "path to the docker config file").
|
||||
StringVar(&c.Config)
|
||||
|
||||
cmd.Flag("tmate-image", "tmate docker image").
|
||||
Default("drone/drone-runner-docker:latest").
|
||||
StringVar(&c.Tmate.Image)
|
||||
|
||||
cmd.Flag("tmate-enabled", "tmate enabled").
|
||||
BoolVar(&c.Tmate.Enabled)
|
||||
|
||||
// shared pipeline flags
|
||||
c.Flags = internal.ParseFlags(cmd)
|
||||
}
|
||||
|
||||
@@ -106,6 +106,11 @@ type Config struct {
|
||||
Config string `envconfig:"DRONE_DOCKER_CONFIG"`
|
||||
Stream bool `envconfig:"DRONE_DOCKER_STREAM_PULL" default:"true"`
|
||||
}
|
||||
|
||||
Tmate struct {
|
||||
Enabled bool `envconfig:"DRONE_TMATE_ENABLED" default:"true"`
|
||||
Image string `envconfig:"DRONE_TMATE_IMAGE" default:"drone/drone-runner-docker:latest"`
|
||||
}
|
||||
}
|
||||
|
||||
// legacy environment variables. the key is the legacy
|
||||
|
||||
@@ -141,6 +141,10 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
|
||||
CPUSet: config.Resources.CPUSet,
|
||||
ShmSize: config.Resources.ShmSize,
|
||||
},
|
||||
Tmate: compiler.Tmate{
|
||||
Image: config.Tmate.Image,
|
||||
Enabled: config.Tmate.Enabled,
|
||||
},
|
||||
Environ: provider.Combine(
|
||||
provider.Static(config.Runner.Environ),
|
||||
provider.External(
|
||||
|
||||
@@ -49,6 +49,7 @@ type execCommand struct {
|
||||
Labels map[string]string
|
||||
Secrets map[string]string
|
||||
Resources compiler.Resources
|
||||
Tmate compiler.Tmate
|
||||
Clone bool
|
||||
Config string
|
||||
Pretty bool
|
||||
@@ -120,6 +121,7 @@ func (c *execCommand) run(*kingpin.ParseContext) error {
|
||||
Environ: provider.Static(c.Environ),
|
||||
Labels: c.Labels,
|
||||
Resources: c.Resources,
|
||||
Tmate: c.Tmate,
|
||||
Privileged: append(c.Privileged, compiler.Privileged...),
|
||||
Networks: c.Networks,
|
||||
Volumes: c.Volumes,
|
||||
@@ -327,6 +329,13 @@ func registerExec(app *kingpin.Application) {
|
||||
cmd.Flag("docker-config", "path to the docker config file").
|
||||
StringVar(&c.Config)
|
||||
|
||||
cmd.Flag("tmate-image", "tmate docker image").
|
||||
Default("drone/drone-runner-docker:latest").
|
||||
StringVar(&c.Tmate.Image)
|
||||
|
||||
cmd.Flag("tmate-enabled", "tmate enabled").
|
||||
BoolVar(&c.Tmate.Enabled)
|
||||
|
||||
cmd.Flag("debug", "enable debug logging").
|
||||
BoolVar(&c.Debug)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user