devcontainers / devcontainers/features

[EPIC] Prefer DRY tool versioning

Open
#1,699 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
1.5k
Forks
621
Avg merge
2d 11h
Merged PRs (30d)
4

Description

The examples in this repository often show a configuration approach where tool version numbers are explicitly specified in the devcontainer.json file.

However, best practice nowadays is to extract your tool versions to a dedicated file.

We should support this best practice in our examples by showing how to indirectly reference to versions.

## Examples of thing to change

https://github.com/devcontainers/features/blob/4170bca4d08a2be5d96a33251a45a0027cc5cacb/src/node/README.md?plain=1#L14-L20

https://github.com/devcontainers/features/blob/4170bca4d08a2be5d96a33251a45a0027cc5cacb/src/ruby/README.md?plain=1#L9-L11

## Example end state

```json
"features": {
"ghcr.io/devcontainers/features/node:2": {
"version": ".nvmrc"
}
}
```

```json
"features": {
"ghcr.io/devcontainers/features/ruby:2": {
"version": ".ruby-version"
}
}
```

## Discussion

Adopting the above approach allows us to achieve DRY version specification with modern development approaches. This means we can easily achieve parity between local developers, GitHub Agents, GitHub Actions, and Dev Containers :nirvana_emoji:

It is possible that the above features I have referenced already implicitly load such a version file. If so, this behavior is undocumented.

I am marking this GitHub issue as an "epic" because it affects many different features. And perhaps we will require several pull requests to address this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.