devcontainers / devcontainers/features
Standardize `containerEnv` and edits to the $PATH variable
- Langage dominant
- Shell
- Étoiles
- 1.5k
- Forks
- 622
- Merge moyen
- 6 j 53 min
- PR mergées (30 j)
- 9
Description
As seen in a recent PR (https://github.com/devcontainers/features/pull/153), the current pattern for editing important variables like `$PATH` are highly dependent on the technique the author chose to employ (editing `*rc` files, `containerEnv` properties), as well as the _order_ in which both features and the declared variables are listed.
For consistency I believe we need to find a pattern (or perhaps invent some new attribute/concept in the `devcontainer-feature.json`) that allows us to safely and consistently apply container variables in a reproducible way.
## The issue
> Copied from https://github.com/devcontainers/features/pull/153#discussion_r970164559
I think this pattern that we've adopted here (using one containerEnv inside another) -_might_ be dangerous moving forward, since I think that the order this object is emitted into the intermediate Dockerfile is important. Right now the tooling ends up emitting in the provided order



Notably, this output is different when using docker exec directly

Changing the order to:
```
"containerEnv": {
"PATH": "${PATH}:${CONDA_DIR}/bin",
"CONDA_SCRIPT":"${CONDA_DIR}/etc/profile.d/conda.sh",
"CONDA_DIR": "/opt/conda"
}
```
The auto-generated test fails:





cc @jungaretti @devcontainers/maintainers
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le modèle containerEnv de devcontainer-feature.json décrit dans l’issue et comparez la sortie intermédiaire de Dockerfile avec le comportement de docker exec. Examinez le test généré automatiquement qui échoue lorsque l’ordre des variables change. Le travail est terminé lorsqu’un modèle reproductible d’application de variables telles que PATH est défini sans dépendre de l’ordre des features ou des déclarations.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- docker, shell
- Domaine
- devops, infrastructure
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100