Commit f7618a97 authored by Robert Schmidt's avatar Robert Schmidt

Introduce documentation step in RAN-Container-Parent, separate 4G and 5G

parent ffe2202f
...@@ -24,8 +24,9 @@ ...@@ -24,8 +24,9 @@
def nodeExecutor = params.nodeExecutor def nodeExecutor = params.nodeExecutor
// Tags to shorten pipeline duration // Tags to shorten pipeline duration
def doMandatoryTests = false def doBuild = true
def doFullTestsuite = false def do4Gtest = false
def do5Gtest = false
// //
def gitCommitAuthorEmailAddr def gitCommitAuthorEmailAddr
...@@ -56,26 +57,30 @@ pipeline { ...@@ -56,26 +57,30 @@ pipeline {
LABEL_CHECK = sh returnStdout: true, script: 'ci-scripts/checkGitLabMergeRequestLabels.sh --mr-id ' + env.gitlabMergeRequestIid LABEL_CHECK = sh returnStdout: true, script: 'ci-scripts/checkGitLabMergeRequestLabels.sh --mr-id ' + env.gitlabMergeRequestIid
LABEL_CHECK = LABEL_CHECK.trim() LABEL_CHECK = LABEL_CHECK.trim()
if (LABEL_CHECK == 'NONE') { if (LABEL_CHECK == 'NONE') {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Your merge request has none of the mandatory labels:\n\n" def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Your merge request should have one of the mandatory labels:\n\n"
message += " - BUILD-ONLY\n" message += " - ~documentation (don't perform any stages)\n"
message += " - 4G-LTE\n" message += " - ~BUILD-ONLY (execute only build stages)\n"
message += " - 5G-NR\n" message += " - ~4G-LTE (perform 4G tests)\n"
message += " - CI\n\n" message += " - ~5G-NR (perform 5G tests)\n"
message += " - ~CI (perform both 4G and 5G tests)\n\n"
message += "Not performing CI due to lack of labels" message += "Not performing CI due to lack of labels"
addGitLabMRComment comment: message addGitLabMRComment comment: message
error('Not performing CI due to lack of labels') error('Not performing CI due to lack of labels')
} else if (LABEL_CHECK == 'FULL') { } else if (LABEL_CHECK == 'FULL') {
doMandatoryTests = true do4Gtest = true
doFullTestsuite = true do5Gtest = true
} else if (LABEL_CHECK == "SHORTEN-4G") {
do4Gtest = true
} else if (LABEL_CHECK == 'SHORTEN-5G') { } else if (LABEL_CHECK == 'SHORTEN-5G') {
doMandatoryTests = true do5Gtest = true
} else if (LABEL_CHECK == 'documentation') {
doBuild = false
} else { } else {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): We will perform only build stages on your Merge Request" // is "BUILD-ONLY", will only build
addGitLabMRComment comment: message
} }
} else { } else {
doMandatoryTests = true do4Gtest = true
doFullTestsuite = true do5Gtest = true
} }
} }
} }
...@@ -116,6 +121,7 @@ pipeline { ...@@ -116,6 +121,7 @@ pipeline {
// Build Stages are Mandatory // Build Stages are Mandatory
// Later we will add a Ubuntu20 build // Later we will add a Ubuntu20 build
stage ("Image Building Processes") { stage ("Image Building Processes") {
when { expression {doBuild} }
parallel { parallel {
stage ("Ubuntu18-Image-Builder") { stage ("Ubuntu18-Image-Builder") {
steps { steps {
...@@ -177,9 +183,10 @@ pipeline { ...@@ -177,9 +183,10 @@ pipeline {
} }
} }
stage ("Image Test Processes") { stage ("Image Test Processes") {
when { expression {doBuild} }
parallel { parallel {
stage ("PhySim-Cluster") { stage ("PhySim-Cluster") {
when { expression {doMandatoryTests} } when { expression {do4Gtest || do5Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-PhySim-Cluster', 'PhySim-Cluster') triggerSlaveJob ('RAN-PhySim-Cluster', 'PhySim-Cluster')
...@@ -199,7 +206,7 @@ pipeline { ...@@ -199,7 +206,7 @@ pipeline {
} }
} }
stage ("RF-Sim-Test-4G") { stage ("RF-Sim-Test-4G") {
when { expression {doMandatoryTests} } when { expression {do4Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-RF-Sim-Test-4G', 'RF-Sim-Test-4G') triggerSlaveJob ('RAN-RF-Sim-Test-4G', 'RF-Sim-Test-4G')
...@@ -219,7 +226,7 @@ pipeline { ...@@ -219,7 +226,7 @@ pipeline {
} }
} }
stage ("RF-Sim-Test-5G") { stage ("RF-Sim-Test-5G") {
when { expression {doMandatoryTests} } when { expression {do5Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-RF-Sim-Test-5G', 'RF-Sim-Test-5G') triggerSlaveJob ('RAN-RF-Sim-Test-5G', 'RF-Sim-Test-5G')
...@@ -239,7 +246,7 @@ pipeline { ...@@ -239,7 +246,7 @@ pipeline {
} }
} }
stage ("L2-Sim-Test-4G") { stage ("L2-Sim-Test-4G") {
when { expression {doMandatoryTests} } when { expression {do4Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-L2-Sim-Test-4G', 'L2-Sim-Test-4G') triggerSlaveJob ('RAN-L2-Sim-Test-4G', 'L2-Sim-Test-4G')
...@@ -259,7 +266,7 @@ pipeline { ...@@ -259,7 +266,7 @@ pipeline {
} }
} }
stage ("L2-Sim-Test-5G") { stage ("L2-Sim-Test-5G") {
when { expression {doMandatoryTests} } when { expression {do5Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-L2-Sim-Test-5G', 'L2-Sim-Test-5G') triggerSlaveJob ('RAN-L2-Sim-Test-5G', 'L2-Sim-Test-5G')
...@@ -279,7 +286,7 @@ pipeline { ...@@ -279,7 +286,7 @@ pipeline {
} }
} }
stage ("NSA-B200-Module-LTEBOX-Container") { stage ("NSA-B200-Module-LTEBOX-Container") {
when { expression {doMandatoryTests} } when { expression {do4Gtest || do5Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-NSA-B200-Module-LTEBOX-Container', 'NSA-B200-Module-LTEBOX-Container') triggerSlaveJob ('RAN-NSA-B200-Module-LTEBOX-Container', 'NSA-B200-Module-LTEBOX-Container')
...@@ -299,7 +306,7 @@ pipeline { ...@@ -299,7 +306,7 @@ pipeline {
} }
} }
stage ("NSA-B200-Module-SABOX-Container") { stage ("NSA-B200-Module-SABOX-Container") {
when { expression {doMandatoryTests} } when { expression {do5Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-SA-B200-Module-SABOX-Container', 'NSA-B200-Module-SABOX-Container') triggerSlaveJob ('RAN-SA-B200-Module-SABOX-Container', 'NSA-B200-Module-SABOX-Container')
...@@ -319,7 +326,7 @@ pipeline { ...@@ -319,7 +326,7 @@ pipeline {
} }
} }
stage ("gNB-N300-Timing-Phytest-LDPC") { stage ("gNB-N300-Timing-Phytest-LDPC") {
when { expression {doMandatoryTests} } when { expression {do5Gtest} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-gNB-N300-Timing-Phytest-LDPC', 'gNB-N300-Timing-Phytest-LDPC') triggerSlaveJob ('RAN-gNB-N300-Timing-Phytest-LDPC', 'gNB-N300-Timing-Phytest-LDPC')
...@@ -340,7 +347,7 @@ pipeline { ...@@ -340,7 +347,7 @@ pipeline {
} }
//avra is offline, re-enable once it is available //avra is offline, re-enable once it is available
//stage ("T1-Offload-Test") { //stage ("T1-Offload-Test") {
// when { expression {doMandatoryTests} } // when { expression {do5Gtest} }
// steps { // steps {
// script { // script {
// triggerSlaveJob ('RAN-T1-Offload-Test', 'T1-Offload-Test') // triggerSlaveJob ('RAN-T1-Offload-Test', 'T1-Offload-Test')
...@@ -362,7 +369,7 @@ pipeline { ...@@ -362,7 +369,7 @@ pipeline {
} }
} }
stage ("DockerHub-Push") { stage ("DockerHub-Push") {
when { expression {"PUSH".equals(env.gitlabActionType)} } when { expression {doBuild && "PUSH".equals(env.gitlabActionType)} }
steps { steps {
script { script {
triggerSlaveJob ('RAN-DockerHub-Push', 'DockerHub-Push') triggerSlaveJob ('RAN-DockerHub-Push', 'DockerHub-Push')
...@@ -401,7 +408,6 @@ pipeline { ...@@ -401,7 +408,6 @@ pipeline {
script { script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")" def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")"
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
echo "This is a MERGE event"
addGitLabMRComment comment: message addGitLabMRComment comment: message
} }
echo "Pipeline is SUCCESSFUL" echo "Pipeline is SUCCESSFUL"
...@@ -411,7 +417,6 @@ pipeline { ...@@ -411,7 +417,6 @@ pipeline {
script { script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")" def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")"
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
echo "This is a MERGE event"
addGitLabMRComment comment: message addGitLabMRComment comment: message
} }
echo "Pipeline FAILED" echo "Pipeline FAILED"
......
...@@ -82,7 +82,7 @@ pipeline { ...@@ -82,7 +82,7 @@ pipeline {
message += "Not performing CI due to lack of labels" message += "Not performing CI due to lack of labels"
addGitLabMRComment comment: message addGitLabMRComment comment: message
error('Not performing CI due to lack of labels') error('Not performing CI due to lack of labels')
} else if (LABEL_CHECK == 'FULL') { } else if (LABEL_CHECK == 'FULL' || LABEL_CHECK == 'SHORTEN-4G') {
doMandatoryTests = true doMandatoryTests = true
doFullTestsuite = true doFullTestsuite = true
} else if (LABEL_CHECK == 'SHORTEN-5G') { } else if (LABEL_CHECK == 'SHORTEN-5G') {
......
...@@ -73,36 +73,50 @@ done ...@@ -73,36 +73,50 @@ done
LABELS=`curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/$MERGE_REQUEST_ID" | jq '.labels' || true` LABELS=`curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/$MERGE_REQUEST_ID" | jq '.labels' || true`
IS_MR_BUILD_ONLY=`echo $LABELS | grep -c BUILD-ONLY || true` IS_MR_DOCUMENTATION=`echo $LABELS | grep -c Documentation`
IS_MR_CI=`echo $LABELS | grep -c CI || true` IS_MR_BUILD_ONLY=`echo $LABELS | grep -c BUILD-ONLY`
IS_MR_4G=`echo $LABELS | grep -c 4G-LTE || true` IS_MR_CI=`echo $LABELS | grep -c CI`
IS_MR_5G=`echo $LABELS | grep -c 5G-NR || true` IS_MR_4G=`echo $LABELS | grep -c 4G-LTE`
IS_MR_5G=`echo $LABELS | grep -c 5G-NR`
# First case: none is present! No CI # none is present! No CI
if [ $IS_MR_BUILD_ONLY -eq 0 ] && [ $IS_MR_CI -eq 0 ] && [ $IS_MR_4G -eq 0 ] && [ $IS_MR_5G -eq 0 ] if [ $IS_MR_BUILD_ONLY -eq 0 ] && [ $IS_MR_CI -eq 0 ] && [ $IS_MR_4G -eq 0 ] && [ $IS_MR_5G -eq 0 ] && [ $IS_MR_DOCUMENTATION -eq 0 ]
then then
echo "NONE" echo "NONE"
exit 0 exit 0
fi fi
# Second case: Build-Only # 4G and 5G or CI labels: run everything (4G, 5G)
if [ $IS_MR_BUILD_ONLY -eq 1 ] if [ $IS_MR_4G -eq 1 ] && [ $IS_MR_5G -eq 1 ] || [ $IS_MR_CI -eq 1 ]
then then
echo "BUILD-ONLY" echo "FULL"
exit 0 exit 0
fi fi
# Third case: CI or 4G label --> Full CI run # 4G is present: run only 4G
if [ $IS_MR_4G -eq 1 ] || [ $IS_MR_CI -eq 1 ] if [ $IS_MR_4G -eq 1 ]
then then
echo "FULL" echo "SHORTEN-4G"
exit 0 exit 1
fi fi
# Fourth case: 5G label # 5G is present: run only 5G
if [ $IS_MR_BUILD_ONLY -eq 0 ] && [ $IS_MR_CI -eq 0 ] && [ $IS_MR_4G -eq 0 ] && [ $IS_MR_5G -eq 1 ] if [ $IS_MR_5G -eq 1 ]
then then
echo "SHORTEN-5G" echo "SHORTEN-5G"
exit 0 exit 0
fi fi
# BUILD-ONLY is present: only build stages
if [ $IS_MR_BUILD_ONLY -eq 1 ]
then
echo "BUILD-ONLY"
exit 0
fi
# Documentation is present: don't do anything
if [ $IS_MR_DOCUMENTATION -eq 1 ]
then
echo "documentation"
exit 1
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment