Renovate fails to read the devcontrainer template json file #33906
-
How are you running Renovate?Self-hosted Renovate If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.GitHub, Renovate 39 Please tell us more about your question or problemI have a GitHub Repo where we host our own internal devcontainer templates. The template looks like this: // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/xx/xx-devcontainer-templates/tree/main/src/java
{
"name": "java-devcontainer",
// Need to use the "build" option with the "args" instead of the "image" parameter if you work with devcontainer cli
// or devcontainer ci because the devcontainer.json env vars are not passed to the docker build command,
// see https://github.com/microsoft/vscode-remote-release/issues/6464
// and https://github.com/devcontainers/cli/issues/927
"build": {
"dockerfile": "Dockerfile",
"context": ".",
"args": {
"http_proxy": "${localEnv:http_proxy}",
"https_proxy": "${localEnv:https_proxy}",
"no_proxy": "${localEnv:no_proxy}"
},
},
"runArgs": [
"--add-host=host.docker.internal:host-gateway",
// the proxy vars must be set here, otherwise IntelliJ does not work
"-e", "http_proxy=${localEnv:http_proxy}",
"-e", "https_proxy=${localEnv:https_proxy}",
"-e", "no_proxy=${localEnv:no_proxy}"
],
"containerEnv": {
"TESTCONTAINERS_HOST_OVERRIDE": "host.docker.internal",
"NODE_OPTIONS": "--use-openssl-ca --max-old-space-size=8192",
"NODE_EXTRA_CA_CERTS": "/etc/ssl/certs/ca-certificates.crt",
"CHROME_BIN": "/usr/local/bin/chrome",
"http_proxy": "${localEnv:http_proxy}",
"https_proxy": "${localEnv:https_proxy}",
"no_proxy": "${localEnv:no_proxy}"
},
// Features to add to the Dev Container. More info: https://github.com/xx/xx-devcontainer-features
"features": {
"test.com/devcontainer/features/common-utils:1.0.0": {},
"test.com/devcontainer/features/sudo:1.0.0": {},
"test.com/devcontainer/features/docker-out:1.0.0": {
"version": "${templateOption:dockerVersion}",
"useDefaultClientConfig": "${templateOption:useDefaultClientConfig}",
"httpProxy": "${localEnv:http_proxy}",
"httpsProxy": "${localEnv:https_proxy}",
"noProxy": "${localEnv:no_proxy}"
},
"test.com/devcontainer/features/java:1.0.0": {
"version": "${templateOption:javaVersion}",
"patchKeystore": "${templateOption:patchKeystore}",
"mavenVersion": "${templateOption:mavenVersion}"
},
"test.com/devcontainer/features/node:1.0.0": {
"version": "${templateOption:nodeVersion}",
"npmVersion": "${templateOption:npmVersion}"
},
"test.com/devcontainer/features/selenium-manager:1": {
"tag": "latest",
"browser": "${templateOption:browser}",
"browserVersion": "${templateOption:browserVersion}",
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
} Renovate fails to read/parse the json: DEBUG: Error extracting dev container JSON file. (repository=xx/xxx-java-devcontainer-playground, packageFile=src/java/.devcontainer/devcontainer.json)
"err": {
"message": "Schema error",
"stack": "ZodError: Schema error\n at Object.get error [as error] (/usr/local/renovate/node_modules/.pnpm/[email protected]/node_modules/zod/lib/types.js:55:31)\n at ZodPipeline.parse (/usr/local/renovate/node_modules/.pnpm/[email protected]/node_modules/zod/lib/types.js:131:22)\n at Object.extractPackageFile (/usr/local/renovate/lib/modules/manager/devcontainer/extract.ts:17:35)\n at extractPackageFile (/usr/local/renovate/lib/modules/manager/index.ts:75:9)\n at getManagerPackageFiles (/usr/local/renovate/lib/workers/repository/extract/manager-files.ts:58:43)\n at /usr/local/renovate/lib/workers/repository/extract/index.ts:57:28\n at async Promise.all (index 0)\n at extractAllDependencies (/usr/local/renovate/lib/workers/repository/extract/index.ts:54:26)\n at extract (/usr/local/renovate/lib/workers/repository/process/extract-update.ts:160:28)\n at extractDependencies (/usr/local/renovate/lib/workers/repository/process/index.ts:158:26)\n at Object.renovateRepository (/usr/local/r
"issues": "Invalid JSONC"
} Yes, this is not a valid JSON, but it is a common thing todo for devcontainer templates, see other examples here: is there any chance that we would tell Renovate that it should just ignore the json lines which start with Logs (if relevant)LogsDEBUG: Error extracting dev container JSON file. (repository=xx/xxx-java-devcontainer-playground, packageFile=src/java/.devcontainer/devcontainer.json)
"err": {
"message": "Schema error",
"stack": "ZodError: Schema error\n at Object.get error [as error] (/usr/local/renovate/node_modules/.pnpm/[email protected]/node_modules/zod/lib/types.js:55:31)\n at ZodPipeline.parse (/usr/local/renovate/node_modules/.pnpm/[email protected]/node_modules/zod/lib/types.js:131:22)\n at Object.extractPackageFile (/usr/local/renovate/lib/modules/manager/devcontainer/extract.ts:17:35)\n at extractPackageFile (/usr/local/renovate/lib/modules/manager/index.ts:75:9)\n at getManagerPackageFiles (/usr/local/renovate/lib/workers/repository/extract/manager-files.ts:58:43)\n at /usr/local/renovate/lib/workers/repository/extract/index.ts:57:28\n at async Promise.all (index 0)\n at extractAllDependencies (/usr/local/renovate/lib/workers/repository/extract/index.ts:54:26)\n at extract (/usr/local/renovate/lib/workers/repository/process/extract-update.ts:160:28)\n at extractDependencies (/usr/local/renovate/lib/workers/repository/process/index.ts:158:26)\n at Object.renovateRepository (/usr/local/r
"issues": "Invalid JSONC"
}
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
The issues seem to be the trailing commas and not the comments. |
Beta Was this translation helpful? Give feedback.
-
Hi there, Get your discussion fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible. Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this. Discussions without reproductions are less likely to be converted to Issues. Please follow these steps:
If you need help with running renovate on your minimal reproduction repository, please refer to our Running Renovate guide. The Renovate team |
Beta Was this translation helpful? Give feedback.
-
Looks like we need a JSONC parser instead - let's move to an issue once we have a suitable reproduction repo |
Beta Was this translation helpful? Give feedback.
-
sorry, guys It seems like it's all my own fault. It works once I REALLY fixed all my comma issues in the json file. I made a small reproduction setup and it works now there: https://github.com/zisuu/devcontainer-renovate/pull/1/files So ignore me, I'll close this one. Sorry to waste you're time even looking at this :-( Thanks a lot for your efforts trying to help me anyway!! |
Beta Was this translation helpful? Give feedback.
sorry, guys
It seems like it's all my own fault. It works once I REALLY fixed all my comma issues in the json file. I made a small reproduction setup and it works now there: https://github.com/zisuu/devcontainer-renovate/pull/1/files
So ignore me, I'll close this one. Sorry to waste you're time even looking at this :-( Thanks a lot for your efforts trying to help me anyway!!