blob: dc2be394de698b7700e18c52087bf2329bc55124 [file] [log] [blame]
Jeremy Ronquillo6072a982020-04-16 13:18:24 -07001// Copyright 2020-present Open Networking Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// comac-in-a-box-gerrit build+test
16// steps taken from https://guide.opencord.org/profiles/comac/install/ciab.html
17
18pipeline {
19
20 /* no label, executor is determined by JJB */
21 agent {
22 label "${params.buildNode}"
23 }
24
25 options {
26 timeout(time: 1, unit: 'HOURS')
27 }
28
29 stages {
30 stage ("Environment Setup"){
31 steps {
32 sh label: 'Run COMAC-in-a-box reset-test', script: """
33 echo $HOME
34 cd $HOME/automation-tools/comac-in-a-box/
35 sudo make reset-test
36 """
37 sh label: 'Cleanup Docker Images', script: '''
38 sudo docker rmi -f $(sudo docker images --format '{{.Repository}} {{.ID}}' | grep 'none' | awk '{print $2}') || true
39 sudo docker rmi -f $(sudo docker images --format '{{.Repository}}:{{.Tag}}' | grep 'openmme') || true
40 sudo docker rmi -f $(sudo docker images --format '{{.Repository}}:{{.Tag}}' | grep 'ngic') || true
41 sudo docker rmi -f $(sudo docker images --format '{{.Repository}}:{{.Tag}}' | grep 'c3po') || true
42 '''
43 sh label: 'helm-charts Repo Fresh Clone', script: """
44 cd $HOME/cord/
45 sudo rm -rf helm-charts/
46 git clone https://gerrit.opencord.org/helm-charts
47 """
48 }
49 }
50
51 stage ("Fetch Helm-Charts Changes"){
52 steps {
53 sh label: 'Fetch helm-charts Gerrit Changes', script: """
54 cd $HOME/cord/helm-charts/
55 if [ ! -z "${GERRIT_REFSPEC}" ]
56 then
57 echo "Checking out Gerrit patchset: ${GERRIT_REFSPEC}"
58 git fetch ${gitUrl} ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
59 else
60 echo "GERRIT_REFSPEC not provided. Checking out master branch."
61 git checkout master
62 fi
63 """
64 }
65 }
66
67 stage ("Run COMAC-in-a-box"){
68 steps {
69 sh label: 'Run Makefile', script: """
70 cd $HOME/automation-tools/comac-in-a-box/
71 sudo make reset-test
72 sudo make test
73 """
74 }
75 }
76 }
77}