From df7a1704ccc02a583c4c65b1204b0f7232b7ad01 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Sun, 8 Mar 2026 20:45:15 +0100 Subject: [PATCH 1/6] Jenkinsfile-GitLab-Container: remove unused function --- ci-scripts/Jenkinsfile-GitLab-Container | 28 ------------------------- 1 file changed, 28 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index c54d0314d0..7ba01cbf00 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -914,34 +914,6 @@ def triggerCN5GSlaveJob (jobName, gitlabStatusName) { } } -def triggerSlaveJobNoGitLab (jobName) { - if ("MERGE".equals(env.gitlabActionType)) { - MR_NUMBER = env.gitlabMergeRequestIid - } else { - MR_NUMBER = 'develop' - } - // Workaround for the "cancelled" GitLab pipeline notification - // 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, - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), - string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), - string(name: 'eNB_MR', value: String.valueOf(MR_NUMBER)), - booleanParam(name: 'eNB_mergeRequest', value: "MERGE".equals(env.gitlabActionType)), - string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch)) - ], propagate: false - localResult = localStatus.getResult() - echo "${jobName} Slave Job status is ${localResult}" - if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) { - echo "${jobName} Slave Job is OK" - } else { - error "${jobName} Slave Job is KO" - } -} - def finalizeSlaveJob(jobName) { lock ('Parent-Lock') { // In case of any non-success, we are retrieving the HTML report of the last completed From 6cf2570a9f26e7ce049e096f141f62a8498d300e Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Sun, 8 Mar 2026 20:47:17 +0100 Subject: [PATCH 2/6] 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. --- ci-scripts/Jenkinsfile-GitLab-Container | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 7ba01cbf00..e60fb9cbf1 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -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')) { From 13fbc5a6437b4450849ca3fde1155419abac6f21 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 12 Mar 2026 17:25:24 +0100 Subject: [PATCH 3/6] CI: Get source repository from Gitlab plugin in Jenkins --- ci-scripts/Jenkinsfile-GitLab-Container | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index e60fb9cbf1..412073b189 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -867,6 +867,7 @@ def triggerSlaveJob (jobName, gitlabStatusName) { def localStatus = build job: jobName, parameters: [ string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'SourceRepo', value: String.valueOf(env.gitlabSourceRepoHttpUrl)), string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), string(name: 'eNB_MR', value: String.valueOf(MR_NUMBER)), From e0d9edeeee46146f5e60107e4cfb05e2821a3977 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Mon, 23 Mar 2026 23:52:26 +0100 Subject: [PATCH 4/6] Add Jenkinsfile for RAN-Local-Repo-Push --- ci-scripts/Jenkinsfile-push-local-repo | 103 +++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 ci-scripts/Jenkinsfile-push-local-repo diff --git a/ci-scripts/Jenkinsfile-push-local-repo b/ci-scripts/Jenkinsfile-push-local-repo new file mode 100644 index 0000000000..6a5ffd7e43 --- /dev/null +++ b/ci-scripts/Jenkinsfile-push-local-repo @@ -0,0 +1,103 @@ +#!/bin/groovy +/* + * SPDX-License-Identifier: LicenseRef-CSSL-1.0 + */ + +// Location of the python executor node shall be in the same subnet as the others servers +def nodeExecutor = params.nodeExecutor + +// SSH URL of the internal git repository +def internalRepoURL = params.internalRepoURL + +// Name of the resource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} + +pipeline { + agent { + label nodeExecutor + } + options { + ansiColor('xterm') + lock(extra: lockResources) + } + stages { + stage('Verify parameters') { + steps { + script { + def missingParams = [] + if (!params.SourceRepo?.trim()) { missingParams << 'SourceRepo' } + if (!params.eNB_Branch?.trim()) { missingParams << 'eNB_Branch' } + if (!params.eNB_CommitID?.trim()) { missingParams << 'eNB_CommitID' } + if (!params.eNB_TargetBranch?.trim()) { missingParams << 'eNB_TargetBranch' } + if (!params.eNB_Repository?.trim()) { missingParams << 'eNB_Repository' } + + if (missingParams) { + error "Missing required parameters: ${missingParams.join(', ')}" + } + + echo "Source Repo : ${params.SourceRepo}" + echo "Source Branch : ${params.eNB_Branch}" + echo "Source Commit : ${params.eNB_CommitID}" + echo "Target Branch : ${params.eNB_TargetBranch}" + echo "Target Repo : ${params.eNB_Repository}" + } + } + } + stage('Prepare workspace') { + steps { + sh """ + git config user.email "jenkins@openairinterface.org" + git config user.name "OAI Jenkins" + git remote remove source || true + git remote remove internal-repo || true + """ + } + } + stage('Add source repo & fetch branches') { + steps { + sh """ + git remote add source ${params.SourceRepo} || true + git fetch source ${params.eNB_Branch} + git fetch origin ${params.eNB_TargetBranch} + """ + } + } + stage('Create temporary branch for CI') { + steps { + script { + def shortCommit = params.eNB_CommitID.take(8) + env.NEW_BRANCH = "${params.eNB_Branch}-${shortCommit}" + echo "New branch: ${env.NEW_BRANCH}" + } + sh """ + # Checkout source commit + git checkout -B ${env.NEW_BRANCH} ${params.eNB_CommitID} + """ + } + } + stage('Merge target into source') { + steps { + sh """ + echo "Merging target branch ${params.eNB_TargetBranch} into source branch ${env.NEW_BRANCH}" + if ! git merge --ff origin/${params.eNB_TargetBranch} \ + -m "Merge ${params.eNB_TargetBranch} into ${params.eNB_Branch} for CI"; then + echo "Merge conflicts detected. Aborting." + git merge --abort || true + exit 1 + fi + """ + } + } + stage('Push merged branch to internal repository') { + steps { + sh """ + git remote add internal-repo ${internalRepoURL} || true + echo "Pushing ${env.NEW_BRANCH} to internal repo" + git push --force internal-repo ${env.NEW_BRANCH} + """ + } + } + } +} From febbadf83af0a47b602288129f6686799d162367 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Fri, 27 Mar 2026 10:18:13 +0100 Subject: [PATCH 5/6] CI: Add stage to push to local git repository --- ci-scripts/Jenkinsfile-GitLab-Container | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 412073b189..cff11aaece 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -112,6 +112,23 @@ pipeline { } } } + stage ("Local-Repo-Push") { + steps { + script { + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + triggerSlaveJob ('RAN-Local-Repo-Push', 'Local-Repo-Push') + } + } + } + post { + failure { + script { + echo "Push to local repository KO" + failingStages += '\n * RAN-Local-Repo-Push' + } + } + } + } // Build Stages are Mandatory stage ("Image Building Processes") { when { expression {doBuild} } From 3f3c0b5ed24ff923339e3917e67dd9ad5e733f61 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 1 Apr 2026 16:06:14 +0200 Subject: [PATCH 6/6] Jenkinsfile-GitLab-Container: declare pipeline variables Did you forget the `def` keyword? WorkflowScript seems to be setting a field named JOB_TIMESTAMP (to a value of type String) which could lead to memory leaks or other issues. Did you forget the `def` keyword? WorkflowScript seems to be setting a field named MR_NUMBER (to a value of type String) which could lead to memory leaks or other issues. --- ci-scripts/Jenkinsfile-GitLab-Container | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index cff11aaece..d75b1888d4 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -34,9 +34,7 @@ pipeline { stage ("Verify Parameters") { steps { script { - JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"' - JOB_TIMESTAMP = JOB_TIMESTAMP.trim() - + env.JOB_TIMESTAMP = sh(returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"').trim() echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' def allParametersPresent = true @@ -872,11 +870,7 @@ pipeline { // ---- Slave Job functions def triggerSlaveJob (jobName, gitlabStatusName) { - if ("MERGE".equals(env.gitlabActionType)) { - MR_NUMBER = env.gitlabMergeRequestIid - } else { - MR_NUMBER = 'develop' - } + def MR_NUMBER = "MERGE".equals(env.gitlabActionType) ? env.gitlabMergeRequestIid : 'develop' // Workaround for the "cancelled" GitLab pipeline notification // 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 @@ -947,7 +941,7 @@ def finalizeSlaveJob(jobName) { filter: 'test_results*.html', selector: lastCompleted()) if (fileExists(fileName)) { - sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}" + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${env.JOB_TIMESTAMP}#' ${fileName}" } else { sh "echo \"could not copy results from ${jobName}, please check pipeline ${BUILD_URL}\" > ${fileName}" }