Skip to content

feat: allow to configure product.json using configmap#521

Merged
vitaliy-guliy merged 3 commits intomainfrom
support-api-proposal
Mar 18, 2025
Merged

feat: allow to configure product.json using configmap#521
vitaliy-guliy merged 3 commits intomainfrom
support-api-proposal

Conversation

@vitaliy-guliy
Copy link
Contributor

@vitaliy-guliy vitaliy-guliy commented Mar 4, 2025

What does this PR do?

Allows to configure product.json file using Config Map

What issues does this PR fix?

eclipse-che/che#23270

How to test this PR?

Check the existing functionality

Add a Config Map from the template below and create a workspace with the editor quay.io/che-incubator-pull-requests/che-code:pr-521-amd64 clicking the button

Contribute

apiVersion: v1
kind: ConfigMap
metadata:
  name: vscode-editor-configurations
data:
  extensions.json: |
    {
      "recommendations": [
          "dbaeumer.vscode-eslint",
          "github.vscode-pull-request-github"
      ]
    }
  settings.json: |
    {
      "window.header": "A HEADER MESSAGE",
      "window.commandCenter": false,
      "workbench.colorCustomizations": {
        "titleBar.activeBackground": "#CCA700",
        "titleBar.activeForeground": "#ffffff"
      }
    }
immutable: false
  • A header message should be shown, recommended extensions being installed.
  • A section in the entrypoint-logs.txt file should contain:
# Checking for editor configurations provided by 'vscode-editor-configurations' Config Map...
  > Configure editor settings...
    > Found setings file: /checode/remote/data/Machine/settings.json
    > Editor settings have been configured.
  > Configure workspace extensions...
    > Found workspace file: /projects/.code-workspace
    > Workspace extensions have been configured.

Add Enabled API proposal, trusted extension

Add a Config Map from the template below and create a workspace clicking the button

Contribute

apiVersion: v1
kind: ConfigMap
metadata:
  name: vscode-editor-configurations
data:
  product.json: |
    {
      "extensionEnabledApiProposals": {
        "ms-python.python": [
          "contribEditorContentMenu",
          "quickPickSortByLabel",
          "testObserver",
          "quickPickItemTooltip",
          "terminalDataWriteEvent",
          "terminalExecuteCommandEvent",
          "contribIssueReporter"
        ]
      },
      "trustedExtensionAuthAccess": [
        "vgulyy.extension"
      ],
      "version": "1.96.4"
    }
immutable: false
  • Product.json should contain both extensionEnabledApiProposals and trustedExtensionAuthAccess sections.
  • Go to Help -> About, a version should be changed to 1.96.4.
  • A section in the entrypoint-logs.txt file should contain:
# Checking for editor configurations provided by 'vscode-editor-configurations' Config Map...
  > Configure product.json ...
    > product.json have been configured.

Test the behavior with corrupted Config Map

Add a Config Map from the template below and create a workspace clicking the button

Contribute

apiVersion: v1
kind: ConfigMap
metadata:
  name: vscode-editor-configurations
data:
  extensions.json: |
    ...
  settings.json: |
    ...
  product.json: |
    ...
immutable: false
  • A section in the entrypoint-logs.txt should contain:
# Checking for editor configurations provided by 'vscode-editor-configurations' Config Map...
  > Configure editor settings...
Failed to configure editor settings. SyntaxError: Configmap content is not valid. Unexpected token '.', "...
" is not valid JSON
    at JSON.parse (<anonymous>)
    at parseJSON (file:///checode/checode-linux-libc/ubi9/launcher/json-utils.js:49:21)
    at EditorConfigurations.configureSettings (file:///checode/checode-linux-libc/ubi9/launcher/editor-configurations.js:52:43)
    at EditorConfigurations.configure (file:///checode/checode-linux-libc/ubi9/launcher/editor-configurations.js:37:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Main.start (file:///checode/checode-linux-libc/ubi9/launcher/main.js:34:9)
    at async file:///checode/checode-linux-libc/ubi9/launcher/entrypoint.js:14:9
  > Configure workspace extensions...
Failed to configure workspace extensions. SyntaxError: Configmap content is not valid. Unexpected token '.', "...
" is not valid JSON
    at JSON.parse (<anonymous>)
    at parseJSON (file:///checode/checode-linux-libc/ubi9/launcher/json-utils.js:49:21)
    at EditorConfigurations.configureExtensions (file:///checode/checode-linux-libc/ubi9/launcher/editor-configurations.js:83:45)
    at EditorConfigurations.configure (file:///checode/checode-linux-libc/ubi9/launcher/editor-configurations.js:38:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Main.start (file:///checode/checode-linux-libc/ubi9/launcher/main.js:34:9)
    at async file:///checode/checode-linux-libc/ubi9/launcher/entrypoint.js:14:9
  > Configure product.json ...
Failed to configure product.json. SyntaxError: Configmap content is not valid. Unexpected token '.', "...
" is not valid JSON
    at JSON.parse (<anonymous>)
    at parseJSON (file:///checode/checode-linux-libc/ubi9/launcher/json-utils.js:49:21)
    at EditorConfigurations.configureProductJSON (file:///checode/checode-linux-libc/ubi9/launcher/editor-configurations.js:118:42)
    at EditorConfigurations.configure (file:///checode/checode-linux-libc/ubi9/launcher/editor-configurations.js:39:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Main.start (file:///checode/checode-linux-libc/ubi9/launcher/main.js:34:9)
    at async file:///checode/checode-linux-libc/ubi9/launcher/entrypoint.js:14:9

Does this PR contain changes that override default upstream Code-OSS behavior?

  • the PR contains changes in the code folder (you can skip it if your changes are placed in a che extension )
  • the corresponding items were added to the CHANGELOG.md file
  • rules for automatic git rebase were added to the .rebase folder

Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
@github-actions
Copy link

github-actions bot commented Mar 4, 2025

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

github-actions bot commented Mar 4, 2025

@vitaliy-guliy vitaliy-guliy marked this pull request as ready for review March 5, 2025 13:37
@vitaliy-guliy vitaliy-guliy added the made-with-che Changes made with Che-Code label Mar 5, 2025
Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
@github-actions
Copy link

Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
@github-actions
Copy link

* Recursively copies all properties from the first object to the next.
* If the property exists in the next object, its value will be updated.
*/
export function mergeFirstWithSecond(first: any, second: any) {
Copy link
Collaborator

@RomanNikitenko RomanNikitenko Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name it just merge()
It's clear enough that the function merges given objects

@vitaliy-guliy vitaliy-guliy merged commit 4a9614d into main Mar 18, 2025
12 checks passed
@vitaliy-guliy vitaliy-guliy deleted the support-api-proposal branch March 18, 2025 13:43
@devspacesbuild
Copy link

Build 3.20 :: code_3.x/1568: Console, Changes, Git Data

vitaliy-guliy added a commit that referenced this pull request Mar 27, 2025
Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
vitaliy-guliy added a commit that referenced this pull request Mar 27, 2025
Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

made-with-che Changes made with Che-Code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants