Skip to content

feat: give users ability to duplicate existing workspaces #10195

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

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d126314
refactor: clean up CreateWorkspacePage
Parkreiner Oct 9, 2023
881d4a3
fix: remove unnecessary state
Parkreiner Oct 9, 2023
f793fe4
refactor: clean up auth logic more
Parkreiner Oct 10, 2023
2416958
refactor: remove enums from workspace actions
Parkreiner Oct 10, 2023
e97cdd8
fix: export ButtonType type
Parkreiner Oct 10, 2023
0af0352
refactor: remove workspace error enums
Parkreiner Oct 10, 2023
61b26f5
chore: get basic clone functionality done for UI
Parkreiner Oct 10, 2023
f0e120b
fix: clean up Create page view again
Parkreiner Oct 11, 2023
f2380fe
Merge branch 'main' into mes/workspace-clone
Parkreiner Oct 11, 2023
53a9cae
refactor/fix: reconcile merge changes from new PR
Parkreiner Oct 11, 2023
d98a5e0
refactor: centralize workspace duplication logic
Parkreiner Oct 12, 2023
ac86d94
refactor: rename rich params validator for clarity
Parkreiner Oct 12, 2023
e290ece
refactor: clean up getInitialRichParameterValues for clarity
Parkreiner Oct 13, 2023
49b4ad6
refactor: clean up TemplateParameters components
Parkreiner Oct 13, 2023
f6b9285
fix: update imports for validator name change
Parkreiner Oct 13, 2023
ba6e20c
wip: commit progress for creating workspaces
Parkreiner Oct 13, 2023
2a7f9e0
refactor: centralize out workspace parameter fetching logic
Parkreiner Oct 13, 2023
bbe44a1
refactor: centralize workspace parameter mutation logic
Parkreiner Oct 13, 2023
1fb2205
feat: get cloning functionality finished
Parkreiner Oct 13, 2023
a7d1ea9
Merge branch 'main' into mes/workspace-clone
Parkreiner Oct 16, 2023
239bddc
fix: make sure button does not auto-submit connected forms
Parkreiner Oct 16, 2023
8dcbc61
fix: add mocked response for created workspaces
Parkreiner Oct 16, 2023
81f868f
Merge branch 'main' into mes/workspace-clone
Parkreiner Oct 19, 2023
2d51fc9
fix: make it possible to split immutable/mutable params
Parkreiner Oct 19, 2023
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
Prev Previous commit
Next Next commit
Merge branch 'main' into mes/workspace-clone
  • Loading branch information
Parkreiner committed Oct 11, 2023
commit f2380fe42043742d6bfd50cdc5290dbb0048ceba
2 changes: 1 addition & 1 deletion .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: |
inputs:
version:
description: "The Go version to use."
default: "1.20.8"
default: "1.20.10"
runs:
using: "composite"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:
with:
# This doesn't need caching. It's super fast anyways!
cache: false
go-version: 1.20.8
go-version: 1.20.10

- name: Install shfmt
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.5.0
Expand Down
6 changes: 1 addition & 5 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1290,11 +1290,7 @@ func (a *agent) manageProcessPriority(ctx context.Context) ([]*agentproc.Process
// Getpriority actually returns priority for the nice value
// which is niceness + 20, so here 20 = a niceness of 0 (aka unset).
if score != 20 {
if score != niceness {
logger.Debug(ctx, "skipping process due to custom niceness",
slog.F("niceness", score),
)
}
// We don't log here since it can get spammy
continue
}

Expand Down
2 changes: 1 addition & 1 deletion agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func TestAgent_Session_TTY_MOTD(t *testing.T) {
Enabled: true,
Message: "\n\n\n\n\n\nbanner\n\n\n\n\n\n",
},
expectedRe: regexp.MustCompile("([^\n\r]|^)banner\r\n\r\n[^\r\n]"),
expectedRe: regexp.MustCompile(`([^\n\r]|^)banner\r\n\r\n[^\r\n]`),
},
}

Expand Down
11 changes: 6 additions & 5 deletions cli/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ func TestWorkspaceAgent(t *testing.T) {
GoogleTokenValidator: validator,
IncludeProvisionerDaemon: true,
})
user := coderdtest.CreateFirstUser(t, client)
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
owner := coderdtest.CreateFirstUser(t, client)
member, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
version := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: []*proto.Response{{
Type: &proto.Response_Apply{
Expand All @@ -195,14 +196,14 @@ func TestWorkspaceAgent(t *testing.T) {
},
}},
})
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, version.ID)
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
workspace := coderdtest.CreateWorkspace(t, member, owner.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)

inv, cfg := clitest.New(t, "agent", "--auth", "google-instance-identity", "--agent-url", client.URL.String())
ptytest.New(t).Attach(inv)
clitest.SetupConfig(t, client, cfg)
clitest.SetupConfig(t, member, cfg)
clitest.Start(t,
inv.WithContext(
//nolint:revive,staticcheck
Expand Down
22 changes: 12 additions & 10 deletions cli/configssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ func TestConfigSSH(t *testing.T) {
},
},
})
user := coderdtest.CreateFirstUser(t, client)
owner := coderdtest.CreateFirstUser(t, client)
member, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
authToken := uuid.NewString()
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
version := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionPlan: []*proto.Response{{
Type: &proto.Response_Plan{
Expand All @@ -96,8 +97,8 @@ func TestConfigSSH(t *testing.T) {
ProvisionApply: echo.ProvisionApplyWithAgent(authToken),
})
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, version.ID)
workspace := coderdtest.CreateWorkspace(t, member, owner.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)
_ = agenttest.New(t, client.URL, authToken)
resources := coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
Expand Down Expand Up @@ -145,7 +146,7 @@ func TestConfigSSH(t *testing.T) {
"--ssh-option", "Port "+strconv.Itoa(tcpAddr.Port),
"--ssh-config-file", sshConfigFile,
"--skip-proxy-command")
clitest.SetupConfig(t, client, root)
clitest.SetupConfig(t, member, root)
pty := ptytest.New(t)
inv.Stdin = pty.Input()
inv.Stdout = pty.Output()
Expand Down Expand Up @@ -710,19 +711,20 @@ func TestConfigSSH_Hostnames(t *testing.T) {
}

client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
user := coderdtest.CreateFirstUser(t, client)
owner := coderdtest.CreateFirstUser(t, client)
member, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
// authToken := uuid.NewString()
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID,
version := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID,
echo.WithResources(resources))
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, version.ID)
workspace := coderdtest.CreateWorkspace(t, member, owner.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)

sshConfigFile := sshConfigFileName(t)

inv, root := clitest.New(t, "config-ssh", "--ssh-config-file", sshConfigFile)
clitest.SetupConfig(t, client, root)
clitest.SetupConfig(t, member, root)

pty := ptytest.New(t)
inv.Stdin = pty.Input()
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.