Subshell command in build options not executed
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 28/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- docker, shell, typescript
調査の方向性
まず、devcontainer.json の build.options の例と emptytestscript.sh のケースで問題を再現し、その後、devContainersSpecCLI.js で生成されるコマンドを、ターミナルで実行した同じコマンドと比較します。build オプションが docker buildx にどのように渡されるかを追跡します。コマンド置換とバッククォートベースのオプションが期待どおりに動作し、ビルドが結果の引数を受け入れれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I have devcontainer.json setup like this
"build": {
"dockerfile": "${localWorkspaceFolder}/docker/development/Dockerfile",
"context": "${localWorkspaceFolder}",
"options": [
"$(awk '{ sub (\"\\\\\\\\$\", \" \"); printf \" --build-arg %s\", $0 } END { print \"\" }' ${localWorkspaceFolder}/.env)"
]
},
awk command in options should read specified .env file and create --build-arg for every one of them.
Unfortunately when i run build command i get this error.
[3829 ms] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-rijad/container-features/0.65.0-1724398400319/Dockerfile-with-features -t vsc-asx-ubuntu-627ff9ecdd16cefae9d376770411bccfd81a6bb640f586cfb01f9d12f1afe637 --target dev_containers_target_stage --no-cache --pull $(awk '{ sub ("\\\\$", " "); printf " --build-arg %s", $0 } END { print "" }' /home/rijad/asx-ubuntu/.env) --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/rijad/asx-ubuntu
ERROR: "docker buildx build" requires exactly 1 argument.
See 'docker buildx build --help'.
Usage: docker buildx build [OPTIONS] PATH | URL | -
Start a build
[3861 ms] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-rijad/container-features/0.65.0-1724398400319/Dockerfile-with-features -t vsc-asx-ubuntu-627ff9ecdd16cefae9d376770411bccfd81a6bb640f586cfb01f9d12f1afe637 --target dev_containers_target_stage --no-cache --pull $(awk '{ sub ("\\\\$", " "); printf " --build-arg %s", $0 } END { print "" }' /home/rijad/asx-ubuntu/.env) --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/rijad/asx-ubuntu
[3861 ms] at mtA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:466:1933)
[3861 ms] at async Pm (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:465:1856)
[3861 ms] at async NH (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:465:610)
[3861 ms] at async KtA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:482:3771)
[3861 ms] at async eB (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:482:4886)
[3861 ms] at async hrA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:663:200)
[3861 ms] at async lrA (/home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js:662:13452)
[3864 ms] Exit code 1
[3867 ms] Command failed: /home/rijad/.vscode-server/bin/5437499feb04f7a586f677b155b039bc2b3669eb/node /home/rijad/.vscode-remote-containers/dist/dev-containers-cli-0.380.0/dist/spec-node/devContainersSpecCLI.js up --container-session-data-folder /tmp/devcontainers-21dbc736-475c-42b1-9342-59f47582801d1724398396161 --workspace-folder /home/rijad/asx-ubuntu --workspace-mount-consistency cached --id-label devcontainer.local_folder=\\wsl.localhost\Ubuntu\home\rijad\asx-ubuntu --id-label devcontainer.config_file=/home/rijad/asx-ubuntu/.devcontainer/asx/devcontainer.json --log-level debug --log-format json --config /home/rijad/asx-ubuntu/.devcontainer/asx/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/mnt/wslg/runtime-dir/wayland-0,target=/tmp/vscode-wayland-476063ef-ff4c-4372-bf8d-ee68a591f2b0.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[3867 ms] Exit code 1
But if I take command
docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-rijad/container-features/0.65.0-1724398400319/Dockerfile-with-features -t vsc-asx-ubuntu-627ff9ecdd16cefae9d376770411bccfd81a6bb640f586cfb01f9d12f1afe637 --target dev_containers_target_stage --no-cache --pull $(awk '{ sub ("\\\\$", " "); printf " --build-arg %s", $0 } END { print "" }' /home/rijad/asx-ubuntu/.env) --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/rijad/asx-ubuntu
and paste it in my terminal, it runs with no issue.
Also other ways of spawning subshell, like backticks do not work as well.
Even if i create empty test script with exec permissions and try
"options": [
"$(${localWorkspaceFolder}/emptytestscript.sh)"
]
it ends up with same error.
I am running wsl Ubuntu on windows 10.
- 主要言語
- TypeScript
- スター
- 3k
- フォーク
- 461
- 平均マージ
- 18分
- マージ済み PR(30日)
- 5
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
devcontainers/cli のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
devcontainers/cli#1203 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
devcontainers/cli#1178 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
devcontainers/cli#1308 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
devcontainers/cli#1307 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
devcontainers/cli#1305 ·
devcontainers/cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
fil-donadoni/tolaria#4409 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
corsairdev/corsair#1764 ·