Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 1 | /** |
| 2 | * |
| 3 | * Run openscap xccdf evaluation on given nodes |
| 4 | * |
| 5 | * Expected parametes: |
Pavlo Shchelokovskyy | 319e00f | 2018-10-08 17:15:44 +0300 | [diff] [blame^] | 6 | * OPENSCAP_TEST_TYPE Type of OpenSCAP evaluation to run, either 'xccdf' or 'oval' |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 7 | * SALT_MASTER_URL Full Salt API address. |
| 8 | * SALT_MASTER_CREDENTIALS Credentials to the Salt API. |
| 9 | * |
Pavlo Shchelokovskyy | 319e00f | 2018-10-08 17:15:44 +0300 | [diff] [blame^] | 10 | * XCCDF_BENCHMARKS_DIR Base directory for XCCDF benchmarks (default /usr/share/xccdf-benchmarks/mirantis/) |
| 11 | * or OVAL devinitions (default /usr/share/oval-definitions/mirantis/) |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 12 | * XCCDF_BENCHMARKS List of pairs XCCDF benchmark filename and corresponding profile separated with ',' |
Pavlo Shchelokovskyy | 319e00f | 2018-10-08 17:15:44 +0300 | [diff] [blame^] | 13 | * these pairs are separated with semicolon |
| 14 | * (e.g. manila/openstack_manila-xccdf.xml,profilename;horizon/openstack_horizon-xccdf.xml,profile). |
| 15 | * For OVAL definitions, paths to OVAL definition files separated by semicolon, profile is ignored. |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 16 | * XCCDF_VERSION The XCCDF version (default 1.2) |
| 17 | * XCCDF_TAILORING_ID The tailoring id (default None) |
| 18 | * |
| 19 | * TARGET_SERVERS The target Salt nodes (default *) |
| 20 | * |
| 21 | * ARTIFACTORY_URL The artifactory URL |
| 22 | * ARTIFACTORY_NAMESPACE The artifactory namespace (default 'mirantis/openscap') |
| 23 | * ARTIFACTORY_REPO The artifactory repo (default 'binary-dev-local') |
| 24 | * |
| 25 | * UPLOAD_TO_DASHBOARD Boolean. Upload results to the WORP or not |
| 26 | * DASHBOARD_API_URL The WORP api base url. Mandatory if UPLOAD_TO_DASHBOARD is true |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | |
| 31 | /** |
| 32 | * Upload results to the `WORP` dashboard |
| 33 | * |
| 34 | * @param apiUrl The base dashboard api url |
| 35 | * @param cloudName The cloud name (mostly, the given node's domain name) |
| 36 | * @param nodeName The node name |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 37 | * @param reportType Type of the report to create/use, either 'openscap' or 'cve' |
| 38 | * @param reportId Report Id to re-use, if empty report will be created |
| 39 | * @param results The scanning results as a json file content (string) |
| 40 | * @return reportId The Id of the report created if incoming reportId was empty, otherwise incoming reportId |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 41 | */ |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 42 | def uploadResultToDashboard(apiUrl, cloudName, nodeName, reportType, reportId, results) { |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 43 | def common = new com.mirantis.mk.Common() |
| 44 | def http = new com.mirantis.mk.Http() |
| 45 | |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 46 | // Yes, we do not care of performance and will create at least 4 requests per each result |
| 47 | def requestData = [:] |
| 48 | |
| 49 | def cloudId |
| 50 | def nodeId |
| 51 | |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 52 | def worpApi = [:] |
| 53 | worpApi["url"] = apiUrl |
| 54 | |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 55 | // Let's take a look, may be our minion is already presented on the dashboard |
| 56 | // Get available environments |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 57 | common.infoMsg("Making GET to ${worpApi.url}/environment/") |
| 58 | environments = http.restGet(worpApi, "/environment/") |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 59 | for (environment in environments) { |
| 60 | if (environment['name'] == cloudName) { |
| 61 | cloudId = environment['uuid'] |
| 62 | break |
| 63 | } |
| 64 | } |
| 65 | // Cloud wasn't presented, let's create it |
| 66 | if (! cloudId ) { |
| 67 | // Create cloud |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 68 | requestData = [:] |
| 69 | requestData['name'] = cloudName |
| 70 | common.infoMsg("Making POST to ${worpApi.url}/environment/ with ${requestData}") |
| 71 | cloudId = http.restPost(worpApi, "/environment/", requestData)['env']['uuid'] |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 72 | |
| 73 | // And the node |
| 74 | // It was done here to reduce count of requests to the api. |
| 75 | // Because if there was not cloud presented on the dashboard, then the node was not presented as well. |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 76 | requestData = [:] |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 77 | requestData['nodes'] = [nodeName] |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 78 | common.infoMsg("Making PUT to ${worpApi.url}/environment/${cloudId}/nodes/ with ${requestData}") |
| 79 | nodeId = http.restCall(worpApi, "/environment/${cloudId}/nodes/", "PUT", requestData)['uuid'] |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | if (! nodeId ) { |
| 83 | // Get available nodes in our environment |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 84 | common.infoMsg("Making GET to ${worpApi.url}/environment/${cloudId}/nodes/") |
| 85 | nodes = http.restGet(worpApi, "/environment/${cloudId}/nodes/") |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 86 | for (node in nodes) { |
| 87 | if (node['name'] == nodeName) { |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 88 | nodeId = node['uuid'] |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 89 | break |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // Node wasn't presented, let's create it |
| 95 | if (! nodeId ) { |
| 96 | // Create node |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 97 | requestData = [:] |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 98 | requestData['nodes'] = [nodeName] |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 99 | common.infoMsg("Making PUT to ${worpApi.url}/environment/${cloudId}/nodes/ with ${requestData}") |
| 100 | nodeId = http.restCall(worpApi, "/environment/${cloudId}/nodes/", "PUT", requestData)['uuid'] |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 101 | } |
| 102 | |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 103 | // Create report if needed |
| 104 | if (! reportId ) { |
| 105 | requestData = [:] |
| 106 | requestData['env_uuid'] = cloudId |
| 107 | common.infoMsg("Making POST to ${worpApi.url}/reports/${reportType}/ with ${requestData}") |
| 108 | reportId = http.restPost(worpApi, "/reports/${reportType}/", requestData)['report']['uuid'] |
| 109 | } |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 110 | |
| 111 | // Upload results |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 112 | // NOTE(pas-ha) results should already be a dict with 'results' key |
| 113 | requestData = common.parseJSON(results) |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 114 | requestData['node_name'] = nodeName |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 115 | common.infoMsg("First result in results to PUT is ${requestData['results'][0]}") |
| 116 | // NOTE(pas-ha) not logging whole results to be sent, is too large and just spams the logs |
| 117 | common.infoMsg("Making PUT to ${worpApi.url}/reports/${reportType}/${reportId}/ with node name ${requestData['node_name']} and results") |
| 118 | http.restCall(worpApi, "/reports/${reportType}/${reportId}/", "PUT", requestData) |
| 119 | return reportId |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | |
| 123 | node('python') { |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 124 | def salt = new com.mirantis.mk.Salt() |
| 125 | def python = new com.mirantis.mk.Python() |
| 126 | def common = new com.mirantis.mk.Common() |
| 127 | def http = new com.mirantis.mk.Http() |
| 128 | |
Pavlo Shchelokovskyy | 319e00f | 2018-10-08 17:15:44 +0300 | [diff] [blame^] | 129 | def pepperEnv = 'pepperEnv' |
| 130 | |
| 131 | def benchmarkType = OPENSCAP_TEST_TYPE ?: 'xccdf' |
| 132 | def reportType |
| 133 | def benchmarksDir |
| 134 | |
| 135 | switch (benchmarkType) { |
| 136 | case 'xccdf': |
| 137 | reportType = 'openscap'; |
| 138 | benchmarksDir = XCCDF_BENCHMARKS_DIR ?: '/usr/share/xccdf-benchmarks/mirantis/'; |
| 139 | break; |
| 140 | case 'oval': |
| 141 | reportType = 'cve'; |
| 142 | benchmarksDir = XCCDF_BENCHMARKS_DIR ?: '/usr/share/oval-definitions/mirantis/'; |
| 143 | break; |
| 144 | default: |
| 145 | throw new Exception('Unsupported value for OPENSCAP_TEST_TYPE, must be "oval" or "xccdf".') |
| 146 | } |
| 147 | // XCCDF related variables |
| 148 | def benchmarksAndProfilesArray = XCCDF_BENCHMARKS.tokenize(';') |
| 149 | def xccdfVersion = XCCDF_VERSION ?: '1.2' |
| 150 | def xccdfTailoringId = XCCDF_TAILORING_ID ?: 'None' |
| 151 | def targetServers = TARGET_SERVERS ?: '*' |
| 152 | |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 153 | // To have an ability to work in heavy concurrency conditions |
| 154 | def scanUUID = UUID.randomUUID().toString() |
| 155 | |
| 156 | def artifactsArchiveName = "openscap-${scanUUID}.zip" |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 157 | def resultsBaseDir = "/var/log/openscap/${scanUUID}" |
| 158 | def artifactsDir = "openscap" |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 159 | |
| 160 | def liveMinions |
| 161 | |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 162 | |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 163 | stage ('Setup virtualenv for Pepper') { |
| 164 | python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
| 165 | } |
| 166 | |
Pavlo Shchelokovskyy | 319e00f | 2018-10-08 17:15:44 +0300 | [diff] [blame^] | 167 | stage ('Run openscap evaluation and attempt to upload the results to a dashboard') { |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 168 | liveMinions = salt.getMinions(pepperEnv, targetServers) |
| 169 | |
| 170 | if (liveMinions.isEmpty()) { |
| 171 | throw new Exception('There are no alive minions') |
| 172 | } |
| 173 | |
| 174 | common.infoMsg("Scan UUID: ${scanUUID}") |
| 175 | |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 176 | // Clean all results before proceeding with results from every minion |
| 177 | dir(artifactsDir) { |
| 178 | deleteDir() |
| 179 | } |
| 180 | |
Pavlo Shchelokovskyy | f1b99b0 | 2018-10-02 20:31:17 +0300 | [diff] [blame] | 181 | def reportId |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 182 | // Iterate oscap evaluation over the benchmarks |
| 183 | for (benchmark in benchmarksAndProfilesArray) { |
| 184 | def (benchmarkFilePath, profile) = benchmark.tokenize(',').collect({it.trim()}) |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 185 | |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 186 | // Remove extension from the benchmark name |
| 187 | def benchmarkPathWithoutExtension = benchmarkFilePath.replaceFirst('[.][^.]+$', '') |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 188 | |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 189 | // Get benchmark name |
| 190 | def benchmarkName = benchmarkPathWithoutExtension.tokenize('/')[-1] |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 191 | |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 192 | // And build resultsDir based on this path |
| 193 | def resultsDir = "${resultsBaseDir}/${benchmarkPathWithoutExtension}" |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 194 | |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 195 | def benchmarkFile = "${benchmarksDir}${benchmarkFilePath}" |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 196 | |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 197 | // Evaluate the benchmark on all minions at once |
| 198 | salt.runSaltProcessStep(pepperEnv, targetServers, 'oscap.eval', [ |
Pavlo Shchelokovskyy | 319e00f | 2018-10-08 17:15:44 +0300 | [diff] [blame^] | 199 | benchmarkType, benchmarkFile, "results_dir=${resultsDir}", |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 200 | "profile=${profile}", "xccdf_version=${xccdfVersion}", |
| 201 | "tailoring_id=${xccdfTailoringId}" |
| 202 | ]) |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 203 | // fetch, store and publish results one by one |
| 204 | for (minion in liveMinions) { |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 205 | |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 206 | def nodeShortName = minion.tokenize('.')[0] |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 207 | def archiveName = "${scanUUID}_${nodeShortName}_${benchmarkName}.tar" |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 208 | def localResultsDir = "${artifactsDir}/${scanUUID}/${nodeShortName}" |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 209 | |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 210 | // TODO(pas-ha) when using Salt >= 2017.7.0, use file.read(path) module |
| 211 | // also investigate compressing to gz/xz and reading with binary=True (for less traffic) |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 212 | salt.cmdRun(pepperEnv, minion, "tar -cf /tmp/${archiveName} -C ${resultsBaseDir} .") |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 213 | fileContents = salt.getFileContent(pepperEnv, minion, "/tmp/${archiveName}", true, null, false) |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 214 | |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 215 | sh "mkdir -p ${localResultsDir}" |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 216 | writeFile file: "${archiveName}", text: fileContents |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 217 | sh "tar --strip-components 1 -xf ${archiveName} --directory ${localResultsDir}; rm -f ${archiveName}" |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 218 | |
| 219 | // Remove archive which is not needed anymore |
| 220 | salt.runSaltProcessStep(pepperEnv, minion, 'file.remove', "/tmp/${archiveName}") |
| 221 | |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 222 | // Attempt to upload the scanning results to the dashboard |
| 223 | if (UPLOAD_TO_DASHBOARD.toBoolean()) { |
| 224 | if (common.validInputParam('DASHBOARD_API_URL')) { |
| 225 | def cloudName = salt.getGrain(pepperEnv, minion, 'domain')['return'][0].values()[0].values()[0] |
Pavlo Shchelokovskyy | 82117e4 | 2018-10-03 19:48:56 +0300 | [diff] [blame] | 226 | def nodeResults = readFile "${localResultsDir}/${benchmarkPathWithoutExtension}/results.json" |
Pavlo Shchelokovskyy | 319e00f | 2018-10-08 17:15:44 +0300 | [diff] [blame^] | 227 | reportId = uploadResultToDashboard(DASHBOARD_API_URL, cloudName, minion, reportType, reportId, nodeResults) |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 228 | } else { |
| 229 | throw new Exception('Uploading to the dashboard is enabled but the DASHBOARD_API_URL was not set') |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | } |
Ivan Udovichenko | d1bd28c | 2018-10-02 12:41:04 +0300 | [diff] [blame] | 234 | |
| 235 | // Prepare archive |
| 236 | sh "tar -cJf ${artifactsDir}.tar.xz ${artifactsDir}" |
| 237 | |
| 238 | // Archive the build output artifacts |
| 239 | archiveArtifacts artifacts: "*.xz" |
Vasyl Saienko | 4e8ec64 | 2018-09-17 10:08:08 +0000 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | /* // Will be implemented later |
| 243 | stage ('Attempt to upload results to an artifactory') { |
| 244 | if (common.validInputParam('ARTIFACTORY_URL')) { |
| 245 | for (minion in liveMinions) { |
| 246 | def destDir = "${artifactsDir}/${minion}" |
| 247 | def archiveName = "openscap-${scanUUID}.tar.gz" |
| 248 | def tempArchive = "/tmp/${archiveName}" |
| 249 | def destination = "${destDir}/${archiveName}" |
| 250 | |
| 251 | dir(destDir) { |
| 252 | // Archive scanning results on the remote target |
| 253 | salt.runSaltProcessStep(pepperEnv, minion, 'archive.tar', ['czf', tempArchive, resultsBaseDir]) |
| 254 | |
| 255 | // Get it content and save it |
| 256 | writeFile file: destination, text: salt.getFileContent(pepperEnv, minion, tempArchive) |
| 257 | |
| 258 | // Remove scanning results and the temp archive on the remote target |
| 259 | salt.runSaltProcessStep(pepperEnv, minion, 'file.remove', resultsBaseDir) |
| 260 | salt.runSaltProcessStep(pepperEnv, minion, 'file.remove', tempArchive) |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | def artifactory = new com.mirantis.mcp.MCPArtifactory() |
| 265 | def artifactoryName = 'mcp-ci' |
| 266 | def artifactoryRepo = ARTIFACTORY_REPO ?: 'binary-dev-local' |
| 267 | def artifactoryNamespace = ARTIFACTORY_NAMESPACE ?: 'mirantis/openscap' |
| 268 | def artifactoryServer = Artifactory.server(artifactoryName) |
| 269 | def publishInfo = true |
| 270 | def buildInfo = Artifactory.newBuildInfo() |
| 271 | def zipName = "${env.WORKSPACE}/openscap/${scanUUID}/results.zip" |
| 272 | |
| 273 | // Zip scan results |
| 274 | zip zipFile: zipName, archive: false, dir: artifactsDir |
| 275 | |
| 276 | // Mandatory and additional properties |
| 277 | def properties = artifactory.getBinaryBuildProperties([ |
| 278 | "scanUuid=${scanUUID}", |
| 279 | "project=openscap" |
| 280 | ]) |
| 281 | |
| 282 | // Build Artifactory spec object |
| 283 | def uploadSpec = """{ |
| 284 | "files": |
| 285 | [ |
| 286 | { |
| 287 | "pattern": "${zipName}", |
| 288 | "target": "${artifactoryRepo}/${artifactoryNamespace}/openscap", |
| 289 | "props": "${properties}" |
| 290 | } |
| 291 | ] |
| 292 | }""" |
| 293 | |
| 294 | // Upload artifacts to the given Artifactory |
| 295 | artifactory.uploadBinariesToArtifactory(artifactoryServer, buildInfo, uploadSpec, publishInfo) |
| 296 | |
| 297 | } else { |
| 298 | common.warningMsg('ARTIFACTORY_URL was not given, skip uploading to artifactory') |
| 299 | } |
| 300 | } |
| 301 | */ |
| 302 | |
| 303 | } |