Skip to content
代码片段 群组 项目
未验证 提交 999598c1 编辑于 作者: Alper Akgun's avatar Alper Akgun 提交者: GitLab
浏览文件

Merge branch 'vtak/vscode_upgrade_option' into 'master'

Use updated vscode fork in workspace if attribute is set

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144288



Merged-by: default avatarAlper Akgun <aakgun@gitlab.com>
Approved-by: default avatarAlper Akgun <aakgun@gitlab.com>
Co-authored-by: default avatarVishal Tak <vtak@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -27,8 +27,10 @@ def self.inject(value)
type: :beta
)
inject_tools_component(processed_devfile, tools_dir)
tools_component = processed_devfile['components'].find { |c| c.dig('attributes', 'gl/inject-editor') }
use_vscode_1_81_attribute = tools_component.fetch('attributes', {}).fetch('gl/use-vscode-1-81', true)
use_vscode_1_81 = [true, "true"].include? use_vscode_1_81_attribute
inject_tools_component(processed_devfile, tools_dir, use_vscode_1_81)
if tools_component
override_main_container(
......@@ -110,9 +112,10 @@ def self.override_main_container(component, tools_dir, editor_port, ssh_port, en
# @param [Hash] processed_devfile
# @param [String] tools_dir
# @param [Boolean] use_vscode_1_81
# @return [Array]
def self.inject_tools_component(processed_devfile, tools_dir)
processed_devfile['components'] += tools_components(tools_dir)
def self.inject_tools_component(processed_devfile, tools_dir, use_vscode_1_81)
processed_devfile['components'] += tools_components(tools_dir, use_vscode_1_81)
processed_devfile['commands'] = [] if processed_devfile['commands'].nil?
processed_devfile['commands'] += [{
......@@ -128,11 +131,12 @@ def self.inject_tools_component(processed_devfile, tools_dir)
end
# @param [String] tools_dir
# @param [Boolean] use_vscode_1_81
# @return [Array]
def self.tools_components(tools_dir)
def self.tools_components(tools_dir, use_vscode_1_81)
# TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/409775 - choose image based on which editor is passed.
image_name = 'registry.gitlab.com/gitlab-org/gitlab-web-ide-vscode-fork/web-ide-injector'
image_tag = '7'
image_tag = use_vscode_1_81 ? '7' : '8'
[
{
......
---
schemaVersion: 2.2.0
metadata: {}
components:
- name: tooling-container
attributes:
gl/inject-editor: true
gl/use-vscode-1-81: false
container:
image: quay.io/mloriedo/universal-developer-image:ubi8-dw-demo
args:
- |-
sshd_path=$(which sshd)
if [ -x "$sshd_path" ]; then
echo "Starting sshd on port ${GL_SSH_PORT}"
$sshd_path -D -p $GL_SSH_PORT &
else
echo "'sshd' not found in path. Not starting SSH server."
fi
${GL_TOOLS_DIR}/init_tools.sh
command:
- "/bin/sh"
- "-c"
env:
- name: GL_TOOLS_DIR
value: "/projects/.gl-tools"
- name: GL_EDITOR_LOG_LEVEL
value: "info"
- name: GL_EDITOR_PORT
value: "60001"
- name: GL_SSH_PORT
value: "60022"
- name: GL_EDITOR_ENABLE_MARKETPLACE
value: "true"
endpoints:
- name: editor-server
targetPort: 60001
exposure: public
secure: true
protocol: https
- name: ssh-server
targetPort: 60022
exposure: internal
secure: true
dedicatedPod: false
mountSources: true
- name: database-container
container:
image: mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "my-secret-pw"
dedicatedPod: false
mountSources: true
- name: gl-tools-injector
container:
image: registry.gitlab.com/gitlab-org/gitlab-web-ide-vscode-fork/web-ide-injector:8
env:
- name: GL_TOOLS_DIR
value: "/projects/.gl-tools"
memoryLimit: 256Mi
memoryRequest: 128Mi
cpuLimit: 500m
cpuRequest: 100m
events:
preStart:
- gl-tools-injector-command
commands:
- id: gl-tools-injector-command
apply:
component: gl-tools-injector
......@@ -43,4 +43,17 @@
expect(returned_value[:processed_devfile]).to eq(expected_processed_devfile)
end
end
context "when devfile attribute gl/use-vscode-1-81 is false" do
let(:expected_processed_devfile_name) { 'example.tools-injected-vscode-1-85-devfile.yaml' }
before do
tools_component = input_processed_devfile['components'].find { |c| c.dig('attributes', 'gl/inject-editor') }
tools_component['attributes']['gl/use-vscode-1-81'] = false
end
it 'injects the tools injector component' do
expect(returned_value[:processed_devfile]).to eq(expected_processed_devfile)
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册