7.3 KiB
Generated 2026-05-21 at base-sha 5399a5ddc36b. Type: top-level. 6 sources.
Cross-cutting patterns
Retries
| Caller | Downstream | Retry |
|---|---|---|
deployArgoCD.groovy:506,526 |
ArgoCD sync | argocd app sync --http-retry-max 3 --retry-backoff-duration 1m |
buildNode.groovy:389, buildGo.groovy:172 |
Docker registry push | retryDockerPush — 5 attempts with 3s sleep between |
buildMaven, buildGradle, buildPython, buildPhp |
various | No retry |
securityScan.groovy:12 |
In-house scanner | No retry |
notify.groovy:108-152 |
Deployment Tracker | No retry — single failed POST = missed deploy in the dashboard |
BUGS_AND_IMPROVEMENTS_REPORT.md lists "no retry mechanism" as P1; the reconciled-in nuance is that retry IS present for ArgoCD sync + Docker push, but not for most other downstream calls.
BU multi-tenancy
env.BU and config.bu flow from CAC config (read once by constructParam.groovy) and drive:
| Use | Code site |
|---|---|
| ArgoCD namespace | argocd-${env.BU}-prd — constructParam.groovy:318 |
| GCP cluster name | k8s-${env.BU}-prd-ase1 — constructParam.groovy:308 |
| GCP project | meesho-${config.bu}-prd-0622 — constructParam.groovy:178 |
| Helm chart path | ${env.helmChartsPath}/${config.bu}/... — helmGenerator.groovy:150, deployArgoCD.groovy:293 |
| Non-prd node pool | ${env.BU}-shared (all dev/ftr/stg traffic for the BU collapses to one pool) — nodePoolSelection.groovy:133-135 |
Implication for non-prd capacity planning: a single noisy service in bu=supply degrades every other supply service on staging, because they all share supply-shared. See docs/tribal-knowledge.md §8.
Feature flags / toggle conditions
| Flag | Set by | Effect | Read at |
|---|---|---|---|
env.hot_fix |
hotFix.groovy:11 |
Skips Sonar + quality gate; sets canary skipAnalysis |
buildGo.groovy:25-28, buildMaven.groovy:37-40, deployArgoCD.groovy:355 |
config.skip_sonar |
Service Jenkinsfile param | Skips quality-gate check (gated by whitelist for Maven prd) | buildMaven.groovy:18,240-243, constructParam.groovy:51-56 |
config.skip_security_scan |
Service Jenkinsfile param | Skips POST to security-scan endpoint | securityScan.groovy:7-9 |
config.push_to_jfrog |
Service Jenkinsfile param | Allow non-default-branch JFrog push (default branches: master, main) | buildMaven.groovy:19,377 |
config.push_to_s3 |
Service Jenkinsfile param | Allow non-default-branch S3 push (default branches: master, main, gcp-main, gcp-master) | buildMaven.groovy:20,462 |
env.INFRA_ENV == 'toolchain' |
CAC config | Skips Docker push, uses latest-tag logic | buildGo.groovy:40-58, buildNode.groovy:215-239 |
env.CHANGE_ID |
GitHub Branch Source plugin | PR-build detection; remaps cicd_environment (prd→int for main/master PRs, stg→ftr for develop PRs) |
constructParam.groovy:107-110 |
Do not use env.BRANCH_NAME =~ /PR-/ as a PR-build detector — it breaks on re-triggered builds and non-GitHub SCMs.
Parallel execution
The pipeline is almost entirely linear. The one confirmed parallel { } block is in multi-module Go builds at buildGo.groovy:161-179:
for (m in modules) {
moduleBuilds["build-${moduleName}"] = { ... }
}
parallel moduleBuilds
Anything called from inside that closure must respect the @NonCPS rule (see constructTemplate.groovy:13-20 — the template engine wrapper is @NonCPS because SimpleTemplateEngine is non-serialisable).
Exception handling — inconsistent on purpose-ish
catch (Exception e) appears ~87 times across stages. Three observed patterns:
| Pattern | Example | Behaviour |
|---|---|---|
| Catch + log + rethrow | buildNode.groovy:20-26 |
Hard-fail the stage. Most common. |
| Catch + log + swallow (loop body) | deployArgoCD.groovy:103-106 |
Continue with the next deployment in the loop. Intentional for multi-deploy resilience. |
| Catch + log + swallow (silent fall-through) | buildNode.groovy:199-200 |
Recovers with a sensible default. Use with caution — readers don't always realise the stage "succeeded" while masking a real error. |
When adding new error handling, prefer the rethrow pattern unless the loop-resilience semantics are an explicit requirement.
Validation: validate_configs.py
resources/com/meesho/validate_configs.py (1207 lines) is the monolithic CAC schema validator, invoked from Groovy via sh. Key validation classes:
- Schema (line 949) —
application-{dev,int,stg,prd}.ymlagainstapplication-schema.yml. - Cross-env endpoint check (line 1010) — prevents stg configs from referencing prd endpoints.
- Secrets detection (line 1099) — via
detect_secretslibrary. - DB URL patterns (lines 41-59) — PostgreSQL/MySQL/MongoDB/Redis/SQLite URI shapes.
- Zookeeper endpoint patterns — env-specific allow-lists.
validate_configs_v2.py (1261 lines) is the eventual replacement; both are referenced today.
See also: concepts/whitelists, concepts/secrets-and-auth, concepts/observability.