Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Container: ${containerEnv:VAR_NAME} not properly expanded in devcontainer.json in customizations.vscode.settings #10033

Closed
georglauterbach opened this issue Jul 5, 2024 · 5 comments · Fixed by devcontainers/cli#856
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers verified Verification succeeded
Milestone

Comments

@georglauterbach
Copy link

georglauterbach commented Jul 5, 2024

  • VSCode Version: 1.90.0 89de5a8d4d6205e5b11647eb6a74844ca23d2573 x64
  • Local OS Version: Ubuntu 22.04.4 LTS (Linux 6.5.0-41-generic Add options to control the consistency of the source mount #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 3 11:32:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux)
  • Remote OS Version: Ubuntu 22.04.4 LTS (Linux 6.5.0-41-generic Add options to control the consistency of the source mount #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 3 11:32:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux)
  • Remote Extension/Connection Type: Dev Container over Remote-SSH (verified that the issue also occurs when connecting via RDP without Remote-SSH)
  • Logs: N/A

Steps to Reproduce:

  1. Write a devcontainer.json file with the following content:
    {
      // some config, and then
      "containerEnv": {
        "BUILD_OUTPUT_DIR": "${containerWorkspaceFolder}/../build-${containerWorkspaceFolderBasename}"
      },
      // some more config, and then
      "customizations": {
        "vscode": {
          "settings": {
            "sonarlint.pathToCompileCommands": "${containerEnv:BUILD_OUTPUT_DIR}/compile_commands.json",
            "cmake.buildDirectory": "${containerEnv:BUILD_OUTPUT_DIR}",
            "clangd.arguments": [
              "--compile-commands-dir=${containerEnv:BUILD_OUTPUT_DIR}"
            ]
          }
        }
      }
    }
  2. This worked until today, but I am not seeing the following error, for example when configuring with CMake:
    [main] Configuring project: <PROJECT NAME>
    [rollbar] Unhandled exception: Failed writing to file ${containerEnv:BUILD_OUTPUT_DIR}/.cmake/api/v1/query/client-vscode/query.json Error: EACCES: permission denied, mkdir '${containerEnv:BUILD_OUTPUT_DIR}' {}
    [driver] Failed to configure project
    And I see similar behavior with Clangd, which tells me that the path to my compile_commands.json does not exist. Somehow, it looks like ${containerEnv:BUILD_OUTPUT_DIR} is not expanded anymore...

Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: N/A (you need the Dev Container extension)

@vscodenpa vscodenpa added the containers Issue in vscode-remote containers label Jul 5, 2024
@chrmarti
Copy link
Contributor

chrmarti commented Jul 9, 2024

Confirmed. This works in the previous stable release 0.369.0 of the Dev Containers extension. You can install that (F1 > Extensions: Install Specific Version of Extension...) until we have this fixed. Thanks.

@chrmarti chrmarti added the bug Issue identified by VS Code Team member as probable bug label Jul 9, 2024
@chrmarti chrmarti added this to the July 2024 milestone Jul 9, 2024
@eleanorjboyd
Copy link
Member

Hi @georglauterbach! Are you able to verify if this fix works? You can do so by getting the latest pre-release version of the dev containers extension. We want to make sure we get this bug verified, and the fix is correct, before we release this to stable. Thanks!

@andreamah andreamah added the author-verification-requested Issues potentially verifiable by issue author label Jul 24, 2024
@rzhao271
Copy link

rzhao271 commented Jul 24, 2024

The remote settings.json still does not have the variables expanded in the latest pre-release.
I confirmed that 0.369.0 expands the variables.
Reopening as verification-found, but let me know if there are different verification steps.

@rzhao271 rzhao271 reopened this Jul 24, 2024
@rzhao271 rzhao271 added the verification-found Issue verification failed label Jul 24, 2024
@chrmarti
Copy link
Contributor

Good catch, this didn't make it into a new Dev Containers CLI release yet. Moving to August, thanks.

@chrmarti chrmarti removed verification-found Issue verification failed author-verification-requested Issues potentially verifiable by issue author labels Jul 25, 2024
@chrmarti chrmarti modified the milestones: July 2024, August 2024 Jul 25, 2024
@chrmarti
Copy link
Contributor

This fix is available in Dev Containers 0.381.0-pre-release.

@rzhao271 rzhao271 added the verified Verification succeeded label Aug 28, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants