Add jenkins charts
[it/dep.git] / smo-install / jenkins / gerrit / manual-tests-pipeline
1 podTemplate(yaml: '''
2               apiVersion: v1
3               kind: Pod
4               spec:
5                 containers:
6                 - name: jenkins-ubuntu
7                   image: ubuntu:20.04
8                   command:
9                   - sleep
10                   args: 
11                   - 99d
12 ''') {
13   node(POD_LABEL) {
14      def proxies=''
15      stage('Checkout') {
16        sh 'printenv' 
17        git branch: env.BRANCH, url:'https://gerrit.o-ran-sc.org/r/it/dep'
18       }
19       container('jenkins-ubuntu') {
20         stage ('Proxy settings') {
21           echo 'Proxy check'
22           script {
23             if (env.http_proxy) {
24               sh 'echo \'Acquire::http::Proxy "' + env.http_proxy + '";\' > /etc/apt/apt.conf.d/proxy.conf'
25               sh 'cat /etc/apt/apt.conf.d/proxy.conf'
26               sh 'echo "http_proxy = "'+env.http_proxy+' > ~/.wgetrc'
27               sh 'cat ~/.wgetrc'
28
29               sh 'echo \'Acquire::https::Proxy "' + env.http_proxy + '";\' >> /etc/apt/apt.conf.d/proxy.conf'
30               sh 'cat /etc/apt/apt.conf.d/proxy.conf'
31               sh 'echo "https_proxy = "'+env.http_proxy+' >> ~/.wgetrc'
32               sh 'cat ~/.wgetrc'
33
34               proxies='HTTPS_PROXY='+env.http_proxy+' '
35             }
36           }
37           sh 'printenv'
38         }
39
40         stage('Setup tools') {
41             sh 'apt-get update -y'
42             sh 'DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata'
43             sh 'apt-get install git wget sudo -y'
44             sh 'wget https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl'
45             sh 'mv kubectl /usr/bin'
46             sh 'chmod a+x /usr/bin/kubectl'
47             sh 'kubectl version'
48             sh proxies+' ./smo-install/scripts/layer-0/0-setup-tests-env.sh'
49             sh proxies+' ./smo-install/scripts/layer-0/0-setup-charts-museum.sh'
50             sh proxies+' ./smo-install/scripts/layer-0/0-setup-helm3.sh'
51
52         }
53         stage('Build TESTS charts') {
54             sh proxies+' ./smo-install/scripts/sub-scripts/build-tests.sh'
55         }
56         stage('Test ORAN') {
57             dir("smo-install/test/pythonsdk") {
58               try {
59                 if (env.http_proxy) {
60                   sh proxies+' NO_PROXY='+env.no_proxy+' tox'
61                 } else {
62                   sh 'tox'
63                 }
64               }
65               catch(exec) {
66                 echo 'TOX tests crashed'
67               }
68             }
69         }
70         stage('Get Results') {
71           archiveArtifacts artifacts: 'smo-install/test/pythonsdk/src/orantests/pythonsdk.debug.log, **/reports/junit/*.xml', fingerprint: true
72           junit '**/reports/junit/*.xml'
73         }
74       }
75    
76   }
77 }