diff --git a/components/ide/code/BUILD.yaml b/components/ide/code/BUILD.yaml index 06ac7a7db3a056..f9bc4fdd9ce09e 100644 --- a/components/ide/code/BUILD.yaml +++ b/components/ide/code/BUILD.yaml @@ -25,7 +25,7 @@ packages: - codeQuality - codeVersion config: - dockerfile: leeway.Dockerfile + dockerfile: leeway.nightly.Dockerfile metadata: helm-component: workspace.codeImage buildArgs: diff --git a/components/ide/code/leeway.nightly.Dockerfile b/components/ide/code/leeway.nightly.Dockerfile new file mode 100644 index 00000000000000..cf9def46af0fe1 --- /dev/null +++ b/components/ide/code/leeway.nightly.Dockerfile @@ -0,0 +1,101 @@ +# Copyright (c) 2024 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 gitpod/openvscode-server-linux-build-agent:focal-x64 as code_builder + +ENV TRIGGER_REBUILD 1 + +ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 +ENV ELECTRON_SKIP_BINARY_DOWNLOAD=1 +ENV VSCODE_ARCH=x64 +ENV NPM_REGISTRY=https://registry.npmjs.org + +ARG CODE_COMMIT +ARG CODE_QUALITY +ARG CODE_VERSION + +RUN sudo mkdir -m 0755 -p /etc/apt/keyrings +RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg + +RUN if dpkg --compare-versions "$CODE_VERSION" "ge" "1.90"; then \ + NODE_VERSION=20; \ + else \ + NODE_VERSION=18; \ + fi && \ + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list +RUN apt-get update && apt-get install -y nodejs + +RUN mkdir /gp-code \ + && cd /gp-code \ + && git init \ + && git remote add origin https://github.com/gitpod-io/openvscode-server \ + && git fetch origin $CODE_COMMIT --depth=1 \ + && git reset --hard FETCH_HEAD +WORKDIR /gp-code + +RUN apt-get install -y pkg-config dbus xvfb libgtk-3-0 libxkbfile-dev libkrb5-dev libgbm1 rpm \ + && cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb \ + && chmod +x /etc/init.d/xvfb \ + && update-rc.d xvfb defaults \ + && service xvfb start \ + # Start dbus session + && mkdir -p /var/run/dbus + +# Disable v8 cache used by yarn v1.x, refs https://github.com/nodejs/node/issues/51555 +ENV DISABLE_V8_COMPILE_CACHE=1 + +# ENV npm_config_arch=x64 +RUN mkdir -p .build \ + && npm config set registry "$NPM_REGISTRY" \ + && npm ci + +# check that the provided codeVersion is the correct one for the given codeCommit +RUN commitVersion=$(cat package.json | jq -r .version) \ + && if [ "$commitVersion" != "$CODE_VERSION" ]; then echo "Code version mismatch: $commitVersion != $CODE_VERSION"; exit 1; fi + +# update product.json +RUN nameShort=$(jq --raw-output '.nameShort' product.json) && \ + nameLong=$(jq --raw-output '.nameLong' product.json) && \ + if [ "$CODE_QUALITY" = "insider" ]; then \ + nameShort="$nameShort - Insiders" \ + nameLong="$nameLong - Insiders" \ + ; fi && \ + setQuality="setpath([\"quality\"]; \"$CODE_QUALITY\")" && \ + setNameShort="setpath([\"nameShort\"]; \"$nameShort\")" && \ + setNameLong="setpath([\"nameLong\"]; \"$nameLong\")" && \ + setSegmentKey="setpath([\"segmentKey\"]; \"untrusted-dummy-key\")" && \ + jqCommands="${setQuality} | ${setNameShort} | ${setNameLong} | ${setSegmentKey}" && \ + cat product.json | jq "${jqCommands}" > product.json.tmp && \ + mv product.json.tmp product.json && \ + jq '{quality,nameLong,nameShort}' product.json + +RUN npm run gulp compile-build \ + && npm run gulp extensions-ci \ + && npm run gulp minify-vscode-reh \ + && npm run gulp vscode-web-min-ci \ + && npm run gulp vscode-reh-linux-x64-min-ci + +# config for first layer needed by blobserve +# this custom urls will be then replaced by blobserve. +# Check pkg/blobserve/blobserve.go, `inlineVars` method +RUN cp /vscode-web/out/vs/gitpod/browser/workbench/workbench.esm.html /vscode-web/index.html \ +&& cp /vscode-web/out/vs/gitpod/browser/workbench/callback.html /vscode-web/callback.html \ +&& sed -i -e "s/{{VERSION}}/$CODE_QUALITY-$CODE_COMMIT/g" /vscode-web/index.html + +# cli config: alises to gitpod-code +RUN cp /vscode-reh-linux-x64/bin/remote-cli/gitpod-code /vscode-reh-linux-x64/bin/remote-cli/code \ +&& cp /vscode-reh-linux-x64/bin/remote-cli/gitpod-code /vscode-reh-linux-x64/bin/remote-cli/gp-code \ +&& cp /vscode-reh-linux-x64/bin/remote-cli/gitpod-code /vscode-reh-linux-x64/bin/remote-cli/open + +# grant write permissions for built-in extensions +RUN chmod -R ugo+w /vscode-reh-linux-x64/extensions + +FROM scratch +# copy static web resources in first layer to serve from blobserve +COPY --from=code_builder --chown=33333:33333 /vscode-web/ /ide/ +COPY --from=code_builder --chown=33333:33333 /vscode-reh-linux-x64/ /ide/ + +ARG CODE_VERSION +ARG CODE_COMMIT +LABEL "io.gitpod.ide.version"=$CODE_VERSION +LABEL "io.gitpod.ide.commit"=$CODE_COMMIT diff --git a/components/ide/gha-update-image/BUILD.yaml b/components/ide/gha-update-image/BUILD.yaml index 9fdc9ceaf9286d..f1b7b9b583564b 100644 --- a/components/ide/gha-update-image/BUILD.yaml +++ b/components/ide/gha-update-image/BUILD.yaml @@ -14,6 +14,24 @@ scripts: cf_patch="{\"data\": {\"config.json\": $cf_patch}}" # echo "$cf_patch" + kubectl patch cm ide-config --type=merge -p "$cf_patch" + kubectl rollout restart deployment ide-service + kubectl rollout restart deployment server + - name: code-use-dev-latest + script: | + ide_list=("code") + prop_list=("latestImage") + + cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r) + for ide in "${ide_list[@]}"; do + for prop in "${prop_list[@]}"; do + cf_patch=$(echo "$cf_patch" | jq ".ideOptions.options.$ide.$prop = \"eu.gcr.io/gitpod-dev-artifact/build/ide/code:nightly\"") + done + done + cf_patch=$(echo "$cf_patch" |jq tostring) + cf_patch="{\"data\": {\"config.json\": $cf_patch}}" + # echo "$cf_patch" + kubectl patch cm ide-config --type=merge -p "$cf_patch" kubectl rollout restart deployment ide-service kubectl rollout restart deployment server diff --git a/components/local-app-api/typescript-grpcweb/webpack.config.js b/components/local-app-api/typescript-grpcweb/webpack.config.js index 98f952fb50f953..3b540706bbb70d 100644 --- a/components/local-app-api/typescript-grpcweb/webpack.config.js +++ b/components/local-app-api/typescript-grpcweb/webpack.config.js @@ -30,8 +30,6 @@ module.exports = { libraryTarget: "umd", globalObject: "typeof self !== 'undefined' ? self : this", }, - externals: { - "@improbable-eng/grpc-web": "commonjs2 @improbable-eng/grpc-web", - }, + externals: {}, mode: "production", };