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

devcontainer.json cannot use exported vars from initializeCommand #6983

Open
bence42 opened this issue Jul 22, 2022 · 3 comments
Open

devcontainer.json cannot use exported vars from initializeCommand #6983

bence42 opened this issue Jul 22, 2022 · 3 comments
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Milestone

Comments

@bence42
Copy link

bence42 commented Jul 22, 2022

Version: 1.69.2 (user setup)
Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a
Date: 2022-07-18T16:12:52.460Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19044

The initializeCommand is advertised to run as the very first step, but it cannot be used to have any meaningful effect on the devcontainer.json itself. For example none of the following is possible:

  • setting the "name" property from initializeCommand
  • setting the FROM argument of a Dockerfile by passing a build-arg that's exported by initializeCommand
  • changing proxy settings on a user by user basis via initializeCommand
  • changing any setting in the devcontainer.json
  • rolling out docker image version updates without having to tinker with the vscode devcontainer settings

We use several docker images in production and we use them locally by inheriting from them and building a new image with all the user specific things, and run them in a user specific way (proxy, extensions, CCACHE settings, etc).
It'd be nice to keep the devcontainer.json as a generic template and have initializeCommand do whatever it wants and to use these effects in the devcontainer.json. This way we could use scripts to extract image versions, parse various untracked user files for CCACHE configs, etc, so that each user can fine tune the environment without having a dirty working tree.

Steps to Reproduce:

  "name": "${env:DEV_IMAGE_NAME}",
  "build": {
    "dockerfile": "Dockerfile",
    "args": {
      "IMAGE_URL": "${localEnv:DEV_IMAGE_URL}",
      "DOCKER_REGISTRY_URL": "${localEnv:DOCKER_REGISTRY_URL",
      "USERNAME": "${localEnv:USER}",
      "USER_UID": "${localEnv:USER_UID}",
      "USER_GID": "${localEnv:USER_GID}"
    }
  },
  "initializeCommand": "${localWorkspaceFolder}/.devcontainer/initialize-command.sh",
@bence42 bence42 changed the title to devcontainer.json devcontainer.json cannot use exported vars from initializeCommand Jul 22, 2022
@github-actions github-actions bot added the containers Issue in vscode-remote containers label Jul 22, 2022
@bence42
Copy link
Author

bence42 commented Aug 10, 2022

ping

@bence42
Copy link
Author

bence42 commented Aug 17, 2022

pingity ping pong

@bence42
Copy link
Author

bence42 commented Sep 29, 2022

is it on?

@chrmarti chrmarti added the feature-request Request for new features or functionality label Dec 7, 2022
@chrmarti chrmarti added this to the Backlog milestone Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants