Skip to content

Commit b91e164

Browse files
author
Vitaly Korolev
committed
Update grype scan logic to include dependent images.
1 parent f589e6e commit b91e164

25 files changed

+809
-631
lines changed

Jenkinsfile

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import groovy.json.JsonSlurperClassic
77

88
emailList = 'vitaly.korolev@progress.com, sumanth.ravipati@progress.com, peng.zhou@progress.com, fayez.saliba@progress.com, barkha.choithani@progress.com, romain.winieski@progress.com'
9-
emailSecList = 'Rangan.Doreswamy@progress.com, Mahalakshmi.Srinivasan@progress.com'
9+
emailSecList = 'Mahalakshmi.Srinivasan@progress.com'
1010
gitCredID = 'marklogic-builder-github'
1111
JIRA_ID = ''
1212
JIRA_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

151156
void 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\nubi\ncentos', description: 'Platform type for Docker image')
186+
choice(name: 'dockerImageType', choices: 'ubi-rootless\nubi\nubi9-rootless\nubi9', 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\nv1.30.2\nv1.28.11\nv1.27.15\nv1.26.15\nv1.25.16', description: 'Test Kubernetes version.')
189+
choice(name: 'K8_VERSION', choices: 'v1.31.7\nv1.32.3\nv1.30.11\nv1.29.15\nv1.28.15\nv1.27.16\nv1.26.15\nv1.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
}

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2022 MarkLogic Corporation.
1+
Copyright © 2022-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
22

33
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
44

0 commit comments

Comments
 (0)