21 if (env.GERRIT_REFNAME.startsWith('refs/changes/')) {
22 echo 'PULL REQUEST case detected'
23 gitInfo = checkout([$class: 'GitSCM', branches: [[name: 'changes/'+env.BRANCH_NAME]], extensions: [[$class: 'SubmoduleOption', recursiveSubmodules: true]], userRemoteConfigs: [[credentialsId: 'gerrit_username_pass', name: 'origin', refspec: '+refs/changes/*:refs/remotes/origin/changes/*', url: 'https://gerrit.o-ran-sc.org/r/a/it/dep']]])
26 echo 'BRANCH case detected'
27 gitInfo = checkout([$class: 'GitSCM', branches: [[name: env.BRANCH_NAME]], extensions: [[$class: 'SubmoduleOption', recursiveSubmodules: true]], userRemoteConfigs: [[credentialsId: 'gerrit_username_pass', name: 'origin', refspec: '+refs/heads/*:refs/remotes/origin/*', url: 'https://gerrit.o-ran-sc.org/r/a/it/dep']]])
31 gerritReview labels: [Verified: 0], message: env.HUDSON_URL+': Validating the SMO package ' + env.BUILD_URL
33 container('jenkins-ubuntu') {
34 stage ('Proxy settings') {
38 sh 'echo \'Acquire::http::Proxy "' + env.http_proxy + '";\' > /etc/apt/apt.conf.d/proxy.conf'
39 sh 'cat /etc/apt/apt.conf.d/proxy.conf'
40 sh 'echo "http_proxy = "'+env.http_proxy+' > ~/.wgetrc'
43 sh 'echo \'Acquire::https::Proxy "' + env.http_proxy + '";\' >> /etc/apt/apt.conf.d/proxy.conf'
44 sh 'cat /etc/apt/apt.conf.d/proxy.conf'
45 sh 'echo "https_proxy = "'+env.http_proxy+' >> ~/.wgetrc'
48 proxies='HTTPS_PROXY='+env.http_proxy+' '
54 stage('Setup tools') {
55 echo 'Setup container'
58 sh 'apt-get update -y'
59 sh 'DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata'
60 sh 'apt-get install git wget sudo -y'
62 sh 'wget https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl'
63 sh 'mv kubectl /usr/bin'
64 sh 'chmod a+x /usr/bin/kubectl'
66 sh proxies+' ./smo-install/scripts/layer-0/0-setup-tests-env.sh'
67 sh proxies+' ./smo-install/scripts/layer-0/0-setup-charts-museum.sh'
68 sh proxies+' ./smo-install/scripts/layer-0/0-setup-helm3.sh'
71 stage('Build ONAP charts') {
72 sh proxies+' ./smo-install/scripts/sub-scripts/build-onap.sh'
74 stage('Build ORAN charts') {
75 sh proxies+' ./smo-install/scripts/sub-scripts/build-oran.sh'
77 stage('Build TESTS charts') {
78 sh proxies+' ./smo-install/scripts/sub-scripts/build-tests.sh'
81 sh './smo-install/scripts/layer-2/2-install-oran.sh pythonsdk-tests'
84 dir("smo-install/test/pythonsdk") {
85 echo 'Executing TOX tests'
88 sh script: proxies+' NO_PROXY='+env.no_proxy+' tox > tox.log'
90 sh script: 'tox > tox.log'
92 echo 'TOX tests SUCCESS'
93 toxLog = readFile 'tox.log'
95 toxLog = sh script: 'tail -40 tox.log',returnStdout: true
97 gerritReview labels: [Verified: 0], message:env.HUDSON_URL+': SMO Build SUCCESSFUL ('+env.BUILD_URL+')\r\n\r\n'+toxLog
98 //gerritCheck checks: ['SMO:checker': 'SUCCESSFUL']
99 currentBuild.result = 'SUCCESS'
102 echo 'TOX tests FAILURE'
103 toxLog = readFile 'tox.log'
105 toxLog = sh script: 'tail -40 tox.log',returnStdout: true
107 gerritReview labels: [Verified: 0], message:env.HUDSON_URL+': SMO Build FAILED, TOX tests have crashed ('+env.BUILD_URL+')\r\n\r\n'+toxLog
108 //gerritCheck checks: ['SMO:checker': 'FAILED']
109 currentBuild.result = 'FAILURE'
114 sh './smo-install/scripts/sub-scripts/uninstall-nonrtric.sh'
115 sh './smo-install/scripts/sub-scripts/uninstall-onap.sh'
117 stage('Get Results') {
118 archiveArtifacts artifacts: 'smo-install/test/pythonsdk/src/orantests/pythonsdk.debug.log, **/reports/junit/*.xml', fingerprint: true
119 junit '**/reports/junit/*.xml'