From f7618a97b8d3b0737bcd02efbd829f7d36b6a062 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 29 Sep 2022 08:59:01 +0200 Subject: [PATCH] Introduce documentation step in RAN-Container-Parent, separate 4G and 5G --- ci-scripts/Jenkinsfile-GitLab-Container | 57 +++++++++++---------- ci-scripts/Jenkinsfile-gitlab | 2 +- ci-scripts/checkGitLabMergeRequestLabels.sh | 52 ++++++++++++------- 3 files changed, 65 insertions(+), 46 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 3bc159cd98..0786978388 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -24,8 +24,9 @@ def nodeExecutor = params.nodeExecutor // Tags to shorten pipeline duration -def doMandatoryTests = false -def doFullTestsuite = false +def doBuild = true +def do4Gtest = false +def do5Gtest = false // def gitCommitAuthorEmailAddr @@ -56,26 +57,30 @@ pipeline { LABEL_CHECK = sh returnStdout: true, script: 'ci-scripts/checkGitLabMergeRequestLabels.sh --mr-id ' + env.gitlabMergeRequestIid LABEL_CHECK = LABEL_CHECK.trim() if (LABEL_CHECK == 'NONE') { - def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Your merge request has none of the mandatory labels:\n\n" - message += " - BUILD-ONLY\n" - message += " - 4G-LTE\n" - message += " - 5G-NR\n" - message += " - CI\n\n" + def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Your merge request should have one of the mandatory labels:\n\n" + message += " - ~documentation (don't perform any stages)\n" + message += " - ~BUILD-ONLY (execute only build stages)\n" + message += " - ~4G-LTE (perform 4G tests)\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" addGitLabMRComment comment: message error('Not performing CI due to lack of labels') } else if (LABEL_CHECK == 'FULL') { - doMandatoryTests = true - doFullTestsuite = true + do4Gtest = true + do5Gtest = true + } else if (LABEL_CHECK == "SHORTEN-4G") { + do4Gtest = true } else if (LABEL_CHECK == 'SHORTEN-5G') { - doMandatoryTests = true + do5Gtest = true + } else if (LABEL_CHECK == 'documentation') { + doBuild = false } else { - def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): We will perform only build stages on your Merge Request" - addGitLabMRComment comment: message + // is "BUILD-ONLY", will only build } } else { - doMandatoryTests = true - doFullTestsuite = true + do4Gtest = true + do5Gtest = true } } } @@ -116,6 +121,7 @@ pipeline { // Build Stages are Mandatory // Later we will add a Ubuntu20 build stage ("Image Building Processes") { + when { expression {doBuild} } parallel { stage ("Ubuntu18-Image-Builder") { steps { @@ -177,9 +183,10 @@ pipeline { } } stage ("Image Test Processes") { + when { expression {doBuild} } parallel { stage ("PhySim-Cluster") { - when { expression {doMandatoryTests} } + when { expression {do4Gtest || do5Gtest} } steps { script { triggerSlaveJob ('RAN-PhySim-Cluster', 'PhySim-Cluster') @@ -199,7 +206,7 @@ pipeline { } } stage ("RF-Sim-Test-4G") { - when { expression {doMandatoryTests} } + when { expression {do4Gtest} } steps { script { triggerSlaveJob ('RAN-RF-Sim-Test-4G', 'RF-Sim-Test-4G') @@ -219,7 +226,7 @@ pipeline { } } stage ("RF-Sim-Test-5G") { - when { expression {doMandatoryTests} } + when { expression {do5Gtest} } steps { script { triggerSlaveJob ('RAN-RF-Sim-Test-5G', 'RF-Sim-Test-5G') @@ -239,7 +246,7 @@ pipeline { } } stage ("L2-Sim-Test-4G") { - when { expression {doMandatoryTests} } + when { expression {do4Gtest} } steps { script { triggerSlaveJob ('RAN-L2-Sim-Test-4G', 'L2-Sim-Test-4G') @@ -259,7 +266,7 @@ pipeline { } } stage ("L2-Sim-Test-5G") { - when { expression {doMandatoryTests} } + when { expression {do5Gtest} } steps { script { triggerSlaveJob ('RAN-L2-Sim-Test-5G', 'L2-Sim-Test-5G') @@ -279,7 +286,7 @@ pipeline { } } stage ("NSA-B200-Module-LTEBOX-Container") { - when { expression {doMandatoryTests} } + when { expression {do4Gtest || do5Gtest} } steps { script { triggerSlaveJob ('RAN-NSA-B200-Module-LTEBOX-Container', 'NSA-B200-Module-LTEBOX-Container') @@ -299,7 +306,7 @@ pipeline { } } stage ("NSA-B200-Module-SABOX-Container") { - when { expression {doMandatoryTests} } + when { expression {do5Gtest} } steps { script { triggerSlaveJob ('RAN-SA-B200-Module-SABOX-Container', 'NSA-B200-Module-SABOX-Container') @@ -319,7 +326,7 @@ pipeline { } } stage ("gNB-N300-Timing-Phytest-LDPC") { - when { expression {doMandatoryTests} } + when { expression {do5Gtest} } steps { script { triggerSlaveJob ('RAN-gNB-N300-Timing-Phytest-LDPC', 'gNB-N300-Timing-Phytest-LDPC') @@ -340,7 +347,7 @@ pipeline { } //avra is offline, re-enable once it is available //stage ("T1-Offload-Test") { - // when { expression {doMandatoryTests} } + // when { expression {do5Gtest} } // steps { // script { // triggerSlaveJob ('RAN-T1-Offload-Test', 'T1-Offload-Test') @@ -362,7 +369,7 @@ pipeline { } } stage ("DockerHub-Push") { - when { expression {"PUSH".equals(env.gitlabActionType)} } + when { expression {doBuild && "PUSH".equals(env.gitlabActionType)} } steps { script { triggerSlaveJob ('RAN-DockerHub-Push', 'DockerHub-Push') @@ -401,7 +408,6 @@ pipeline { script { def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")" if ("MERGE".equals(env.gitlabActionType)) { - echo "This is a MERGE event" addGitLabMRComment comment: message } echo "Pipeline is SUCCESSFUL" @@ -411,7 +417,6 @@ pipeline { script { def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")" if ("MERGE".equals(env.gitlabActionType)) { - echo "This is a MERGE event" addGitLabMRComment comment: message } echo "Pipeline FAILED" diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 4518af6cae..56dbc61e39 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -82,7 +82,7 @@ pipeline { message += "Not performing CI due to lack of labels" addGitLabMRComment comment: message 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 doFullTestsuite = true } else if (LABEL_CHECK == 'SHORTEN-5G') { diff --git a/ci-scripts/checkGitLabMergeRequestLabels.sh b/ci-scripts/checkGitLabMergeRequestLabels.sh index 7e4ea1c7de..d31c98706b 100755 --- a/ci-scripts/checkGitLabMergeRequestLabels.sh +++ b/ci-scripts/checkGitLabMergeRequestLabels.sh @@ -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` -IS_MR_BUILD_ONLY=`echo $LABELS | grep -c BUILD-ONLY || true` -IS_MR_CI=`echo $LABELS | grep -c CI || true` -IS_MR_4G=`echo $LABELS | grep -c 4G-LTE || true` -IS_MR_5G=`echo $LABELS | grep -c 5G-NR || true` +IS_MR_DOCUMENTATION=`echo $LABELS | grep -c Documentation` +IS_MR_BUILD_ONLY=`echo $LABELS | grep -c BUILD-ONLY` +IS_MR_CI=`echo $LABELS | grep -c CI` +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 -if [ $IS_MR_BUILD_ONLY -eq 0 ] && [ $IS_MR_CI -eq 0 ] && [ $IS_MR_4G -eq 0 ] && [ $IS_MR_5G -eq 0 ] +# 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 ] && [ $IS_MR_DOCUMENTATION -eq 0 ] then echo "NONE" exit 0 fi -# Second case: Build-Only +# 4G and 5G or CI labels: run everything (4G, 5G) +if [ $IS_MR_4G -eq 1 ] && [ $IS_MR_5G -eq 1 ] || [ $IS_MR_CI -eq 1 ] +then + echo "FULL" + exit 0 +fi + +# 4G is present: run only 4G +if [ $IS_MR_4G -eq 1 ] +then + echo "SHORTEN-4G" + exit 1 +fi + +# 5G is present: run only 5G +if [ $IS_MR_5G -eq 1 ] +then + echo "SHORTEN-5G" + exit 0 +fi + +# BUILD-ONLY is present: only build stages if [ $IS_MR_BUILD_ONLY -eq 1 ] then echo "BUILD-ONLY" exit 0 fi -# Third case: CI or 4G label --> Full CI run -if [ $IS_MR_4G -eq 1 ] || [ $IS_MR_CI -eq 1 ] +# Documentation is present: don't do anything +if [ $IS_MR_DOCUMENTATION -eq 1 ] then - echo "FULL" - exit 0 + echo "documentation" + exit 1 fi - -# Fourth case: 5G label -if [ $IS_MR_BUILD_ONLY -eq 0 ] && [ $IS_MR_CI -eq 0 ] && [ $IS_MR_4G -eq 0 ] && [ $IS_MR_5G -eq 1 ] -then - echo "SHORTEN-5G" - exit 0 -fi -