From eb849beb9f75ef38a733cba25de5e49c6776565d Mon Sep 17 00:00:00 2001 From: Pudong Zheng Date: Wed, 24 Apr 2024 09:58:00 +0000 Subject: [PATCH] Add code web extension as package --- WORKSPACE.yaml | 1 + components/ide/code/code-extension/BUILD.yaml | 15 +++++++++ .../ide/code/code-extension/leeway.Dockerfile | 33 +++++++++++++++++++ .../ide-service/ide_config_configmap.go | 2 +- .../pkg/components/workspace/ide/constants.go | 1 - .../installer/pkg/config/versions/versions.go | 13 ++++---- 6 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 components/ide/code/code-extension/BUILD.yaml create mode 100644 components/ide/code/code-extension/leeway.Dockerfile diff --git a/WORKSPACE.yaml b/WORKSPACE.yaml index 2190958000648e..64d336ec9086cc 100644 --- a/WORKSPACE.yaml +++ b/WORKSPACE.yaml @@ -10,6 +10,7 @@ defaultArgs: codeCommit: 0859efdc73ff89d823efce9288ead6d36080f315 codeVersion: 1.88.0 codeQuality: stable + codeWebExtensionCommit: 7ff72a2938a7a06cbdf3964590f7e9b7525958f3 noVerifyJBPlugin: false intellijDownloadUrl: "https://download.jetbrains.com/idea/ideaIU-2024.1.tar.gz" golandDownloadUrl: "https://download.jetbrains.com/go/goland-2024.1.tar.gz" diff --git a/components/ide/code/code-extension/BUILD.yaml b/components/ide/code/code-extension/BUILD.yaml new file mode 100644 index 00000000000000..f2312d2bc3bd40 --- /dev/null +++ b/components/ide/code/code-extension/BUILD.yaml @@ -0,0 +1,15 @@ +packages: + - name: docker + type: docker + argdeps: + - imageRepoBase + - codeWebExtensionCommit + config: + dockerfile: leeway.Dockerfile + metadata: + helm-component: workspace.codeWebExtensionImage + buildArgs: + CODE_EXTENSION_COMMIT: ${codeWebExtensionCommit} + image: + - ${imageRepoBase}/ide/gitpod-code-web:${version} + - ${imageRepoBase}/ide/gitpod-code-web:commit-${__git_commit} diff --git a/components/ide/code/code-extension/leeway.Dockerfile b/components/ide/code/code-extension/leeway.Dockerfile new file mode 100644 index 00000000000000..cb357af739fa71 --- /dev/null +++ b/components/ide/code/code-extension/leeway.Dockerfile @@ -0,0 +1,33 @@ +# Copyright (c) 2020 Gitpod GmbH. All rights reserved. +# Licensed under the GNU Affero General Public License (AGPL). +# See License.AGPL.txt in the project root for license information. +FROM node:18 as builder + +ARG CODE_EXTENSION_COMMIT + +RUN apt update -y \ + && apt install jq --no-install-recommends -y + +RUN mkdir /gitpod-code-web \ + && cd /gitpod-code-web \ + && git init \ + && git remote add origin https://github.com/gitpod-io/gitpod-code \ + && git fetch origin $CODE_EXTENSION_COMMIT --depth=1 \ + && git reset --hard FETCH_HEAD +WORKDIR /gitpod-code-web +RUN yarn --frozen-lockfile --network-timeout 180000 + +# update package.json +RUN setSegmentKey="setpath([\"segmentKey\"]; \"untrusted-dummy-key\")" && \ + jqCommands="${setSegmentKey}" && \ + cat package.json | jq "${jqCommands}" > package.json.tmp && \ + mv package.json.tmp package.json +RUN yarn build:gitpod-web && yarn --cwd gitpod-web/ inject-commit-hash + + +FROM scratch + +COPY --from=builder --chown=33333:33333 /gitpod-code-web/gitpod-web/out /ide/extensions/gitpod-web/out/ +COPY --from=builder --chown=33333:33333 /gitpod-code-web/gitpod-web/public /ide/extensions/gitpod-web/public/ +COPY --from=builder --chown=33333:33333 /gitpod-code-web/gitpod-web/resources /ide/extensions/gitpod-web/resources/ +COPY --from=builder --chown=33333:33333 /gitpod-code-web/gitpod-web/package.json /gitpod-code-web/gitpod-web/package.nls.json /gitpod-code-web/gitpod-web/README.md /gitpod-code-web/gitpod-web/LICENSE.txt /ide/extensions/gitpod-web/ diff --git a/install/installer/pkg/components/ide-service/ide_config_configmap.go b/install/installer/pkg/components/ide-service/ide_config_configmap.go index 6a703d761a32b1..b2004ce5d82d4d 100644 --- a/install/installer/pkg/components/ide-service/ide_config_configmap.go +++ b/install/installer/pkg/components/ide-service/ide_config_configmap.go @@ -62,7 +62,7 @@ func ideConfigConfigmap(ctx *common.RenderContext) ([]runtime.Object, error) { CodeBrowserVersionStable: ide.CodeIDEImageStableVersion, ResolvedCodeBrowserImageLatest: resolveLatestImage(ide.CodeIDEImage, "nightly", ctx.VersionManifest.Components.Workspace.CodeImage), CodeHelperImage: ctx.ImageName(ctx.Config.Repository, ide.CodeHelperIDEImage, ctx.VersionManifest.Components.Workspace.CodeHelperImage.Version), - CodeWebExtensionImage: ctx.ImageName(ctx.Config.Repository, ide.CodeWebExtensionImage, ide.CodeWebExtensionVersion), + CodeWebExtensionImage: ctx.ImageName(ctx.Config.Repository, ide.CodeWebExtensionImage, ctx.VersionManifest.Components.Workspace.CodeWebExtensionImage.Version), JetBrainsPluginImage: ctx.ImageName(ctx.Config.Repository, ide.JetBrainsBackendPluginImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.JetBrainsBackendPluginImage.Version), JetBrainsPluginLatestImage: ctx.ImageName(ctx.Config.Repository, ide.JetBrainsBackendPluginImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.JetBrainsBackendPluginLatestImage.Version), diff --git a/install/installer/pkg/components/workspace/ide/constants.go b/install/installer/pkg/components/workspace/ide/constants.go index 69c9775f63bd87..17bd3b03b0b3c1 100644 --- a/install/installer/pkg/components/workspace/ide/constants.go +++ b/install/installer/pkg/components/workspace/ide/constants.go @@ -10,7 +10,6 @@ const ( Code1_85IDEImageStableVersion = "commit-cb1173f2a457633550a7fdc89af86d8d4da51876" CodeHelperIDEImage = "ide/code-codehelper" CodeWebExtensionImage = "ide/gitpod-code-web" - CodeWebExtensionVersion = "commit-4e069a6195f3926ba8b84725bc806228f4cb94ec" // gitpod-web extension version comes from https://github.com/gitpod-io/gitpod-code CodeDesktopIDEImage = "ide/code-desktop" CodeDesktopInsidersIDEImage = "ide/code-desktop-insiders" XtermIDEImage = "ide/xterm-web" diff --git a/install/installer/pkg/config/versions/versions.go b/install/installer/pkg/config/versions/versions.go index 5091f664557a15..bf39472eb53e4e 100644 --- a/install/installer/pkg/config/versions/versions.go +++ b/install/installer/pkg/config/versions/versions.go @@ -37,12 +37,13 @@ type Components struct { ServiceWaiter Versioned `json:"serviceWaiter"` Usage Versioned `json:"usage"` Workspace struct { - CodeImage Versioned `json:"codeImage"` - CodeHelperImage Versioned `json:"codeHelperImage"` - DockerUp Versioned `json:"dockerUp"` - Supervisor Versioned `json:"supervisor"` - Workspacekit Versioned `json:"workspacekit"` - DesktopIdeImages struct { + CodeImage Versioned `json:"codeImage"` + CodeHelperImage Versioned `json:"codeHelperImage"` + CodeWebExtensionImage Versioned `json:"codeWebExtensionImage"` + DockerUp Versioned `json:"dockerUp"` + Supervisor Versioned `json:"supervisor"` + Workspacekit Versioned `json:"workspacekit"` + DesktopIdeImages struct { CodeDesktopImage Versioned `json:"codeDesktop"` CodeDesktopImageInsiders Versioned `json:"codeDesktopInsiders"` IntelliJImage Versioned `json:"intellij"`