From d3f527f3011d81c2bed238b85443350618db7107 Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Mon, 14 Mar 2022 10:30:57 +0000 Subject: [PATCH] build JB images for stable and latest separately --- .werft/jobs/build/installer/installer.ts | 7 +- components/BUILD.yaml | 4 + components/ide/jetbrains/image/BUILD.yaml | 92 +++++++++++++++++++ .../pkg/components/server/ide/configmap.go | 27 +++++- .../config/v1/experimental/experimental.go | 13 ++- .../installer/pkg/config/versions/versions.go | 4 + 6 files changed, 136 insertions(+), 11 deletions(-) diff --git a/.werft/jobs/build/installer/installer.ts b/.werft/jobs/build/installer/installer.ts index 257466b2e0defa..fdf42f32071797 100644 --- a/.werft/jobs/build/installer/installer.ts +++ b/.werft/jobs/build/installer/installer.ts @@ -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) @@ -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 }); @@ -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) } diff --git a/components/BUILD.yaml b/components/BUILD.yaml index 86fd3a122a13d1..8c84247ecbb3de 100644 --- a/components/BUILD.yaml +++ b/components/BUILD.yaml @@ -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 diff --git a/components/ide/jetbrains/image/BUILD.yaml b/components/ide/jetbrains/image/BUILD.yaml index 0963b3399c3f4e..4005d0f9c282c2 100644 --- a/components/ide/jetbrains/image/BUILD.yaml +++ b/components/ide/jetbrains/image/BUILD.yaml @@ -5,9 +5,13 @@ packages: - version deps: - :intellij + - :intellij-latest - :goland + - :goland-latest - :pycharm + - :pycharm-latest - :phpstorm + - :phpstorm-latest - name: intellij type: docker srcs: @@ -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: @@ -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: @@ -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: @@ -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 diff --git a/install/installer/pkg/components/server/ide/configmap.go b/install/installer/pkg/components/server/ide/configmap.go index ed33965034532f..de898da8c9a1c6 100644 --- a/install/installer/pkg/components/server/ide/configmap.go +++ b/install/installer/pkg/components/server/ide/configmap.go @@ -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" @@ -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{ @@ -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: { @@ -97,7 +114,7 @@ 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"), @@ -105,7 +122,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { 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"), @@ -113,7 +130,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { 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"), @@ -121,7 +138,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { 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", diff --git a/install/installer/pkg/config/v1/experimental/experimental.go b/install/installer/pkg/config/v1/experimental/experimental.go index 360f22322035d7..c7c24fdf04b862 100644 --- a/install/installer/pkg/config/v1/experimental/experimental.go +++ b/install/installer/pkg/config/v1/experimental/experimental.go @@ -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 { @@ -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 diff --git a/install/installer/pkg/config/versions/versions.go b/install/installer/pkg/config/versions/versions.go index b8db5726b70650..2bf782a872e250 100644 --- a/install/installer/pkg/config/versions/versions.go +++ b/install/installer/pkg/config/versions/versions.go @@ -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 {