Skip to content
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

Add support for Windows images in Daytona workspaces #1346

Closed
Closed
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: 4 additions & 2 deletions hack/project_image/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@
"ghcr.io/devcontainers/features/nix:1.2.0": {},
"ghcr.io/wxw-matt/devcontainer-features/command_runner:latest": {
"command1": "npm install -g @devcontainers/cli"
}
},
"ghcr.io/devcontainers/features/windows:1": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/devcontainers/features/docker-in-docker:2",
"ghcr.io/devcontainers/features/go:1",
"ghcr.io/devcontainers/features/node:1",
"ghcr.io/devcontainers-contrib/features/typescript:2",
"ghcr.io/devcontainers/features/common-utils:1",
"ghcr.io/wxw-matt/devcontainer-features/command_runner:latest"
"ghcr.io/wxw-matt/devcontainer-features/command_runner:latest",
"ghcr.io/devcontainers/features/windows:1"
],
"remoteUser": "daytona"
}
8 changes: 5 additions & 3 deletions pkg/cmd/server/configure.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Copyright 2024 Daytona Platforms Inc.
// SPDX-License-Identifier: Apache-2.0

package server

import (
Expand Down Expand Up @@ -36,6 +33,11 @@ var configureCmd = &cobra.Command{
return err
}

// Add Windows image configuration
if apiServerConfig.WindowsImage == nil {
apiServerConfig.WindowsImage = new(string)
}

_, res, err = apiClient.ServerAPI.SetConfig(context.Background()).Config(*apiServerConfig).Execute()
if err != nil {
return apiclient.HandleErrorResponse(res, err)
Expand Down
13 changes: 9 additions & 4 deletions pkg/cmd/workspace/create.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Copyright 2024 Daytona Platforms Inc.
// SPDX-License-Identifier: Apache-2.0

package workspace

import (
Expand All @@ -16,7 +13,7 @@
"github.com/daytonaio/daytona/internal/cmd/tailscale"
"github.com/daytonaio/daytona/internal/util"
apiclient_util "github.com/daytonaio/daytona/internal/util/apiclient"
ssh_config "github.com/daytonaio/daytona/pkg/agent/ssh/config"
ssh_config "github.com.daytonaio/daytona/pkg/agent/ssh/config"

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / Unit tests

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / cli-docs

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / cli-docs

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / binary-build (linux, amd64)

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / binary-build (linux, arm64)

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / binary-build (darwin, amd64)

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / binary-build (darwin, arm64)

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / binary-build (windows, amd64)

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:

Check failure on line 16 in pkg/cmd/workspace/create.go

View workflow job for this annotation

GitHub Actions / binary-build (windows, arm64)

no required module provides package github.com.daytonaio/daytona/pkg/agent/ssh/config; to add it:
"github.com/daytonaio/daytona/pkg/apiclient"
workspace_util "github.com/daytonaio/daytona/pkg/cmd/workspace/util"
"github.com/daytonaio/daytona/pkg/common"
Expand Down Expand Up @@ -253,6 +250,7 @@
EnvVars: new([]string),
Manual: new(bool),
GitProviderConfig: new(string),
WindowsImage: new(bool), // Added for Windows image support
}

func init() {
Expand All @@ -271,6 +269,7 @@
CreateCmd.Flags().BoolVar(&multiProjectFlag, "multi-project", false, "Workspace with multiple projects/repos")
CreateCmd.Flags().BoolVarP(&yesFlag, "yes", "y", false, "Automatically confirm any prompts")
CreateCmd.Flags().StringSliceVar(projectConfigurationFlags.Branches, "branch", []string{}, "Specify the Git branches to use in the projects")
CreateCmd.Flags().BoolVar(projectConfigurationFlags.WindowsImage, "windows-image", false, "Use a Windows image for the workspace") // Added for Windows image support

workspace_util.AddProjectConfigurationFlags(CreateCmd, projectConfigurationFlags, true)
}
Expand Down Expand Up @@ -302,6 +301,12 @@
DevcontainerFilePath: create.DEVCONTAINER_FILEPATH,
}

// Handle Windows image option
if *projectConfigurationFlags.WindowsImage {
projectDefaults.Image = &apiServerConfig.WindowsImage
projectDefaults.ImageUser = &apiServerConfig.WindowsImageUser
}

*projects, err = workspace_util.GetProjectsCreationDataFromPrompt(workspace_util.ProjectsDataPromptConfig{
UserGitProviders: gitProviders,
ProjectConfigs: projectConfigs,
Expand Down
7 changes: 2 additions & 5 deletions pkg/cmd/workspace/util/creation_data.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Copyright 2024 Daytona Platforms Inc.
// SPDX-License-Identifier: Apache-2.0

package util

import (
Expand Down Expand Up @@ -98,8 +95,8 @@
Repository: *configRepo,
},
BuildConfig: projectConfig.BuildConfig,
Image: config.Defaults.Image,
User: config.Defaults.ImageUser,
Image: projectConfig.Image,

Check failure on line 98 in pkg/cmd/workspace/util/creation_data.go

View workflow job for this annotation

GitHub Actions / lint

cannot use projectConfig.Image (variable of type string) as *string value in struct literal

Check failure on line 98 in pkg/cmd/workspace/util/creation_data.go

View workflow job for this annotation

GitHub Actions / lint

cannot use projectConfig.Image (variable of type string) as *string value in struct literal

Check failure on line 98 in pkg/cmd/workspace/util/creation_data.go

View workflow job for this annotation

GitHub Actions / lint

cannot use projectConfig.Image (variable of type string) as *string value in struct literal
User: projectConfig.User,

Check failure on line 99 in pkg/cmd/workspace/util/creation_data.go

View workflow job for this annotation

GitHub Actions / lint

cannot use projectConfig.User (variable of type string) as *string value in struct literal (typecheck)

Check failure on line 99 in pkg/cmd/workspace/util/creation_data.go

View workflow job for this annotation

GitHub Actions / lint

cannot use projectConfig.User (variable of type string) as *string value in struct literal) (typecheck)

Check failure on line 99 in pkg/cmd/workspace/util/creation_data.go

View workflow job for this annotation

GitHub Actions / lint

cannot use projectConfig.User (variable of type string) as *string value in struct literal) (typecheck)
EnvVars: projectConfig.EnvVars,
}

Expand Down
Loading