2.0 KiB
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-codednode('slave02')invars/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:16readsparam.agent_labeland falls back to'slave02'when unset:def agentLabel = param.agent_label ?: 'slave02' node(agentLabel) { ... }README.md## Optional parametersection documentsagent_labelwith the same shape as the other params (key, type, default, description). Default must be the legacyslave02for backwards compatibility- A consumer Jenkinsfile that passes
agent_label: 'gke-build-agent'runs on that node; one that omits it still runs onslave02 grep -rn "node\('slave02'\)" vars/ src/shows zero hard-coded uses other than the fallback string inbuildPipeline.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 DOentry toCLAUDE.md: "Don't add newnode('<literal>')blocks invars/. New entry points must acceptagent_labelfrom the param map and fall back to'slave02'or a documented default."
Notes / known gotchas
eksCICD.groovyandgkeCICD.groovyusepodTemplate(yaml: libraryResource("org/meesho/${env.INFRA_ENV}-pod.yaml"))instead of anode()block — they're outside the scope of this task. OnlybuildPipeline.groovy(and any othernode('<literal>')callers grep finds) needs the change.- Don't change the default to
nullor empty — services in the org currently rely on the implicitslave02pin; flipping the default mid-flight will silently move builds to whichever agent the master picks.