3.5 KiB
3.5 KiB
Generated 2026-05-12 at base-sha 28f54cf7bef9. Type: top-level. 0 sources.
Environment Mapping
cicd_environment is the single string that controls which registry, vault, ArgoCD cluster, and GCS bucket the pipeline uses. It is derived from the branch name (for push builds) or the PR target branch (for PR builds).
TL;DR
- Push to
main/master/gcp-main→prd. - Push to
develop→stg. - PR targeting
main→int(pre-prod). - PR targeting
develop→ftr(feature). - Any other branch →
ftr(fallback). - Hotfix branches skip tests and Sonar but still map to
prd. env.CHANGE_IDbeing set signals a PR build and flips the mapping table.
Mental model
constructParam.run() switches on env.CHANGE_ID to decide which environment_map to use. Without CHANGE_ID (push build), branches map to their canonical environments. With CHANGE_ID (PR build), the same branch names map to the pre-prod equivalents: main→int, develop→ftr. This double-mapping is why develop can be either stg (push) or ftr (PR).
Structure / data flow
env.CHANGE_ID not set (push build):
environment_map = {
master/main/gcp-main/farmiso-main/gcp-master → prd
develop/gcp-dev → stg
}
branch not in map → ftr (default)
env.CHANGE_ID set (PR build):
branch_name = env.CHANGE_TARGET
environment_map = {
master/main/gcp-main/farmiso-main/gcp-master → int
develop/gcp-dev → ftr
}
env.cicd_environment = environment_map[branch_name]
Key code locations
| Symbol | File | What it does |
|---|---|---|
run |
src/com/meesho/utilities/constructParam.groovy:run |
Sets env.cicd_environment + all env vars |
run |
src/com/meesho/stages/deployArgoCD.groovy:run |
Has its own branch_param_map for helm/argo branch naming |
run |
src/com/meesho/stages/hotFix.groovy:run |
Detects hotfix/* branch and sets env.hot_fix=true |
Sharp edges
- Two separate maps exist:
constructParamhas one map forcicd_environment;deployArgoCDhas a differentbranch_param_mapfor the Helm/Argo Git branch names (main,develop,feature,pre-prod). These are not the same and must not be conflated. gcp-devmaps tostg: services on thegcp-devbranch deploy to staging, not a separate dev environment.- Toolchain override: if
env.INFRA_ENV == 'toolchain'and the service is Node,branch_nameis forced todevelopso the image goes tostgtoolchain registry regardless of actual branch. farmiso-mainis treated as an alias formain— it maps toprdon both push and PR builds tomain.- Use
env.CHANGE_IDto detect PR context — notenv.BRANCH_NAME =~ /PR-/: theBRANCH_NAME =~ /PR-/pattern breaks on non-GitHub SCMs and re-triggered builds.env.CHANGE_IDis the canonical PR-build detector set by the GitHub Branch Source plugin and is used throughoutconstructParam.groovy:run(src/com/meesho/utilities/constructParam.groovy:run).
Related concepts
- Config policy —
constructParamsets env vars after mapping - Architecture — where
commonCICDFlowcallsconstructParam
Notes
← Previous · Index · Next →