Allow to override cloud name in openscap pipeline
When using this pipeline in CI-like enironment, it is desirable to
post subsequent runs on the same configuration under the same cloud name
instead of per-run autogenerated cloud name.
This patch adds a CLOUD_NAME job parameter which, when specified,
overrides the cluster name resolved from salt minions.
Change-Id: I6fff1ec12828525a6dfa75a5dbe9e81e373831c7
Closes-Issue: https://mirantis.jira.com/browse/PROD-26155
diff --git a/test-openscap-pipeline.groovy b/test-openscap-pipeline.groovy
index 7134cfb..9a3483c 100644
--- a/test-openscap-pipeline.groovy
+++ b/test-openscap-pipeline.groovy
@@ -25,6 +25,9 @@
*
* UPLOAD_TO_DASHBOARD Boolean. Upload results to the WORP or not
* DASHBOARD_API_URL The WORP api base url. Mandatory if UPLOAD_TO_DASHBOARD is true
+ * CLOUD_NAME Name of the cloud to post results to dashboard for.
+ If not specified, the internal cloud name resolved from Salt master will be used.
+ Suitable for CI-like use case.
*/
@@ -237,7 +240,12 @@
// Attempt to upload the scanning results to the dashboard
if (UPLOAD_TO_DASHBOARD.toBoolean()) {
if (common.validInputParam('DASHBOARD_API_URL')) {
- def cloudName = salt.getGrain(pepperEnv, minion, 'domain')['return'][0].values()[0].values()[0]
+ def cloudName
+ if (common.validInputParam('CLOUD_NAME')) {
+ cloudName = CLOUD_NAME
+ } else {
+ cloudName = salt.getGrain(pepperEnv, minion, 'domain')['return'][0].values()[0].values()[0]
+ }
try {
def nodeResults = readFile "${benchmarkResultsDir}/results.json"
reportId = uploadResultToDashboard(DASHBOARD_API_URL, cloudName, minion, reportType, reportId, nodeResults)