devcontainers / devcontainers/features

Standardize `containerEnv` and edits to the $PATH variable

オープン
#155 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Shell
スター
1.5k
フォーク
621
平均マージ
6日 53分
マージ済み PR(30日)
9

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

issue に記載されている devcontainer-feature.json の containerEnv パターンから始め、中間的な Dockerfile 出力と docker exec の動作を比較します。変数の順序が変わると失敗する自動生成テストを確認します。feature や宣言の順序に依存せず、PATH などの変数を適用する再現可能なパターンを定義できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, shell
領域
devops, infrastructure
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。