Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openairinterface-6g
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
openairinterface-6g
Commits
95e9f4a4
Commit
95e9f4a4
authored
Nov 05, 2025
by
Jaroslava Fiedlerova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a single Jenkinsfile
Combine Jenkinsfile and Jenkinsfile-oc from parrent commit into a single file.
parent
b8e249fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
221 deletions
+60
-221
ci-scripts/Jenkinsfile
ci-scripts/Jenkinsfile
+60
-22
ci-scripts/Jenkinsfile-oc
ci-scripts/Jenkinsfile-oc
+0
-199
No files found.
ci-scripts/Jenkinsfile
View file @
95e9f4a4
...
@@ -36,6 +36,7 @@ if (params.LockResources != null && params.LockResources.trim().length() > 0)
...
@@ -36,6 +36,7 @@ if (params.LockResources != null && params.LockResources.trim().length() > 0)
// Global Parameters. Normally they should be populated when the master job
// Global Parameters. Normally they should be populated when the master job
// triggers the slave job with parameters
// triggers the slave job with parameters
def
sourceRepository
=
params
.
eNB_Repository
?:
env
.
GIT_URL
def
sourceRepository
=
params
.
eNB_Repository
?:
env
.
GIT_URL
def
sourceBranch
=
params
.
eNB_Branch
?:
env
.
GIT_BRANCH
def
sourceBranch
=
params
.
eNB_Branch
?:
env
.
GIT_BRANCH
def
targetRepository
=
params
.
Target_Repository
?:
sourceRepository
def
targetRepository
=
params
.
Target_Repository
?:
sourceRepository
...
@@ -44,6 +45,7 @@ def commitID = params.eNB_CommitID ?: env.GIT_COMMIT
...
@@ -44,6 +45,7 @@ def commitID = params.eNB_CommitID ?: env.GIT_COMMIT
def
is_MR
=
params
.
eNB_mergeRequest
?:
false
def
is_MR
=
params
.
eNB_mergeRequest
?:
false
def
flexricOption
=
""
def
flexricOption
=
""
def
runWithOC
=
false
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
// Pipeline start
// Pipeline start
...
@@ -83,7 +85,14 @@ pipeline {
...
@@ -83,7 +85,14 @@ pipeline {
echo
"no eNB_SourceCodePath given"
echo
"no eNB_SourceCodePath given"
allParametersPresent
=
false
allParametersPresent
=
false
}
}
if
(
params
.
OC_Credentials
!=
null
)
{
echo
"This pipeline is configured to run with Opensift Cluster."
runWithOC
=
true
if
(
params
.
OC_ProjectName
==
null
)
{
echo
"no OC_ProjectName given"
allParametersPresent
=
false
}
}
if
(
params
.
Flexric_Tag
!=
null
)
{
if
(
params
.
Flexric_Tag
!=
null
)
{
echo
"This pipeline is configured to run with a FlexRIC deployment."
echo
"This pipeline is configured to run with a FlexRIC deployment."
echo
"Appending FlexRicTag option to the list of options"
echo
"Appending FlexRicTag option to the list of options"
...
@@ -114,7 +123,6 @@ pipeline {
...
@@ -114,7 +123,6 @@ pipeline {
}
}
}
}
}
}
stage
(
"Deploy and Test"
)
{
stage
(
"Deploy and Test"
)
{
steps
{
steps
{
script
{
script
{
...
@@ -130,30 +138,60 @@ pipeline {
...
@@ -130,30 +138,60 @@ pipeline {
}
}
}
}
sh
"""
sh
"""
python3 main.py --mode=InitiateHtml --ranRepository=${targetRepository} \
python3 main.py --mode=InitiateHtml --ranRepository=${targetRepository} \
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
${flexricOption} ${mainPythonAllXmlFiles}
${flexricOption} ${mainPythonAllXmlFiles}
"""
"""
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
runWithOC
)
{
if
(
fileExists
(
xmlFile
))
{
withCredentials
([
usernamePassword
(
credentialsId:
"${params.OC_Credentials}"
,
usernameVariable:
'OC_Username'
,
passwordVariable:
'OC_Password'
)])
{
try
{
sh
"""
timeout
(
time:
60
,
unit:
'MINUTES'
)
{
python3 main.py --mode=InitiateHtml --ranRepository=${targetRepository} \
sh
"""
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
python3 main.py --mode=TesteNB --ranRepository=${targetRepository} \
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
${flexricOption} ${mainPythonAllXmlFiles}
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
"""
--eNBSourceCodePath=${params.eNB_SourceCodePath} --XMLTestFile=${xmlFile} \
for
(
xmlFile
in
myXmlTestSuite
)
{
${flexricOption}
if
(
fileExists
(
xmlFile
))
{
"""
try
{
timeout
(
time:
60
,
unit:
'MINUTES'
)
{
sh
"""
python3 main.py --mode=TesteNB --ranRepository=${targetRepository} \
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
--eNBSourceCodePath=${params.eNB_SourceCodePath} --XMLTestFile=${xmlFile} \
--OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} \
${flexricOption}
"""
}
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
}
}
}
else
{
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
try
{
timeout
(
time:
60
,
unit:
'MINUTES'
)
{
sh
"""
python3 main.py --mode=TesteNB --ranRepository=${targetRepository} \
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
--eNBSourceCodePath=${params.eNB_SourceCodePath} --XMLTestFile=${xmlFile} \
${flexricOption}
"""
}
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
}
}
}
}
sh
"python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus}"
sh
"python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus}"
}
}
}
}
}
}
...
@@ -176,7 +214,7 @@ pipeline {
...
@@ -176,7 +214,7 @@ pipeline {
archiveArtifacts
artifacts:
"test_logs_${env.BUILD_ID}.zip"
archiveArtifacts
artifacts:
"test_logs_${env.BUILD_ID}.zip"
}
}
if
(
fileExists
(
"test_results.html"
))
{
if
(
fileExists
(
"test_results.html"
))
{
def
reportName
=
"test_results
_
${env.JOB_NAME}.html"
def
reportName
=
"test_results
-
${env.JOB_NAME}.html"
sh
"mv test_results.html ${reportName}"
sh
"mv test_results.html ${reportName}"
sh
"""
sh
"""
sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' \
sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' \
...
...
ci-scripts/Jenkinsfile-oc
deleted
100644 → 0
View file @
b8e249fc
#
!
/bin/
groovy
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
def
pythonExecutor
=
params
.
pythonExecutor
def
testXMLFile
=
params
.
pythonTestXmlFile
def
mainPythonAllXmlFiles
=
""
def
buildStageStatus
=
true
def
JOB_TIMESTAMP
// Choose test stage name or fallback default
def
testStageName
=
params
.
pipelineTestStageName
!=
null
?
params
.
pipelineTestStageName
:
'Template Test Stage'
// Name of the resource
def
lockResources
=
[]
if
(
params
.
LockResources
!=
null
&&
params
.
LockResources
.
trim
().
length
()
>
0
)
params
.
LockResources
.
trim
().
split
(
","
).
each
{
lockResources
+=
[
resource:
it
.
trim
()]}
// Global Parameters. Normally they should be populated when the master job
// triggers the slave job with parameters
def
sourceRepository
=
params
.
eNB_Repository
?:
env
.
GIT_URL
def
sourceBranch
=
params
.
eNB_Branch
?:
env
.
GIT_BRANCH
def
targetRepository
=
params
.
Target_Repository
?:
sourceRepository
def
targetBranch
=
params
.
eNB_TargetBranch
?:
'develop'
def
commitID
=
params
.
eNB_CommitID
?:
env
.
GIT_COMMIT
def
is_MR
=
params
.
eNB_mergeRequest
?:
false
//-------------------------------------------------------------------------------
// Pipeline start
pipeline
{
agent
{
label
pythonExecutor
}
options
{
timestamps
()
ansiColor
(
'xterm'
)
lock
(
extra:
lockResources
)
}
stages
{
stage
(
"Build Init"
)
{
steps
{
script
{
echo
'\u2705 \u001B[94mBuild Init\u001B[0m'
JOB_TIMESTAMP
=
sh
(
returnStdout:
true
,
script:
'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"'
).
trim
()
}
// update the build name and description
buildName
"${params.eNB_MR}"
buildDescription
"Branch : ${sourceBranch}"
}
}
stage
(
'Verify Parameters'
)
{
steps
{
script
{
echo
'\u2705 \u001B[94mVerify Parameters\u001B[0m'
def
allParametersPresent
=
true
if
(
params
.
LockResources
==
null
)
{
echo
"no LockResources given"
allParametersPresent
=
false
}
if
(
params
.
eNB_SourceCodePath
==
null
)
{
echo
"no eNB_SourceCodePath given"
allParametersPresent
=
false
}
if
(
params
.
OC_Credentials
==
null
)
{
echo
"no OC_Credentials given"
allParametersPresent
=
false
}
if
(
params
.
OC_ProjectName
==
null
)
{
echo
"no OC_ProjectName given"
allParametersPresent
=
false
}
echo
"CI executor node : ${pythonExecutor}"
echo
"Source Repository : ${sourceRepository}"
echo
"Source Branch : ${sourceBranch}"
echo
"Target Repository : ${targetRepository}"
echo
"Target Branch : ${targetBranch}"
echo
"Commit ID : ${commitID}"
if
(
allParametersPresent
)
{
echo
'\u2705 \u001B[94m All parameters are present\u001B[0m'
if
(
is_MR
)
{
sh
"git fetch"
sh
"./ci-scripts/doGitLabMerge.sh --src-branch ${sourceBranch} --src-commit ${commitID} --target-branch ${targetBranch} --target-commit latest"
}
else
{
sh
"git fetch"
sh
"git checkout -f ${commitID}"
}
}
else
{
echo
"\u274C Some parameters are missing"
sh
"./ci-scripts/fail.sh"
}
}
}
}
stage
(
"Deploy and Test"
)
{
steps
{
script
{
dir
(
'ci-scripts'
)
{
echo
"\u2705 \u001B[94m Deploy and Test: ${testStageName}\u001B[0m"
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
xmlFile
+
" "
echo
"Test XML file : ${xmlFile}"
}
else
{
echo
"Test XML file ${xmlFile}: no such file"
}
}
withCredentials
([
usernamePassword
(
credentialsId:
"${params.OC_Credentials}"
,
usernameVariable:
'OC_Username'
,
passwordVariable:
'OC_Password'
)
])
{
sh
"""
python3 main.py --mode=InitiateHtml --ranRepository=${targetRepository} \
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
${mainPythonAllXmlFiles}
"""
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
try
{
timeout
(
time:
60
,
unit:
'MINUTES'
)
{
sh
"""
python3 main.py --mode=TesteNB --ranRepository=${targetRepository} \
--ranBranch=${sourceBranch} --ranCommitID=${commitID} \
--ranAllowMerge=${is_MR} --ranTargetBranch=${targetBranch} \
--eNBSourceCodePath=${params.eNB_SourceCodePath} --XMLTestFile=${xmlFile} \
--OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}
"""
}
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
}
sh
"python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus}"
}
}
}
}
}
stage
(
"Log Collection"
)
{
steps
{
script
{
echo
'\u2705 \u001B[94mLog Collection\u001B[0m'
dir
(
'ci-scripts'
)
{
// Zipping all archived log files
sh
"mkdir test_logs"
sh
"mv *.log* test_logs || true"
// Zip all log files matching cmake_targets/{*.log*,log/*} into test_logs_XXXX.zip
if
(
fileExists
(
'../cmake_targets/log'
))
{
sh
"mv ../cmake_targets/log/* test_logs || true"
}
sh
"zip -r -qq test_logs_${env.BUILD_ID}.zip *test_log*/"
sh
"rm -rf *test_log*/"
if
(
fileExists
(
"test_logs_${env.BUILD_ID}.zip"
))
{
archiveArtifacts
artifacts:
"test_logs_${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"test_results.html"
))
{
def
reportName
=
"test_results_${env.JOB_NAME}.html"
sh
"mv test_results.html ${reportName}"
sh
"""
sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' \
-e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' \
-e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' \
-e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' \
-e 's#TEMPLATE_STAGE_NAME#${testStageName}#' ${reportName}
"""
archiveArtifacts
artifacts:
"${reportName}"
}
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment