Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rename template update to template push #3307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cli/templateupdate.go → cli/templatepush.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/coder/coder/provisionersdk"
)

func templateUpdate() *cobra.Command {
func templatePush() *cobra.Command {
var (
directory string
provisioner string
Expand All @@ -25,9 +25,9 @@ func templateUpdate() *cobra.Command {
)

cmd := &cobra.Command{
Use: "update [template]",
Use: "push [template]",
Args: cobra.MaximumNArgs(1),
Short: "Update the source-code of a template from the current directory or as specified by flag",
Short: "Push a new template version from the current directory or as specified by flag",
RunE: func(cmd *cobra.Command, args []string) error {
client, err := createClient(cmd)
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions cli/templateupdate_test.go → cli/templatepush_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/coder/coder/pty/ptytest"
)

func TestTemplateUpdate(t *testing.T) {
func TestTemplatePush(t *testing.T) {
t.Parallel()
// NewParameter will:
// 1. Create a template version with 0 params
Expand All @@ -43,7 +43,7 @@ func TestTemplateUpdate(t *testing.T) {
Parse: createTestParseResponse(),
Provision: echo.ProvisionComplete,
})
cmd, root := clitest.New(t, "templates", "update", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
cmd, root := clitest.New(t, "templates", "push", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t)
cmd.SetIn(pty.Input())
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestTemplateUpdate(t *testing.T) {

// Second update of the same source requires no prompt since the params
// are carried over.
cmd, root = clitest.New(t, "templates", "update", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
cmd, root = clitest.New(t, "templates", "push", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
clitest.SetupConfig(t, client, root)
go func() {
execDone <- cmd.Execute()
Expand All @@ -95,7 +95,7 @@ func TestTemplateUpdate(t *testing.T) {
Provision: echo.ProvisionComplete,
})

cmd, root = clitest.New(t, "templates", "update", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
cmd, root = clitest.New(t, "templates", "push", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
clitest.SetupConfig(t, client, root)
go func() {
execDone <- cmd.Execute()
Expand All @@ -122,7 +122,7 @@ func TestTemplateUpdate(t *testing.T) {
Parse: echo.ParseComplete,
Provision: echo.ProvisionComplete,
})
cmd, root := clitest.New(t, "templates", "update", template.Name, "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
cmd, root := clitest.New(t, "templates", "push", template.Name, "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t)
cmd.SetIn(pty.Input())
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestTemplateUpdate(t *testing.T) {

// Don't pass the name of the template, it should use the
// directory of the source.
cmd, root := clitest.New(t, "templates", "update", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
cmd, root := clitest.New(t, "templates", "push", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho))
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t)
cmd.SetIn(pty.Input())
Expand Down
6 changes: 3 additions & 3 deletions cli/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func templates() *cobra.Command {
Command: "coder templates plan my-template",
},
example{
Description: "Update the template. Your developers can update their workspaces",
Command: "coder templates update my-template",
Description: "Push an update to the template. Your developers can update their workspaces",
Command: "coder templates push my-template",
},
),
}
Expand All @@ -37,7 +37,7 @@ func templates() *cobra.Command {
templateInit(),
templateList(),
templatePlan(),
templateUpdate(),
templatePush(),
templateVersions(),
templateDelete(),
templatePull(),
Expand Down