support for remote tmate servers

This commit is contained in:
Brad Rydzewski
2020-11-20 16:47:52 -05:00
parent 9466e54a6c
commit 00b690ce8c
7 changed files with 55 additions and 13 deletions

View File

@@ -202,6 +202,18 @@ func registerCompile(app *kingpin.Application) {
cmd.Flag("tmate-enabled", "tmate enabled").
BoolVar(&c.Tmate.Enabled)
cmd.Flag("tmate-server-host", "tmate server host").
StringVar(&c.Tmate.Server)
cmd.Flag("tmate-server-port", "tmate server port").
StringVar(&c.Tmate.Port)
cmd.Flag("tmate-server-rsa-fingerprint", "tmate server rsa fingerprint").
StringVar(&c.Tmate.RSA)
cmd.Flag("tmate-server-ed25519-fingerprint", "tmate server rsa fingerprint").
StringVar(&c.Tmate.ED25519)
// shared pipeline flags
c.Flags = internal.ParseFlags(cmd)
}

View File

@@ -110,6 +110,10 @@ type Config struct {
Tmate struct {
Enabled bool `envconfig:"DRONE_TMATE_ENABLED" default:"false"`
Image string `envconfig:"DRONE_TMATE_IMAGE" default:"drone/drone-runner-docker:1"`
Server string `envconfig:"DRONE_TMATE_HOST"`
Port string `envconfig:"DRONE_TMATE_PORT"`
RSA string `envconfig:"DRONE_TMATE_FINGERPRINT_RSA"`
ED25519 string `envconfig:"DRONE_TMATE_FINGERPRINT_ED25519"`
}
}

View File

@@ -144,6 +144,10 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
Tmate: compiler.Tmate{
Image: config.Tmate.Image,
Enabled: config.Tmate.Enabled,
Server: config.Tmate.Server,
Port: config.Tmate.Port,
RSA: config.Tmate.RSA,
ED25519: config.Tmate.ED25519,
},
Environ: provider.Combine(
provider.Static(config.Runner.Environ),

View File

@@ -336,6 +336,18 @@ func registerExec(app *kingpin.Application) {
cmd.Flag("tmate-enabled", "tmate enabled").
BoolVar(&c.Tmate.Enabled)
cmd.Flag("tmate-server-host", "tmate server host").
StringVar(&c.Tmate.Server)
cmd.Flag("tmate-server-port", "tmate server port").
StringVar(&c.Tmate.Port)
cmd.Flag("tmate-server-rsa-fingerprint", "tmate server rsa fingerprint").
StringVar(&c.Tmate.RSA)
cmd.Flag("tmate-server-ed25519-fingerprint", "tmate server rsa fingerprint").
StringVar(&c.Tmate.ED25519)
cmd.Flag("debug", "enable debug logging").
BoolVar(&c.Debug)