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

6.3 KiB

Generated 2026-05-21 at base-sha 5399a5ddc36b. Type: top-level. 6 sources.

Build dispatch

buildObjHelper.groovy is the central switch from the build_tool parameter (set in the service Jenkinsfile) to the stage class that actually runs. vars/buildPipeline.groovy:12 calls buildObjHelper.run(param.build_tool) and assigns the return to buildObj; everything from then on flows through that object.

The switch (buildObjHelper.groovy:5-30)

build_tool value Stage class Source
maven buildMaven src/com/meesho/stages/buildMaven.groovy
maven-* (e.g. maven-3.3-jdk-17) buildMaven same
docker buildDocker src/com/meesho/stages/buildDocker.groovy
python-* (e.g. python-3.10) buildPython src/com/meesho/stages/buildPython.groovy
node-* (e.g. node-16) buildNode src/com/meesho/stages/buildNode.groovy
go* (e.g. go1.21) buildGo src/com/meesho/stages/buildGo.groovy
gradle buildGradle src/com/meesho/stages/buildGradle.groovy
php buildPhp src/com/meesho/stages/buildPhp.groovy
any other value defaultBuild (silent no-op) (default case at line 28)

There is no sbt case and no rust case, despite what older docs may have implied (both have been reconciled out — see review-learnings.md for the audit trail).

Per-language quirks worth knowing

buildMaven

buildGo

  • sonar_scan() (lines 212-270) downloads the Go binary AND the sonar-scanner zip via curl inside the build stage itself (lines 227, 236) — there is no fileExists check on sonar-project.properties before the scan (line 220).
  • Go test failures are caught and logged but do not propagate as pipeline failure (lines 232-235): echo "Go tests failed, but the pipeline will continue.".
  • env.hot_fix = true (set by hotFix.groovy:11) skips Sonar AND the quality gate (lines 25-28).
  • Multi-module builds run in parallel { } (lines 161-179).
  • Docker push wrapped by retryDockerPush (5 attempts, 3s sleep) — see 05-cross-cutting.

buildNode

  • getNpmRc (lines 63-68) fetches MEESHO_NPMRC_SECRET from AWS Secrets Manager or Vault and writes it to .npmrc in the workspace.
  • Inline .env writes for GITHUB_TOKEN and SONAR credentials (lines 283-312) — note: there is no truncate -s 0 .env cleanup pattern; that was a historical PR concern that has been resolved.
  • DOCKER_BUILDKIT=0 is set explicitly (lines 387, 392, 400, 405) — BuildKit is disabled, not enabled. The BUILDKIT acronym entry in docs/acronyms.md was reconciled accordingly.
  • Docker push via retryDockerPush (line 389).

buildPython

  • Docker build with module support (lines 89-210) — no Sonar scan (unlike Maven / Go / Node).
  • Duplicate-key bug in docker_bindings map at lines 75 and 78 — second assignment overwrites the first. Flagged in BUGS report.

buildGradle

  • branch_name = 'repo' hard-coded at lines 252 and 285 — the subsequent comparison against 'master'/'main' therefore never matches the real branch. Flagged in BUGS report; do not assume branch_name is dynamic there.
  • Uses xq to query build.gradle (lines 255-256, 260, 288-289, 293) — xq is an XML query tool and Gradle files are Groovy/Kotlin DSL, not XML. Flagged.

Adding a new build_tool

  1. Create src/com/meesho/stages/build<Lang>.groovy with a run(Map param) method.
  2. Add a case in buildObjHelper.groovy — either a literal (case 'rust') or a regex (case ~/^rust-.*/) for versioned variants.
  3. Add resources/com/meesho/<lang>-Dockerfile, <lang>-values.yaml, <lang>-deployment.yaml.
  4. There is no unit test to add — push the branch and validate via @Library('devops-lib@<branch>') in a sandbox service Jenkinsfile.

See also: 04-deploy-flow, 05-cross-cutting, docs/architecture.md.