Skip to content

Commit

Permalink
build JB images for stable and latest separately
Browse files Browse the repository at this point in the history
  • Loading branch information
akosyakov committed Apr 4, 2022
1 parent 76b51bc commit d3f527f
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 11 deletions.
7 changes: 6 additions & 1 deletion .werft/jobs/build/installer/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class Installer {
this.configureContainerRegistry(slice)
this.configureDomain(slice)
this.configureWorkspaces(slice)
this.configureIDE(slice)
this.configureObservability(slice)
this.configureAuthProviders(slice)
this.configureSSHGateway(slice)
Expand Down Expand Up @@ -97,6 +98,10 @@ export class Installer {
exec(`yq w -i ${this.options.installerConfigPath} workspace.resources.requests.cpu "100m"`, { slice: slice });
}

private configureIDE(slice: string) {
exec(`yq w -i ${this.options.installerConfigPath} experimental.ide.resolveLatest false`, { slice });
}

private configureObservability(slice: string) {
const tracingEndpoint = exec(`yq r ./.werft/jobs/build/helm/values.tracing.yaml tracing.endpoint`, { slice: slice }).stdout.trim();
exec(`yq w -i ${this.options.installerConfigPath} observability.tracing.endpoint ${tracingEndpoint}`, { slice: slice });
Expand Down Expand Up @@ -156,7 +161,7 @@ export class Installer {

render(slice: string): void {
this.options.werft.log(slice, "Rendering YAML manifests");
exec(`/tmp/installer render --namespace ${this.options.deploymentNamespace} --config ${this.options.installerConfigPath} > k8s.yaml`, { slice: slice });
exec(`/tmp/installer render --use-experimental-config --namespace ${this.options.deploymentNamespace} --config ${this.options.installerConfigPath} > k8s.yaml`, { slice: slice });
this.options.werft.done(slice)
}

Expand Down
4 changes: 4 additions & 0 deletions components/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ packages:
- components/ide/code-desktop:docker-insiders
- components/ide/code:docker
- components/ide/jetbrains/image:goland
- components/ide/jetbrains/image:goland-latest
- components/ide/jetbrains/image:intellij
- components/ide/jetbrains/image:intellij-latest
- components/ide/jetbrains/image:phpstorm
- components/ide/jetbrains/image:phpstorm-latest
- components/ide/jetbrains/image:pycharm
- components/ide/jetbrains/image:pycharm-latest
- components/image-builder-bob:docker
- components/image-builder-mk3:docker
- components/local-app:docker
Expand Down
92 changes: 92 additions & 0 deletions components/ide/jetbrains/image/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ packages:
- version
deps:
- :intellij
- :intellij-latest
- :goland
- :goland-latest
- :pycharm
- :pycharm-latest
- :phpstorm
- :phpstorm-latest
- name: intellij
type: docker
srcs:
Expand All @@ -30,6 +34,28 @@ packages:
image:
- ${imageRepoBase}/ide/intellij:${version}
- ${imageRepoBase}/ide/intellij:commit-${__git_commit}
- name: intellij-latest
type: docker
srcs:
- "startup.sh"
- "supervisor-ide-config_intellij.json"
deps:
- components/ide/jetbrains/backend-plugin:plugin
- components/ide/jetbrains/image/status:app
- components/ide/jetbrains/cli:app
argdeps:
- imageRepoBase
config:
dockerfile: leeway.Dockerfile
metadata:
helm-component: workspace.desktopIdeImages.intellijLatest
buildArgs:
# "https://data.services.jetbrains.com/products?code=IIU&fields=distributions%2Clink%2Cname%2Creleases&_=$(date +%s)000"
JETBRAINS_BACKEND_URL: "https://download.jetbrains.com/idea/ideaIU-221.4994.44.tar.gz"
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_intellij.json
image:
- ${imageRepoBase}/ide/intellij:${version}-latest
- ${imageRepoBase}/ide/intellij:commit-${__git_commit}-latest
- name: goland
type: docker
srcs:
Expand All @@ -52,6 +78,28 @@ packages:
image:
- ${imageRepoBase}/ide/goland:${version}
- ${imageRepoBase}/ide/goland:commit-${__git_commit}
- name: goland-latest
type: docker
srcs:
- "startup.sh"
- "supervisor-ide-config_goland.json"
deps:
- components/ide/jetbrains/backend-plugin:plugin
- components/ide/jetbrains/image/status:app
- components/ide/jetbrains/cli:app
argdeps:
- imageRepoBase
config:
dockerfile: leeway.Dockerfile
metadata:
helm-component: workspace.desktopIdeImages.golandLatest
buildArgs:
# "https://data.services.jetbrains.com/products?code=GO&fields=distributions%2Clink%2Cname%2Creleases&_=$(date +%s)000"
JETBRAINS_BACKEND_URL: "https://download.jetbrains.com/go/goland-221.4994.43.tar.gz"
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_goland.json
image:
- ${imageRepoBase}/ide/goland:${version}-latest
- ${imageRepoBase}/ide/goland:commit-${__git_commit}-latest
- name: pycharm
type: docker
srcs:
Expand All @@ -74,6 +122,28 @@ packages:
image:
- ${imageRepoBase}/ide/pycharm:${version}
- ${imageRepoBase}/ide/pycharm:commit-${__git_commit}
- name: pycharm-latest
type: docker
srcs:
- "startup.sh"
- "supervisor-ide-config_pycharm.json"
deps:
- components/ide/jetbrains/backend-plugin:plugin
- components/ide/jetbrains/image/status:app
- components/ide/jetbrains/cli:app
argdeps:
- imageRepoBase
config:
dockerfile: leeway.Dockerfile
metadata:
helm-component: workspace.desktopIdeImages.pycharmLatest
buildArgs:
# "https://data.services.jetbrains.com/products?code=PCP&fields=distributions%2Clink%2Cname%2Creleases&_=$(date +%s)000"
JETBRAINS_BACKEND_URL: "https://download.jetbrains.com/python/pycharm-professional-221.4994.44.tar.gz"
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_pycharm.json
image:
- ${imageRepoBase}/ide/pycharm:${version}-latest
- ${imageRepoBase}/ide/pycharm:commit-${__git_commit}-latest
- name: phpstorm
type: docker
srcs:
Expand All @@ -96,3 +166,25 @@ packages:
image:
- ${imageRepoBase}/ide/phpstorm:${version}
- ${imageRepoBase}/ide/phpstorm:commit-${__git_commit}
- name: phpstorm-latest
type: docker
srcs:
- "startup.sh"
- "supervisor-ide-config_phpstorm.json"
deps:
- components/ide/jetbrains/backend-plugin:plugin
- components/ide/jetbrains/image/status:app
- components/ide/jetbrains/cli:app
argdeps:
- imageRepoBase
config:
dockerfile: leeway.Dockerfile
metadata:
helm-component: workspace.desktopIdeImages.phpstormLatest
buildArgs:
# "https://data.services.jetbrains.com/products?code=PS&fields=distributions%2Clink%2Cname%2Creleases&_=$(date +%s)000"
JETBRAINS_BACKEND_URL: "https://download.jetbrains.com/webide/PhpStorm-221.4994.43.tar.gz"
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_phpstorm.json
image:
- ${imageRepoBase}/ide/phpstorm:${version}-latest
- ${imageRepoBase}/ide/phpstorm:commit-${__git_commit}-latest
27 changes: 22 additions & 5 deletions install/installer/pkg/components/server/ide/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/components/workspace"
"github.com/gitpod-io/gitpod/installer/pkg/components/workspace/ide"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
"github.com/gitpod-io/gitpod/installer/pkg/config/versions"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -31,6 +33,21 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
goland := "goland"
pycharm := "pycharm"
phpstorm := "phpstorm"

resolveLatestImage := func(name string, tag string, bundledLatest versions.Versioned) string {
resolveLatest := true
ctx.WithExperimental(func(ucfg *experimental.Config) error {
if ucfg.IDE != nil && ucfg.IDE.ResolveLatest != nil {
resolveLatest = *ucfg.IDE.ResolveLatest
}
return nil
})
if resolveLatest {
return common.ImageName(ctx.Config.Repository, name, tag)
}
return common.ImageName(ctx.Config.Repository, name, bundledLatest.Version)
}

idecfg := IDEConfig{
SupervisorImage: common.ImageName(ctx.Config.Repository, workspace.SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version),
IDEOptions: IDEOptions{
Expand Down Expand Up @@ -72,7 +89,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
Logo: getIdeLogoPath("vscodeInsiders"),
Tooltip: pointer.String("Early access version, still subject to testing."),
Label: pointer.String("Insiders"),
Image: common.ImageName(ctx.Config.Repository, ide.CodeIDEImage, ctx.VersionManifest.Components.Workspace.CodeImage.Version),
Image: resolveLatestImage(ide.CodeIDEImage, "nightly", ctx.VersionManifest.Components.Workspace.CodeImage),
ResolveImageDigest: pointer.Bool(true),
},
codeDesktop: {
Expand All @@ -97,31 +114,31 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
Type: typeDesktop,
Logo: getIdeLogoPath("intellijIdeaLogo"),
Image: common.ImageName(ctx.Config.Repository, ide.IntelliJDesktopIDEImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.IntelliJImage.Version),
LatestImage: common.ImageName(ctx.Config.Repository, ide.IntelliJDesktopIDEImage, "latest"),
LatestImage: resolveLatestImage(ide.IntelliJDesktopIDEImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.IntelliJLatestImage),
},
goland: {
OrderKey: pointer.String("05"),
Title: "GoLand",
Type: typeDesktop,
Logo: getIdeLogoPath("golandLogo"),
Image: common.ImageName(ctx.Config.Repository, ide.GoLandDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.GoLandImage.Version),
LatestImage: common.ImageName(ctx.Config.Repository, ide.GoLandDesktopIdeImage, "latest"),
LatestImage: resolveLatestImage(ide.GoLandDesktopIdeImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.GoLandLatestImage),
},
pycharm: {
OrderKey: pointer.String("06"),
Title: "PyCharm",
Type: typeDesktop,
Logo: getIdeLogoPath("pycharmLogo"),
Image: common.ImageName(ctx.Config.Repository, ide.PyCharmDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PyCharmImage.Version),
LatestImage: common.ImageName(ctx.Config.Repository, ide.PyCharmDesktopIdeImage, "latest"),
LatestImage: resolveLatestImage(ide.PyCharmDesktopIdeImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PyCharmLatestImage),
},
phpstorm: {
OrderKey: pointer.String("07"),
Title: "PhpStorm",
Type: typeDesktop,
Logo: getIdeLogoPath("phpstormLogo"),
Image: common.ImageName(ctx.Config.Repository, ide.PhpStormDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PhpStormImage.Version),
LatestImage: common.ImageName(ctx.Config.Repository, ide.PhpStormDesktopIdeImage, "latest"),
LatestImage: resolveLatestImage(ide.PhpStormDesktopIdeImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PhpStormLatestImage),
},
},
DefaultIDE: "code",
Expand Down
13 changes: 8 additions & 5 deletions install/installer/pkg/config/v1/experimental/experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import "k8s.io/apimachinery/pkg/api/resource"

// Config contains all experimental configuration.
type Config struct {
Workspace *WorkspaceConfig `json:"workspace"`
WebApp *WebAppConfig `json:"webapp"`
IDE *IDEConfig `json:"ide"`
Workspace *WorkspaceConfig `json:"workspace,omitempty"`
WebApp *WebAppConfig `json:"webapp,omitempty"`
IDE *IDEConfig `json:"ide,omitempty"`
}

type WorkspaceConfig struct {
Tracing *Tracing `json:"tracing"`
Tracing *Tracing `json:"tracing,omitempty"`
Stage string `json:"stage"`

CPULimits struct {
Expand All @@ -47,7 +47,10 @@ type WorkspaceConfig struct {
type WebAppConfig struct {
}

type IDEConfig struct{}
type IDEConfig struct {
// Disable resolution of latest images and use bundled latest versions instead
ResolveLatest *bool `json:"resolveLatest,omitempty"`
}

type TracingSampleType string

Expand Down
4 changes: 4 additions & 0 deletions install/installer/pkg/config/versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ type Components struct {
CodeDesktopImage Versioned `json:"codeDesktop"`
CodeDesktopImageInsiders Versioned `json:"codeDesktopInsiders"`
IntelliJImage Versioned `json:"intellij"`
IntelliJLatestImage Versioned `json:"intellijLatest"`
GoLandImage Versioned `json:"goland"`
GoLandLatestImage Versioned `json:"golandLatest"`
PyCharmImage Versioned `json:"pycharm"`
PyCharmLatestImage Versioned `json:"pycharmLatest"`
PhpStormImage Versioned `json:"phpstorm"`
PhpStormLatestImage Versioned `json:"phpstormLatest"`
} `json:"desktopIdeImages"`
} `json:"workspace"`
WSDaemon struct {
Expand Down

0 comments on commit d3f527f

Please sign in to comment.