Files
devops-lib-gcp/ai-blitz/task-04-buildPipeline-agent-label-param.md
T
2026-08-26 02:02:24 +05:30

2.0 KiB

Task 04: Make Jenkins agent label configurable via agent_label parameter

  • Type: Small feature
  • Source: BUGS_AND_IMPROVEMENTS_REPORT.md §3 (hard-coded node('slave02') in vars/buildPipeline.groovy:16)

Goal

buildPipeline { ... } consumers can override the Jenkins agent node label without forking the library; existing consumers (no override) still pin to slave02 so nothing breaks.

Acceptance Criteria

  • vars/buildPipeline.groovy:16 reads param.agent_label and falls back to 'slave02' when unset:
    def agentLabel = param.agent_label ?: 'slave02'
    node(agentLabel) { ... }
    
  • README.md ## Optional parameter section documents agent_label with the same shape as the other params (key, type, default, description). Default must be the legacy slave02 for backwards compatibility
  • A consumer Jenkinsfile that passes agent_label: 'gke-build-agent' runs on that node; one that omits it still runs on slave02
  • grep -rn "node\('slave02'\)" vars/ src/ shows zero hard-coded uses other than the fallback string in buildPipeline.groovy. If other files hard-code the same node, list them out and either fix in the same PR or open follow-up tasks
  • Smoke-test: one PR pipeline with the override, one without
  • Add a ## NEVER DO entry to CLAUDE.md: "Don't add new node('<literal>') blocks in vars/. New entry points must accept agent_label from the param map and fall back to 'slave02' or a documented default."

Notes / known gotchas

  • eksCICD.groovy and gkeCICD.groovy use podTemplate(yaml: libraryResource("org/meesho/${env.INFRA_ENV}-pod.yaml")) instead of a node() block — they're outside the scope of this task. Only buildPipeline.groovy (and any other node('<literal>') callers grep finds) needs the change.
  • Don't change the default to null or empty — services in the org currently rely on the implicit slave02 pin; flipping the default mid-flight will silently move builds to whichever agent the master picks.