Files
devops-lib-gcp/docs/wiki/pages/07-LANGUAGE-BUILDS.md
T
2026-08-26 02:02:24 +05:30

5.0 KiB

Generated 2026-05-12 at base-sha 28f54cf7bef9. Type: top-level. 0 sources.

Language Builds

Each language builder in src/com/meesho/stages/ implements a run(Map config) method. They share a common structure: read config → config-only check → compile/test → Sonar → Docker build → push → deploy.

TL;DR

  • Maven (buildMaven): Java services using pom.xml. Handles multi-module layouts. Skips tests/sonar on hotfix. Pushes JAR to JFrog optionally.
  • Go (buildGo): Uses Athens proxy (env.goProxyUrl) for module caching. Sonar skipped if whitelisted or toolchain env.
  • Node (buildNode): Multiple variants (node-18, node-20, etc.). Toolchain-aware image path includes TOOLCHAIN_ENV segment.
  • Python (buildPython): python-3.10, python-3.12, etc. — version in dockerBuildVersion, not separate files.
  • Gradle (buildGradle): Android/Kotlin server builds.
  • PHP (buildPhp): PHP services, uses php-values.yaml Helm template.
  • Rust (buildRust): Rust services.
  • Docker (buildDocker): Docker-only builds — no compiler, just image assembly.

Mental model

Every builder reads config.build_tool (via buildObjHelper dispatch) and config.dockerBuildVersion. The dockerBuildVersion controls which Dockerfile template is selected from resources/com/meesho/ — the template name roughly mirrors the version string (e.g., maven-21, go-1.22, node-20).

Config-only change detection is embedded in each builder. If git diff HEAD~1 -- configs/ shows only YAML changes, the builder skips compilation and fetches the last image tag from GAR instead.

Structure / data flow

buildMaven.run(config):
  env.TAG = "v${pom-version}"   or   hotfix → "v${version}-HOT"
  ├─ [config-only] check s3/GAR for existing artifact
  ├─ stage: Test        → mvn test -P${java_version}
  ├─ stage: Sonar       → mvn sonar:sonar (skip if skipSonarCheckForbidden)
  ├─ stage: Docker Build → constructTemplate.renderTemplate(binding, 'maven-Dockerfile')
  ├─ stage: Docker Push  → dockerUtilities.buildAndPush(...)
  └─ deployArgoCD.run(...) or deployJar.run(...)

buildGo.buildDckr(config):
  env.TAG = getDockerParams.getTag(repo_name)
  ├─ [config-only] skip build if only configs/ changed
  ├─ stage: Build/Test  → go build, go test (with Athens proxy)
  ├─ stage: Sonar       → sonar-scanner (skip if skipSonarCheckForGo)
  ├─ stage: Docker Build → constructTemplate.renderTemplate(binding, 'go-Dockerfile')
  └─ deployArgoCD.run(...)

buildNode.buildDckr(config):
  env.TAG = getDockerParams.getTag(repo_name)
  ├─ npm install + npm run build
  ├─ stage: Sonar       → sonar-scanner (node sonar/sonar-scanner.ts)
  ├─ stage: Docker Build → constructTemplate.renderTemplate(binding, 'node-Dockerfile')
  └─ deployArgoCD.run(...)

Key code locations

Symbol File What it does
run src/com/meesho/stages/buildMaven.groovy:run Maven build lifecycle
buildDckr src/com/meesho/stages/buildGo.groovy:buildDckr Go build lifecycle
buildDckr src/com/meesho/stages/buildNode.groovy:buildDckr Node build lifecycle
buildDckr src/com/meesho/stages/buildPython.groovy:buildDckr Python build lifecycle
run src/com/meesho/stages/buildGradle.groovy:run Gradle build lifecycle
buildDckr src/com/meesho/stages/buildRust.groovy:buildDckr Rust build lifecycle
retryDockerPush src/com/meesho/utilities/dockerUtilities.groovy:retryDockerPush Docker push with retry
getTag src/com/meesho/utilities/getDockerParams.groovy:getTag Image tag: v{version}-{sha}-{epoch}

Sharp edges

  • python-3.10.12 is aliased to python-3.7 in Helm values: deployArgoCD.update_helm_repo remaps python-3.10.12python-3.7 for the dockerBuildVersion key passed to the Helm template. Other python versions pass through as-is.
  • Maven multi-module builds: getDockerParams.getModules() reads <modules> from pom.xml. If modules exist, a Docker image is built per module.
  • toolchain env Node builds include TOOLCHAIN_ENV in the image path: ${cicd_environment}/${TOOLCHAIN_ENV}/${team}/${repo}. Standard builds omit the TOOLCHAIN_ENV segment.
  • skip_s3_check=true forces a fresh build even if an artifact already exists for the same commit.

Notes


← Previous · Index · Next →