Skip to content

Fix Dockerfile ARG continuation parsing - #1299

Open
SimonYang (simonyang08) wants to merge 1 commit into
devcontainers:mainfrom
simonyang08:codex/arg-continuation-1286
Open

Fix Dockerfile ARG continuation parsing#1299
SimonYang (simonyang08) wants to merge 1 commit into
devcontainers:mainfrom
simonyang08:codex/arg-continuation-1286

Conversation

@simonyang08

Copy link
Copy Markdown

Fixes #1286

Summary

  • join Dockerfile lines that use the default backslash continuation before scanning instructions
  • collect every declaration from a continued ARG instruction
  • preserve the existing single-declaration behavior for ENV and USER
  • add regression coverage for default and buildArgs-overridden values

Root cause

The lightweight Dockerfile scanner matched physical lines and recorded only one name/value pair for each ARG instruction. Docker joins continuation lines before parsing, so the second declaration was invisible to the CLI even though Docker/BuildKit accepted it. A later FROM reference therefore resolved to an empty value and produced an invalid image reference.

Validation

  • focused dockerfileUtils suite: 70 passing
  • npm run type-check: passed
  • npm run lint: passed
  • git diff --check: passed

The repository-wide npm test script uses Unix env/rm commands and is not directly runnable from the current Windows shell. The focused parser suite covers the changed module; upstream CI should provide the remaining platform and integration validation.

AI disclosure

This change was prepared with OpenAI Codex assistance and reviewed and validated locally by the contributor.

@simonyang08

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@simonyang08
SimonYang (simonyang08) marked this pull request as ready for review August 30, 2026 13:26
@simonyang08
SimonYang (simonyang08) requested a review from a team as a code owner August 30, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-variable ARG declared via line continuation loses its second variable

2 participants