Skip to content

Test: "initializeCommand" in devcontainer.json #2407

Closed

Description

Refs: #1045

Complexity: 3


On setting up DevContainers for testing: https://github.com/microsoft/vscode-remote-containers/blob/master/CONTRIBUTING.md#testing-remote-containers

"initializeCommand" in the devcontainer.json is an optional property that can be set to a string (run in a shell) or an array of strings (run without shell). Verify:

  • This always runs first when starting / connecting to a DevContainer.
  • Case 1: One of: Single-container (image or Dockerfile) or docker-compose.
  • Case 2: Repository container when the container does not exist yet or is rebuilt.
    • Check the command runs before the Docker image is built (note that there is an auxiliary image built first, the command runs only after that, but before the user image is built).
  • Case 3: Repository container when the container already exists.

The working directory of the command should be the workspace folder. Except with the repository container, the command runs locally on the host OS.

Activity

  1. bpasero commented on Feb 25, 2020

    @bpasero

    I verified that a config such as "initializeCommand": "yarn" gets run when I open a folder in docker on Windows.

    I am not sure I understand the Case 1-2-3 matrix you ask for and I am also not skilled enough in remote containers to know how to set this up (I appreciate how this docs gave me a good step by step description).

    Are there docs for how to setup the other cases?

  2. added
    verification-steps-needed
    on Feb 25, 2020
  3. chrmarti commented on Feb 25, 2020

    @chrmarti
    ContributorAuthor

    Benjamin Pasero (@bpasero)

    Case 1 is really just https://github.com/microsoft/vscode-remote-containers/blob/master/CONTRIBUTING.md#single-container-with-dockerfile-or-image. It sounds like you already did that.

    Case 2 and 3 is https://github.com/microsoft/vscode-remote-containers/blob/master/CONTRIBUTING.md#repository-container with:

    • Case 2: Make sure the container does not exist yet or rebuild it. (Just one of the two.)
    • Case 3: Make sure the container already exists and connect to it.
    • Run Remote-Containers: Show Log to inspect the current log and check your command was run in both cases.
  4. removed
    verification-steps-needed
    on Feb 25, 2020
  5. bpasero commented on Feb 25, 2020

    @bpasero

    Christof Marti (@chrmarti) ok. any reason that command is not in the default commands list?

    image

  6. chrmarti commented on Feb 25, 2020

    @chrmarti
    ContributorAuthor

    Benjamin Pasero (@bpasero) The command is there when you are not connected to a remote already.

  7. mjbvz commented on Feb 26, 2020

    @mjbvz

    I tested on MacOS. Ran into a few hiccups but seems to work overall

  8. removed their assignment
    on Feb 26, 2020
  9. sbatten commented on Feb 26, 2020

    @sbatten
    Member

    Blocked by the above issue.

  10. removed their assignment
    on Feb 27, 2020
  11. egamma commented on Feb 27, 2020

    @egamma
    Member

    Verified that the blocking issue on Windows is resolved.
    Covered cases 1, 2, 3.

  12. locked and limited conversation to collaborators on Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions