mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Jenkinsfile-GitLab-Container: declare local vars in slave job triggers
Declare `localStatus` and `localResult` as local variables in `triggerSlaveJob` and `triggerCN5GSlaveJob` functions by adding `def`. This prevents unintended use of global variables in pipeline and avoids potential variable leakage or conflicts between stages. Follows the Jenkins recommendation: Did you forget the `def` keyword? WorkflowScript seems to be setting a field named localStatus (to a value of type RunWrapper) which could lead to memory leaks or other issues. Did you forget the `def` keyword? WorkflowScript seems to be setting a field named localResult (to a value of type String) which could lead to memory leaks or other issues.
This commit is contained in:
@@ -864,7 +864,7 @@ def triggerSlaveJob (jobName, gitlabStatusName) {
|
||||
// The slave job is triggered with the propagate false so the following commands are executed
|
||||
// Its status is now PASS/SUCCESS from a stage pipeline point of view
|
||||
// localStatus variable MUST be analyzed to properly assess the status
|
||||
localStatus = build job: jobName,
|
||||
def localStatus = build job: jobName,
|
||||
parameters: [
|
||||
string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
|
||||
string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
|
||||
@@ -873,7 +873,7 @@ def triggerSlaveJob (jobName, gitlabStatusName) {
|
||||
booleanParam(name: 'eNB_mergeRequest', value: "MERGE".equals(env.gitlabActionType)),
|
||||
string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch))
|
||||
], propagate: false
|
||||
localResult = localStatus.getResult()
|
||||
def localResult = localStatus.getResult()
|
||||
echo "${jobName} Slave Job status is ${localResult}"
|
||||
gitlabCommitStatus(name: gitlabStatusName) {
|
||||
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
|
||||
@@ -899,11 +899,11 @@ def triggerCN5GSlaveJob (jobName, gitlabStatusName) {
|
||||
// The slave job is triggered with the propagate false so the following commands are executed
|
||||
// Its status is now PASS/SUCCESS from a stage pipeline point of view
|
||||
// localStatus variable MUST be analyzed to properly assess the status
|
||||
localStatus = build job: jobName,
|
||||
def localStatus = build job: jobName,
|
||||
parameters: [
|
||||
string(name: 'FULL_RAN_TAG', value: String.valueOf(fullRanTag))
|
||||
], propagate: false
|
||||
localResult = localStatus.getResult()
|
||||
def localResult = localStatus.getResult()
|
||||
echo "${jobName} Slave Job status is ${localResult}"
|
||||
gitlabCommitStatus(name: gitlabStatusName) {
|
||||
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
|
||||
|
||||
Reference in New Issue
Block a user