question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Dependencies - installsAfter not respected

See original GitHub issue

Hello,

I’ve written a couple of features for a project I’m working on and I’ve ran into situations where I’m not sure what the best approach to take is.

For example, I have a feature which involves installing a CLI tool using npm. Now, I’m not sure whether this feature should also install Node.js so that it is able to install the CLI tool, since I have no control over the base image, nor the included features in the devcontainer.json file.

The power of features, as I understand, is that they can be composed together; making each serve one purpose (installing the given feature) thus providing a simple way to handle all the tooling permutations for many different developers and/or teams whilst avoiding “golden container images”; and similar perhaps in concept to buildpacks.

So it occurred to me that since devcontainers/features already provide features for installing Node.js (and other language runtimes), it would be beneficial to make my feature dependant on the node feature. Then I wouldn’t need to worry about which base image a developer is using, and the node feature would be automatically included before mine, so my feature would install reliably.

Additional scenarios include:

  • a Ruby gem which needs to build a native extension and thus requires build-essential to be installed.
  • a Python package, installed via pip, needing to ensure Python and pip are installed.
  • a Go CLI tool, which doesn’t have a binary distribution, installed using go install, needing go to be installed.
  • a tflint ruleset for AWS, which requires Terraform and tflint to be installed.

I realise installing packages using a postCreateCommand script can work, but it places the onus on the developer to know what features to include to install the given package. For example, I’m building features which install Python packages (e.g. mkdocs) for C# .Net developers, who wouldn’t know to include the python feature.

I imagine a devcontainer-feature.json file including a dependsOn property, in the same schema as the devcontainer.json features object.

I.e.

"dependsOn": {
  "ghcr.io/user/repo/go": {},
  "ghcr.io/user/repo1/go:1": {},
  "ghcr.io/user/repo2/go:latest": {},
  "https://github.com/user/repo/releases/devcontainer-feature-go.tgz": { 
        "optionA": "value" 
  },
  "./myGoFeature": { 
        "optionA": true,
        "optionB": "hello",
        "version" : "1.0.0"
  }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:25 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
edgonmsftcommented, Oct 13, 2022

Awesome! Keep the feedback coming!

1reaction
virtualstaticvoidcommented, Oct 12, 2022

Hi @edgonmsft

Okay, I’ve updated my test repo with the changes to installsAfter and to use a global scenario test as mentioned above.

🎉 The global scenario test is passing now; installing the python feature dependency prior to running the “pip” test.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dev Container Features - Visual Studio Code
Allows users to control the order of execution of their Features. The installsAfter property defined as part of a Feature's devcontainer-feature ...
Read more >
October 2022 Endgame #164400 - microsoft/vscode - GitHub
All closed feature-requests either have a verification-needed or on-testplan label ... Feature Dependencies - installsAfter not respected ...
Read more >
Dev Container Features reference - Development containers
This property is defined in an individual Feature's devcontainer-feature.json file by the feature author. installsAfter allows an author to provide the tooling ...
Read more >
Bluetooth error supervised-installer - Configuration
I installed home assistant supervised using the supervised-installer method from this link on an old ThinkPad with Debian.
Read more >
After 4 failed Arch installs (after several successful VM ... - Reddit
I respect it, since doing all that installation contributes downstream to things like ... With Arch and Arco in the VM i've had...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found