f44ba20d1c554b92cc5e20683abc8e8ccb1b89f7
Jenkins v2.516.1 with Pipeline Groovy plugin v4045+ displays memory leak warnings when variables are declared without the 'def' keyword. These warnings appear because the CPS transformer interprets unscoped variables as implicit script-level fields. This change eliminates all CPS warnings by applying proper Groovy syntax for variable declarations and Map operations. pipelines/monolithic.Jenkinsfile - MODIFIED Lines 11-19: Pipeline-level variables - Added @groovy.transform.Field annotation to PROPS, IMG_PARAMS, IMAGES_FAILED - These variables persist across pipeline stages and require explicit field declaration - Reference: https://www.jenkins.io/doc/book/pipeline/shared-libraries/ Lines 22-24: parseProps() function - Empty Map declaration - Changed 'def x = {}' to 'def x = [:]' - Using {} creates a Closure, not a Map - Reference: https://groovy-lang.org/groovy-dev-kit.html Lines 29-32: parseProps() function - Loop variables - Added 'def' keyword to parts, key, value variables - Prevents implicit field creation for loop-scoped variables Lines 39-58: loadEnv() function - Map declaration and property access - Changed 'def data = {}' to 'def data = [:]' for proper Map instantiation - Changed dot notation (data.KEY) to bracket notation (data['KEY']) - Bracket notation avoids false positive CPS warnings. It explicitly calls Map.putAt() method instead of ambiguous property access - Reference: https://www.jenkins.io/doc/book/pipeline/cps-method-mismatches/ Lines 72, 100-106, 281, 376: PROPS property reads - Changed PROPS.KEY to PROPS['KEY'] for consistency with bracket notation TEST PLAN Scenario 1 - Jenkins v2.492.1 backward compatibility: PASS: Pipeline executed without errors PASS: No sandbox permission issues PASS: All stages completed successfully Scenario 2 - Jenkins v2.516.1 warning elimination: PASS: Without fix - 17 CPS warnings displayed PASS: With fix - 0 CPS warnings displayed PASS: Pipeline executed without errors PASS: All stages completed successfully Closes-Bug: 2134568 Change-Id: Ic963c15cb0fe5cde96654e8d4542534cbcf07c30 Signed-off-by: Ladislau <Ladislau.Felisbino@windriver.com>
Description
Jenkins scripts for building StarlingX
Languages
Shell
77%
Python
22.1%
Groovy
0.8%