Skip to content

Commit 3ba3118

Browse files
authored
[GP-CLI] fix incorrect pre-configured workspace image for enterprise (#19811)
* [GP-CLI] fix incorrect pre-configured workspace image for enterprise * fixup
1 parent ed090b0 commit 3ba3118

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

components/gitpod-cli/cmd/init.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ Create a Gitpod configuration for this project.
6565
if err != nil {
6666
fmt.Printf("failed to get organization default workspace image: %v\n", err)
6767
fmt.Println("fallback to gitpod default")
68-
defaultImage = "gitpod/workspace-full"
68+
defaultImage = ""
6969
}
70-
yml := fmt.Sprintf(`# Image of workspace. Learn more: https://www.gitpod.io/docs/configure/workspaces/workspace-image
71-
image: %s
72-
73-
# List the start up tasks. Learn more: https://www.gitpod.io/docs/configure/workspaces/tasks
70+
yml := ""
71+
if defaultImage != "" {
72+
yml = yml + fmt.Sprintf("# Image of workspace. Learn more: https://www.gitpod.io/docs/configure/workspaces/workspace-image\nimage: %s\n\n", defaultImage)
73+
}
74+
yml = yml + `# List the start up tasks. Learn more: https://www.gitpod.io/docs/configure/workspaces/tasks
7475
tasks:
7576
- name: Script Task
7677
init: echo 'init script' # runs during prebuild => https://www.gitpod.io/docs/configure/projects/prebuilds
@@ -84,7 +85,7 @@ ports:
8485
onOpen: open-preview
8586
8687
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
87-
`, defaultImage)
88+
`
8889
d = []byte(yml)
8990
} else {
9091
fmt.Printf("\n\n---\n%s", d)
@@ -146,6 +147,9 @@ func getDefaultWorkspaceImage(ctx context.Context, wsInfo *api.WorkspaceInfoResp
146147
if err != nil {
147148
return "", err
148149
}
150+
if res.Source == protocol.WorkspaceImageSourceInstallation {
151+
return "", nil
152+
}
149153
return res.Image, nil
150154
}
151155

components/gitpod-cli/pkg/gitpodlib/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ type GitpodFile struct {
2828

2929
// SetImageName configures a pre-built docker image by name
3030
func (cfg *GitpodFile) SetImageName(name string) {
31+
if name == "" {
32+
return
33+
}
3134
cfg.Image = name
3235
}
3336

0 commit comments

Comments
 (0)