Files
devops-lib-gcp/docs/wiki/pages/build/config-only-detection.md
T
2026-08-26 02:02:24 +05:30

47 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- m-wiki: type=concept slug=config-only-detection topic=build base-sha=28f54cf7bef9 generated-at=2026-05-12T00:00:00+00:00 sources=[] -->
> Generated 2026-05-12 at base-sha 28f54cf7bef9. Type: concept. 0 sources.
# Config-Only Change Detection
When a commit only changes YAML config files (no source code), each language builder skips the compile/test/image-build steps and instead fetches the last-built image tag from GAR (Google Artifact Registry). This avoids rebuilding identical binaries when only configs changed.
## Where it applies in this repo
Implemented independently in each language builder (`src/com/meesho/stages/buildMaven.groovy`, `buildGo.groovy`, `buildNode.groovy`, etc.).
The detection pattern varies slightly by builder but follows the same logic:
1. Run `git diff HEAD~1 -- configs/` (or `git diff ORIG_HEAD -- configs/`).
2. If the diff is non-empty AND no source files changed → set `appConfigChanges = true`, skip compilation.
3. Fetch the latest image tag from the artifact bucket (S3 or GCS) or GAR.
4. Set `env.TAG` to the fetched tag.
5. Proceed directly to `deployArgoCD.run()`.
The check is gated by `skip_s3_check` in `config.yaml`. Setting `skip_s3_check: true` forces a full rebuild even when only configs changed.
## Why this design
Config-only deployments are common at Meesho (dynamic config updates, feature flags). Rebuilding the entire Java or Go binary for a one-line YAML change wastes 310 minutes. By reusing the last image tag and skipping straight to ArgoCD deploy, the pipeline completes in ~1 minute for config-only changes.
The detection relies on `git diff` against the previous commit, so it only works when the commit history is linear. Force-pushes or squash merges may produce false negatives (full rebuild triggered unnecessarily).
## Related
- [Language builds](../07-LANGUAGE-BUILDS.md) — where this check is embedded per builder
- [Build dispatch](build-dispatch.md) — the builder instance that contains this check
## Sources
(no raw/ sources at bootstrap)
## Notes
<!-- Anything below is human-owned. wiki-init never reads or modifies content under this heading. -->
---
[← Wiki index](../../index.md)
<!-- atomic: keep this page ≤600 words. New scope → new concept page that builds on this one. Do not append paragraphs here. -->