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 Mar 17, 2022
1 parent 306c7e9 commit bd63db0
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .werft/jobs/build/deploy-to-preview-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ async function deployToDevWithInstaller(werft: Werft, jobConfig: JobConfig, depl
// Relax CPU contraints
exec(`yq w -i config.yaml workspace.resources.requests.cpu "100m"`, { slice: installerSlices.INSTALLER_RENDER });

// Disable resolution of latest images and use bundled latest versions instead
exec(`yq w -i config.yaml experimental.ide.resolveLatest false`, { slice: installerSlices.INSTALLER_RENDER });

if ((deploymentConfig.analytics || "").startsWith("segment|")) {
exec(`yq w -i config.yaml analytics.writer segment`, { slice: installerSlices.INSTALLER_RENDER });
exec(`yq w -i config.yaml analytics.segmentKey ${deploymentConfig.analytics!.substring("segment|".length)}`, { slice: installerSlices.INSTALLER_RENDER });
Expand Down Expand Up @@ -390,7 +393,7 @@ async function deployToDevWithInstaller(werft: Werft, jobConfig: JobConfig, depl
exec(`/tmp/installer validate cluster -c config.yaml || true`, { slice: installerSlices.INSTALLER_RENDER });

// render the k8s manifest
exec(`/tmp/installer render --namespace ${deploymentConfig.namespace} --config config.yaml > k8s.yaml`, { silent: true });
exec(`/tmp/installer render --use-experimental-config --namespace ${deploymentConfig.namespace} --config config.yaml > k8s.yaml`, { silent: true });
werft.done(installerSlices.INSTALLER_RENDER);
} catch (err) {
if (!jobConfig.mainBuild) {
Expand Down
4 changes: 4 additions & 0 deletions components/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,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 @@ -34,7 +34,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 bd63db0

Please sign in to comment.