Merge "[feat][core] manage cloud creds for kaas executor"
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index 65a847e..5027041 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -1143,3 +1143,25 @@
return readYaml(text: kwargs['text'])
}
}
+
+/**
+ * withTempDir runs a block of code inside a new temporary directory.
+ * This temp dir will be removed when finished.
+ * @param: closure Closure - code block to be executed in a tmp directory
+ *
+ * Example:
+ *
+ * withTempDir {
+ * sh "pwd"
+ * }
+ *
+ **/
+void withTempDir(Closure closure) {
+ dir(pwd(tmp: true)) {
+ try {
+ closure()
+ } finally {
+ deleteDir()
+ }
+ }
+}
diff --git a/src/com/mirantis/mk/DockerImageScanner.groovy b/src/com/mirantis/mk/DockerImageScanner.groovy
index 24ed337..6c12bef 100644
--- a/src/com/mirantis/mk/DockerImageScanner.groovy
+++ b/src/com/mirantis/mk/DockerImageScanner.groovy
@@ -187,15 +187,19 @@
image ->
def image_key = image.key.replaceAll(/(^[a-z0-9-.]+.mirantis.(net|com)\/|:.*$)/, '')
// Below change was produced due to other workflow for UCP Docker images (RE-274)
- if (image_key.startsWith('lcm/docker/ucp-')) { jiraNamespace = 'ENGORC' }
+ if (image_key.startsWith('lcm/docker/ucp-')) {
+ jiraNamespace = 'ENGORC'
+ } else {
+ jiraNamespace = 'PRODX'
+ }
jira_summary = "[${image_key}] Found CVEs in Docker image"
- jira_description = "${image.key}\\n"
+ jira_description = "${image.key}\n"
image.value.each{
pkg ->
- jira_description += "__* ${pkg.key}\\n"
+ jira_description += "__* ${pkg.key}\n"
pkg.value.each{
cve ->
- jira_description += "________${cve}\\n"
+ jira_description += "________${cve}\n"
}
}
@@ -204,11 +208,13 @@
def basicIssueJSON = new JsonSlurper().parseText('{"fields": {}}')
basicIssueJSON['fields'] = [
- key:"${jiraNamespace}",
+ project:[
+ key:"${jiraNamespace}"
+ ],
summary:"${jira_summary}",
description:"${jira_description}",
issuetype:[
- name:'BUG'
+ name:'Bug'
],
labels:[
'security',
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index 745f272..6ccd022 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -224,7 +224,8 @@
// Available triggers and its sane defaults
def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master'
def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master'
- def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test:master'
+ def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test'
+ def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master'
def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/)
@@ -232,8 +233,8 @@
if (siTestMatches.size() > 0) {
siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim()
- siTestsDockerImage = "docker-dev-local.docker.mirantis.net/review/" +
- "kaas-si-test-${siTestsRefspec.split('/')[-2]}:${siTestsRefspec.split('/')[-1]}"
+ siTestsDockerImage = "docker-dev-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}"
+ siTestsDockerImageTag = siTestsRefspec.split('/')[-1]
}
if (siPipelinesMatches.size() > 0) {
siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
@@ -242,9 +243,9 @@
common.infoMsg("""
kaas/si-pipelines will be fetched from: ${siPipelinesRefspec}
kaas/si-tests will be fetched from: ${siTestsRefspec}
- kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}
+ kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag}
Keywords: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/""")
- return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage]
+ return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag]
}
/**
@@ -375,6 +376,8 @@
string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines),
string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests),
string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags),
+ string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage),
+ string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag),
string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines),
string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec),
booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled),