Merge "Switch to artifact-metadata-app docker image"
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index 2109dcd..ca6af41 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -113,13 +113,11 @@
// Available triggers and its sane defaults
def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master'
- def siTestsFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: ''
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 commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/)
- def siFeatureFlagsMatches = (commitMsg =~ /(\[si-feature-flags\s.*?\])/)
def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/)
if (siTestMatches.size() > 0) {
@@ -127,9 +125,6 @@
siTestsDockerImage = "docker-dev-local.docker.mirantis.net/review/" +
"kaas-si-test-${siTestsRefspec.split('/')[-2]}:${siTestsRefspec.split('/')[-1]}"
}
- if (siFeatureFlagsMatches.size() > 0) {
- siTestsFeatureFlags = siFeatureFlagsMatches[0][0].split('si-feature-flags')[1].replaceAll('[\\[\\]]', '').trim()
- }
if (siPipelinesMatches.size() > 0) {
siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
}
@@ -138,9 +133,38 @@
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 additional feature flags applied: [${siTestsFeatureFlags}]
Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/.git-message-template#59""")
- return [siTests: siTestsRefspec, siFeatureFlags: siTestsFeatureFlags, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage]
+ return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage]
+}
+
+/**
+ * Parse additional configuration for kaas component CICD repo
+ * @param configurationFile (str) path to configuration file in yaml format
+ *
+ * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests,
+ * ]
+ */
+def parseKaaSComponentCIParameters(configurationFile){
+ def common = new com.mirantis.mk.Common()
+ def ciConfig = readYaml file: configurationFile
+ def ciSpec = [
+ siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '',
+ ]
+
+ if (ciConfig.containsKey('si-tests-feature-flags')) {
+ common.infoMsg("""SI tests feature flags customization detected,
+ results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""")
+
+ def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() }
+ ffMeta.addAll(ciConfig['si-tests-feature-flags'])
+
+ ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',')
+ common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}")
+ }
+
+ common.infoMsg("""Additional ci configuration parsed successfully:
+ siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']}""")
+ return ciSpec
}
/**
@@ -188,10 +212,11 @@
* Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/.git-message-template
* Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs
*
- * @param: (string) component name [iam, lcm, stacklight]
- * @param: (string) Patch for kaas/cluster releases in json format
+ * @param: component (string) component name [iam, lcm, stacklight]
+ * @param: patchSpec (string) Patch for kaas/cluster releases in json format
+ * @param: configurationFile (string) Additional file for component repo CI config in yaml format
*/
-def triggerPatchedComponentDemo(component, patchSpec) {
+def triggerPatchedComponentDemo(component, patchSpec, configurationFile = '.ci-parameters.yaml') {
def common = new com.mirantis.mk.Common()
// Determine if custom trigger keywords forwarded from gerrit
def triggers = checkDeploymentTestSuite()
@@ -200,12 +225,25 @@
// Determine Core refspecs
def coreRefspec = checkCustomCoreRefspec()
+ // Determine component repo ci configuration
+ def ciSpec = [:]
+ def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: ''
+ if (fileExists(configurationFile)) {
+ common.infoMsg('Component CI configuration file detected, parsing...')
+ ciSpec = parseKaaSComponentCIParameters(configurationFile)
+ componentFeatureFlags = ciSpec['siTestsFeatureFlags']
+ } else {
+ common.warningMsg('''Component CI configuration file is not exists,
+ several code-management features may be unavailable, follow *link* to create configuration file''')
+ }
+
+
def jobs = [:]
def parameters = [
string(name: 'GERRIT_REFSPEC', value: coreRefspec.core),
string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines),
string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests),
- string(name: 'SI_TESTS_FEATURE_FLAGS', value: siRefspec.siFeatureFlags),
+ string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags),
string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines),
string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec),
booleanParam(name: 'UPGRADE_MGMT', value: triggers.upgradeMgmtEnabled),
@@ -260,3 +298,5 @@
currentBuild.result = 'FAILURE'
}
}
+
+