-- Stability issues when installing packages for USRP variants on new VM
It sometimes timed-out
Added loop up to 5 tries to add apt-repository
-- Temporary merge during MergeRequest processing now returns an
error when there are any conflicts
Will stop the whole build
-- Physical simulator now has a XLST for the XML result
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
232 lines
11 KiB
Plaintext
232 lines
11 KiB
Plaintext
// Comments
|
|
|
|
pipeline {
|
|
agent {
|
|
label 'bellatrix'
|
|
}
|
|
options {
|
|
disableConcurrentBuilds()
|
|
timestamps()
|
|
gitLabConnection('OAI GitLab')
|
|
gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim"])
|
|
}
|
|
|
|
stages {
|
|
stage ("Verify Guidelines") {
|
|
steps {
|
|
echo "Git URL is ${GIT_URL}"
|
|
echo "GitLab Act is ${env.gitlabActionType}"
|
|
script {
|
|
if ("MERGE".equals(env.gitlabActionType)) {
|
|
// GitLab-Jenkins plugin integration is lacking to perform the merge by itself
|
|
// Doing it manually --> it may have merge conflicts
|
|
sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
|
|
sh "zip -r -qq localZip.zip ."
|
|
|
|
// Running astyle options on the list of modified files by the merge request
|
|
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
|
|
sh "./ci-scripts/checkCodingFormattingRules.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}"
|
|
def res=readFile('./oai_rules_result.txt').trim();
|
|
if ("0".equals(res)) {
|
|
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): All Changed files in Merge Request follow OAI Formatting Rules"
|
|
addGitLabMRComment comment: message
|
|
} else {
|
|
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some Changed files in Merge Request DO NOT follow OAI Formatting Rules"
|
|
addGitLabMRComment comment: message
|
|
}
|
|
} else {
|
|
echo "Git Branch is ${GIT_BRANCH}"
|
|
echo "Git Commit is ${GIT_COMMIT}"
|
|
|
|
sh "zip -r -qq localZip.zip ."
|
|
// Running astyle options on all C/H files in the repository
|
|
// For the moment, there is no fail criteria. Just a notification of number of files that do not follow
|
|
sh "./ci-scripts/checkCodingFormattingRules.sh"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
failure {
|
|
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI"
|
|
addGitLabMRComment comment: message
|
|
}
|
|
}
|
|
}
|
|
|
|
stage ("Start VM -- cppcheck") {
|
|
steps {
|
|
sh "./ci-scripts/createVM.sh --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
|
|
stage ("Start VM -- enb-usrp") {
|
|
steps {
|
|
sh "./ci-scripts/createVM.sh --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
|
|
stage ("Start VM -- basic-sim") {
|
|
steps {
|
|
sh "./ci-scripts/createVM.sh --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
|
|
stage ("Start VM -- phy-sim") {
|
|
steps {
|
|
sh "./ci-scripts/createVM.sh --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
|
|
stage ("Start VM -- enb-ethernet") {
|
|
steps {
|
|
sh "./ci-scripts/createVM.sh --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
|
|
stage ("Start VM -- ue-ethernet") {
|
|
steps {
|
|
sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
|
|
stage ("Variant Builds") {
|
|
parallel {
|
|
stage ("Analysis with cppcheck") {
|
|
steps {
|
|
gitlabCommitStatus(name: "Analysis with cppcheck") {
|
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
}
|
|
}
|
|
}
|
|
stage ("Build eNb-USRP") {
|
|
steps {
|
|
gitlabCommitStatus(name: "Build eNb-USRP") {
|
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
}
|
|
}
|
|
}
|
|
stage ("Build basic simulator") {
|
|
steps {
|
|
gitlabCommitStatus(name: "Build basic-sim") {
|
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
}
|
|
}
|
|
}
|
|
stage ("Build physical simulators") {
|
|
steps {
|
|
gitlabCommitStatus(name: "Build phy-sim") {
|
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
}
|
|
}
|
|
}
|
|
stage ("Build eNb-ethernet") {
|
|
steps {
|
|
gitlabCommitStatus(name: "Build eNb-ethernet") {
|
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
}
|
|
}
|
|
}
|
|
stage ("Build UE-ethernet") {
|
|
steps {
|
|
gitlabCommitStatus(name: "Build UE-ethernet") {
|
|
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
script {
|
|
dir ('archives') {
|
|
sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth"
|
|
}
|
|
if(fileExists('archives/vm_build_logs.zip')) {
|
|
archiveArtifacts artifacts: 'archives/vm_build_logs.zip'
|
|
}
|
|
if ("MERGE".equals(env.gitlabActionType)) {
|
|
sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
|
|
} else {
|
|
sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
|
|
}
|
|
if(fileExists('build_results.html')) {
|
|
archiveArtifacts artifacts: 'build_results.html'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage ("Variant Tests") {
|
|
parallel {
|
|
stage ("Test physical simulators") {
|
|
steps {
|
|
gitlabCommitStatus(name: "Test phy-sim") {
|
|
sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
}
|
|
}
|
|
}
|
|
stage ("Test basic simulator") {
|
|
steps {
|
|
//gitlabCommitStatus(name: "Test basic-sim") {
|
|
sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
script {
|
|
dir ('archives') {
|
|
sh "if [ -d */test ]; then zip -r -qq vm_tests_logs.zip */test ; fi"
|
|
}
|
|
if(fileExists('archives/vm_tests_logs.zip')) {
|
|
archiveArtifacts artifacts: 'archives/vm_tests_logs.zip'
|
|
archiveArtifacts artifacts: 'archives/*/test/results_autotests*.xml'
|
|
archiveArtifacts artifacts: 'archives/*/test/*.xsl'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage ("Destroy all Virtual Machines") {
|
|
steps {
|
|
sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
script {
|
|
// Stage destroy may not be run if error in previous stage
|
|
sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
|
}
|
|
}
|
|
success {
|
|
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
|
|
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
|
slackSend channel: 'ci-enb', color: 'good', message: message2
|
|
} else {
|
|
slackSend channel: 'ci-enb', color: 'good', message: message
|
|
}
|
|
}
|
|
}
|
|
failure {
|
|
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
|
|
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
|
slackSend channel: 'ci-enb', color: 'danger', message: message2
|
|
} else {
|
|
slackSend channel: 'ci-enb', color: 'danger', message: message
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|