cmd/tailscale: promote new serve/funnel CLI to be default (#9833)

The change is being kept to a minimum to make a revert easy if necessary. After the release, we will go back for a final cleanup.

updates #8489

Signed-off-by: Tyler Smalley <tyler@tailscale.com>
pull/9848/head
Tyler Smalley 1 year ago committed by GitHub
parent f53c3be07c
commit ddb2a6eb8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,7 +13,6 @@ import (
"strings" "strings"
"github.com/peterbourgon/ff/v3/ffcli" "github.com/peterbourgon/ff/v3/ffcli"
"tailscale.com/envknob"
"tailscale.com/ipn" "tailscale.com/ipn"
"tailscale.com/ipn/ipnstate" "tailscale.com/ipn/ipnstate"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
@ -22,13 +21,10 @@ import (
var funnelCmd = func() *ffcli.Command { var funnelCmd = func() *ffcli.Command {
se := &serveEnv{lc: &localClient} se := &serveEnv{lc: &localClient}
// This flag is used to switch to an in-development // previously used to serve legacy newFunnelCommand unless useWIPCode is true
// implementation of the tailscale funnel command. // change is limited to make a revert easier and full cleanup to come after the relase.
// See https://github.com/tailscale/tailscale/issues/7844 // TODO(tylersmalley): cleanup and removal of newFunnelCommand as of 2023-10-16
if envknob.UseWIPCode() { return newServeV2Command(se, funnel)
return newServeDevCommand(se, funnel)
}
return newFunnelCommand(se)
} }
// newFunnelCommand returns a new "funnel" subcommand using e as its environment. // newFunnelCommand returns a new "funnel" subcommand using e as its environment.

@ -24,7 +24,6 @@ import (
"github.com/peterbourgon/ff/v3/ffcli" "github.com/peterbourgon/ff/v3/ffcli"
"tailscale.com/client/tailscale" "tailscale.com/client/tailscale"
"tailscale.com/envknob"
"tailscale.com/ipn" "tailscale.com/ipn"
"tailscale.com/ipn/ipnstate" "tailscale.com/ipn/ipnstate"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
@ -34,17 +33,14 @@ import (
var serveCmd = func() *ffcli.Command { var serveCmd = func() *ffcli.Command {
se := &serveEnv{lc: &localClient} se := &serveEnv{lc: &localClient}
// This flag is used to switch to an in-development // previously used to serve legacy newFunnelCommand unless useWIPCode is true
// implementation of the tailscale funnel command. // change is limited to make a revert easier and full cleanup to come after the relase.
// See https://github.com/tailscale/tailscale/issues/7844 // TODO(tylersmalley): cleanup and removal of newServeLegacyCommand as of 2023-10-16
if envknob.UseWIPCode() { return newServeV2Command(se, serve)
return newServeDevCommand(se, serve)
}
return newServeCommand(se)
} }
// newServeCommand returns a new "serve" subcommand using e as its environment. // newServeLegacyCommand returns a new "serve" subcommand using e as its environment.
func newServeCommand(e *serveEnv) *ffcli.Command { func newServeLegacyCommand(e *serveEnv) *ffcli.Command {
return &ffcli.Command{ return &ffcli.Command{
Name: "serve", Name: "serve",
ShortHelp: "Serve content and local servers", ShortHelp: "Serve content and local servers",

@ -713,7 +713,7 @@ func TestServeConfigMutations(t *testing.T) {
cmd = newFunnelCommand(e) cmd = newFunnelCommand(e)
args = st.command[1:] args = st.command[1:]
} else { } else {
cmd = newServeCommand(e) cmd = newServeLegacyCommand(e)
args = st.command args = st.command
} }
err := cmd.ParseAndRun(context.Background(), args) err := cmd.ParseAndRun(context.Background(), args)

@ -94,8 +94,8 @@ func buildShortUsage(subcmd string) string {
}, "\n ") }, "\n ")
} }
// newServeDevCommand returns a new "serve" subcommand using e as its environment. // newServeV2Command returns a new "serve" subcommand using e as its environment.
func newServeDevCommand(e *serveEnv, subcmd serveMode) *ffcli.Command { func newServeV2Command(e *serveEnv, subcmd serveMode) *ffcli.Command {
if subcmd != serve && subcmd != funnel { if subcmd != serve && subcmd != funnel {
log.Fatalf("newServeDevCommand called with unknown subcmd %q", subcmd) log.Fatalf("newServeDevCommand called with unknown subcmd %q", subcmd)
} }

@ -746,7 +746,7 @@ func TestServeDevConfigMutations(t *testing.T) {
if st.command[0] == "funnel" { if st.command[0] == "funnel" {
mode = funnel mode = funnel
} }
cmd = newServeDevCommand(e, mode) cmd = newServeV2Command(e, mode)
args = st.command[1:] args = st.command[1:]
err := cmd.ParseAndRun(context.Background(), args) err := cmd.ParseAndRun(context.Background(), args)
Loading…
Cancel
Save