š¤ AI Summary
This work addresses the problem of CI/CD build failures caused by drift between Dockerfiles and source code during software evolution. To tackle this issue, the authors propose Cadre, a novel framework that constructs a context-aware dependency graph (CDG) through static analysis to precisely identify code contexts relevant to build failures. Cadre then employs a two-stage repair pipeline to generate targeted patches. A key innovation lies in its context-aware dependency modeling mechanism, which effectively mitigates prompt overflow issues commonly encountered when leveraging large language models (LLMs). Evaluated on the D³ benchmark comprising 1,040 reproducible drift instances, Cadre achieves a repair rate of 35.22%, outperforming rule-based baselines by 2.78Ć and the best LLM-based baseline by 1.24Ć.
š Abstract
Docker is widely used to create reproducible build environments, but Dockerfile drift, the divergence between a Dockerfile and its evolving source code, can cause CI/CD builds to fail. Existing rule-based and retrieval-based repair approaches analyze Dockerfiles in isolation and therefore struggle with context-dependent failures. We present Cadre, a context-aware framework for automated Dockerfile drift repair. Cadre uses static analysis to construct a Context-aware Dependency Graph (CDG), which maps each Dockerfile instruction to its file-level and inter-instruction dependencies. Guided by the CDG, Cadre first selects the context causally relevant to a failure and then generates a targeted patch from that context. We also introduce DodeX, a pipeline that mines real-world Dockerfile drift instances from GitHub Actions CI logs while preserving the complete build configurations omitted by static-snapshot datasets. Using DodeX, we construct $D^3$, a benchmark of 1,040 drift instances reproducible locally with the original CI parameters. Across $D^3$, Cadre achieves a 35.22\% repair rate, 2.78$\times$ that of the rule-based baseline and 1.24$\times$ that of the best LLM-based baseline. Its two-step workflow keeps 95.25\% of prompts below 30k tokens and avoids the prompt-overflow failures that prevent competing LLM-based methods from producing patches in 41 to 58 cases per method. Ablation results confirm that both the CDG and the two-step workflow improve repair performance. Cadre's advantage over diff-only approaches also increases as drift ages across commits, supporting explicit dependency modeling for context-aware infrastructure-as-code maintenance. Code and data are available at https://github.com/dw763j/Cadre.