Skip to content

Support devcontainer feature dependencies via dependsOn property #1950

@stu-bell

Description

@stu-bell

What happened?
dependsOn properties seem to be silently ignored during workspace build.
According to the devcontainer spec, dependsOn should allow features to define dependencies that implementing tools should install as pre-requisites before installing the feature requiring those dependencies. This is in contrast to the installsAfter property which only specifies the order in which other features listed in the devcontainer.json should be installed, if those 'soft dependencies' happen to be listed in the devcontainer.json features list. installsAfter doesn't automatically install dependencies.

Feature authors using the dependsOn property to specify dependencies won't expect users to know or worry about this behaviour and so don't document the need to include dependencies explicitly in the devcontainer.json. Therefore users installing such features will encounter errors and believe there is an issue with the feature rather than devpod itself.

I've created a demo repo (see below). After starting the workspace and ssh in, the command hello should have been installed by the feature's dependency. However the command hello errors with: bash: hello: command not found, and there is no reference to the dependency feature in the build logs

What did you expect to happen instead?
features defined under the dependsOn feature should be installed before the feature specified in devcontainer.json is installed. And therefore when entering the container in GitHub codespaces, I see the dependnecy feature being installed in the build logs, and the command hello is available and returns hey, vscode

At the very least, some loud warning message that features using the dependsOn property do not have dependencies installed automatically, and should explicitly be listed in the devcontainer.json

How can we reproduce the bug? (as minimally and precisely as possible)

I've created a demo that works in GitHub Codespaces but does not work with devpod: https://github.com/stu-bell/devcontainers-dependsOn

My devcontainer.json:

{
	"image": "mcr.microsoft.com/devcontainers/base:alpine" ,
	"features": {
		"./features/dependsOnDemo": {}
	}
}

./features/dependsOnDemo/devcontainer-feature.json:

{
  "id": "dependsOnDemo",
  "version": "0.1.0",
  "name": "dependsOn demo",
  "description": "Demonstrate behaviour of dependsOn property in devcontainer-feature.json",
  "dependsOn": {
    "ghcr.io/devcontainers/feature-starter/hello:latest": {}
  }
}

Local Environment:

  • DevPod Version: v0.6.15
  • Operating System: windows
  • ARCH of the OS: AMD64

DevPod Provider: docker

  • Local/remote provider: ssh

2 other issues have been raised on this but have gone stale:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions