devcontainers / devcontainers/features

Standardize `containerEnv` and edits to the $PATH variable

Offen
#155 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Shell
Sterne
1.5k
Forks
621
Ø Merge
6 T. 53 Min.
Gemergte PRs (30 T.)
9

Beschreibung

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

image

image

image

Notably, this output is different when using docker exec directly
image

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:
image

image

image

image

image

cc @jungaretti @devcontainers/maintainers

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.