Taming the Drift: Context-aware Repair of Dockerfile Drift during Software Evolution

šŸ“… 2026-07-14
šŸ“ˆ Citations: 0
✨ Influential: 0
šŸ“„ PDF
šŸ¤– 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.
Problem

Research questions and friction points this paper is trying to address.

Dockerfile drift
context-aware repair
CI/CD failures
software evolution
infrastructure-as-code
Innovation

Methods, ideas, or system contributions that make the work stand out.

context-aware repair
Dockerfile drift
dependency graph
CI/CD
automated patch generation
C
Chengjie Wang
Intelligent Software Research Center, Institute of Software, Chinese Academy of Sciences, Beijing, China | University of Chinese Academy of Sciences, Beijing, China
J
Jingzheng Wu
Intelligent Software Research Center, Institute of Software, Chinese Academy of Sciences, Beijing, China | Key Laboratory of System Software (Chinese Academy of Sciences), Beijing, China
Xiang Ling
Xiang Ling
Institute of Software, Chinese Academy of Sciences
Computer ScienceSystem SecuritySoftware SecurityAI Security
T
Tianyue Luo
Intelligent Software Research Center, Institute of Software, Chinese Academy of Sciences, Beijing, China
C
Chen Zhao
Intelligent Software Research Center, Institute of Software, Chinese Academy of Sciences, Beijing, China