66import groovy.json.JsonSlurperClassic
77
889- 9+ emailSecList
= ' [email protected] ' 1010gitCredID = ' marklogic-builder-github'
1111JIRA_ID = ' '
1212JIRA_ID_PATTERN = / (?i)(MLE)-\d {3,6}/
@@ -44,6 +44,7 @@ void preBuildCheck() {
4444 sh '''
4545 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /space/go/bin v1.50.0
4646 wget https://github.com/gotestyourself/gotestsum/releases/download/v1.12.0/gotestsum_1.12.0_linux_amd64.tar.gz -O gotestsum.tar.gz
47+ mkdir -p /space/go/bin/
4748 tar -xf gotestsum.tar.gz -C /space/go/bin/ gotestsum
4849 '''
4950}
@@ -102,7 +103,7 @@ def getReviewState() {
102103 return reviewState
103104}
104105
105- void resultNotification (message ) {
106+ void resultNotification (status ) {
106107 def author, authorEmail, emailList
107108 if (env. CHANGE_AUTHOR ) {
108109 author = env. CHANGE_AUTHOR . toString(). trim(). toLowerCase()
@@ -116,11 +117,11 @@ void resultNotification(message) {
116117 jira_email_body = " ${ email_body} <br><br><b>Jira URL: </b><br><a href='${ jira_link} '>${ jira_link} </a>"
117118
118119 if (JIRA_ID ) {
119- def comment = [ body : " Jenkins pipeline build result: ${ message } " ]
120+ def comment = [ body : " Jenkins pipeline build result: ${ status } " ]
120121 jiraAddComment site : ' JIRA' , idOrKey : JIRA_ID , failOnError : false , input : comment
121- mail charset : ' UTF-8' , mimeType : ' text/html' , to : " ${ emailList} " , body : " ${ jira_email_body} " , subject : " ${ message } : ${ env.JOB_NAME} #${ env.BUILD_NUMBER} - ${ JIRA_ID} "
122+ mail charset : ' UTF-8' , mimeType : ' text/html' , to : " ${ emailList} " , body : " ${ jira_email_body} " , subject : " 🥷 ${ status } : ${ env.JOB_NAME} #${ env.BUILD_NUMBER} - ${ JIRA_ID} "
122123 } else {
123- mail charset : ' UTF-8' , mimeType : ' text/html' , to : " ${ emailList} " , body : " ${ email_body} " , subject : " ${ message } : ${ env.JOB_NAME} #${ env.BUILD_NUMBER} "
124+ mail charset : ' UTF-8' , mimeType : ' text/html' , to : " ${ emailList} " , body : " ${ email_body} " , subject : " 🥷 ${ status } : ${ env.JOB_NAME} #${ env.BUILD_NUMBER} "
124125 }
125126}
126127
@@ -146,6 +147,10 @@ void imageScan() {
146147 }
147148
148149 sh ''' rm -f dep-image-scan.txt'''
150+
151+ // trigger BlackDuck scan
152+ def imageList = readFile(file : ' helm_image.list' ). trim()
153+ build job : ' securityscans/Blackduck/KubeNinjas/kubernetes-helm' , wait : false , parameters : [ string(name : ' branch' , value : " ${ env.BRANCH_NAME} " ), string(name : ' CONTAINER_IMAGES' , value : " ${ imageList} " ) ]
149154}
150155
151156void publishTestResults () {
@@ -165,22 +170,23 @@ pipeline {
165170 skipStagesAfterUnstable()
166171 }
167172 triggers {
168- parameterizedCron( env. BRANCH_NAME == ' develop' ? ''' 00 04 * * * % IMAGE_SCAN=true;HELM_UPGRADE_TESTS=true;HC_TESTS=true''' : ' ' )
173+ parameterizedCron( env. BRANCH_NAME == ' develop' ? ''' 00 04 * * * % IMAGE_SCAN=true;HELM_UPGRADE_TESTS=true;HC_TESTS=true
174+ 00 04 * * * % dockerImageType=ubi''' : ' ' )
169175 }
170176 environment {
171177 dockerRegistry = ' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com'
172178 dockerRepository = " ${ dockerRegistry} /marklogic/marklogic-server-${ params.dockerImageType} "
173179 PATH = " /space/go/bin:${ env.PATH} "
174- MINIKUBE_HOME = " /space"
180+ MINIKUBE_HOME = " /space/minikube/ "
175181 KUBECONFIG = " /space/.kube-config"
176182 GOPATH = " /space/go"
177183 }
178184
179185 parameters {
180- choice(name : ' dockerImageType' , choices : ' ubi-rootless\n ubi\n centos ' , description : ' Platform type for Docker image' )
186+ choice(name : ' dockerImageType' , choices : ' ubi-rootless\n ubi\n ubi9-rootless \n ubi9 ' , description : ' Platform type for Docker image' )
181187 string(name : ' dockerVersion' , defaultValue : ' latest-11' , description : ' Docker tag to use for tests. (e.g. 11.2.nightly-ubi-rootless-1.1.2) Has to correspond with dockerImageType.' , trim : true )
182188 string(name : ' prevDockerVersion' , defaultValue : ' latest-10' , description : ' Previous Docker version for MarkLogic upgrade tests. (e.g. 10.0-10.2-centos-1.1.2) Has to correspond with dockerImageType.' , trim : true )
183- choice(name : ' K8_VERSION' , choices : ' v1.29.6 \n v1.30.2 \n v1.28.11 \n v1.27.15 \n v1.26.15\n v1.25.16' , description : ' Test Kubernetes version.' )
189+ choice(name : ' K8_VERSION' , choices : ' v1.31.7 \n v1.32.3 \n v1. 30.11 \n v1.29.15 \n v1. 28.15 \n v1.27.16 \n v1.26.15\n v1.25.16' , description : ' Test Kubernetes version.' )
184190 booleanParam(name : ' KUBERNETES_TESTS' , defaultValue : true , description : ' Run kubernetes tests' )
185191 string(name : ' KUBERNETES_TEST_SELECTION' , defaultValue : ' ...' , description : ' Pick one test to run. (e.g. tls_test.go) ... will run all tests.' , trim : true )
186192 booleanParam(name : ' HC_TESTS' , defaultValue : false , description : ' Run Hub Central E2E UI tests (takes about 3 hours)' )
@@ -250,22 +256,25 @@ pipeline {
250256 sh '''
251257 sudo sysctl -w vm.nr_hugepages=0
252258 minikube delete --all --purge
253- docker rm -f $(docker ps -a -q) || true
254- docker system prune --force --filter "until=720h"
255- docker volume prune --force
256- docker image prune --force --all
257- sudo rm -rf /space/. minikube /space/go /space/.kube-config
259+ docker stop $(docker ps -a -q) || true
260+ docker system prune --force --all
261+ docker volume prune --force --all
262+ docker system df
263+ sudo rm -rf /space/minikube/ /space/go /space/.kube-config
258264 '''
259265 sh " rm -rf $WORKSPACE /test/test_results/"
260266 }
261267 success {
262- resultNotification(' BUILD SUCCESS ✅ ' )
268+ resultNotification(' ✅ Success ' )
263269 }
264270 failure {
265- resultNotification(' BUILD ERROR ❌ ' )
271+ resultNotification(' ❌ Failure ' )
266272 }
267273 unstable {
268- resultNotification(' BUILD UNSTABLE ❌' )
274+ resultNotification(' ⚠️ Unstable' )
275+ }
276+ aborted {
277+ resultNotification(' 🚫 Aborted' )
269278 }
270279 }
271280}
0 commit comments