Prevent test-wrapper from running backward compatibility tests on gate mode
Also drop redundant code for checking gate inside test-cookiecutter job, as
now it's checking in test-wrapper.
Change-Id: I227d52a8ecea4b587330370ecd695c377aca82e7
diff --git a/test-cookiecutter-reclass.groovy b/test-cookiecutter-reclass.groovy
index f5f0622..8076041 100644
--- a/test-cookiecutter-reclass.groovy
+++ b/test-cookiecutter-reclass.groovy
@@ -31,7 +31,6 @@
checkIncludeOrder = env.CHECK_INCLUDE_ORDER ?: false
// Global var's
-alreadyMerged = false
gerritConData = [credentialsId : env.CREDENTIALS_ID,
gerritName : env.GERRIT_NAME ?: 'mcp-jenkins',
gerritHost : env.GERRIT_HOST ?: 'gerrit.mcp.mirantis.com',
@@ -114,30 +113,16 @@
def StepPrepareGit(templateEnvFolder, gerrit_data) {
// return git clone object
return {
- def checkouted = false
common.infoMsg("StepPrepareGit: ${gerrit_data}")
// fetch needed sources
dir(templateEnvFolder) {
- if (gerrit_data['gerritRefSpec']) {
- // Those part might be not work,in case manual var's pass
- def gerritChange = gerrit.getGerritChange(gerrit_data['gerritName'], gerrit_data['gerritHost'],
- gerrit_data['GERRIT_CHANGE_NUMBER'], gerrit_data['credentialsId'])
- merged = gerritChange.status == "MERGED"
- if (!merged) {
- checkouted = gerrit.gerritPatchsetCheckout(gerrit_data)
- } else {
- // update global variable for pretty return from pipeline
- alreadyMerged = true
- common.successMsg("Change ${gerrit_data['GERRIT_CHANGE_NUMBER']} is already merged, no need to gate them")
- error('change already merged')
- }
- } else {
+ if (! gerrit_data['gerritRefSpec']) {
// Get clean HEAD
gerrit_data['useGerritTriggerBuildChooser'] = false
- checkouted = gerrit.gerritPatchsetCheckout(gerrit_data)
- if (!checkouted) {
- error("Failed to get repo:${gerrit_data}")
- }
+ }
+ def checkouted = gerrit.gerritPatchsetCheckout(gerrit_data)
+ if (!checkouted) {
+ error("Failed to get repo:${gerrit_data}")
}
}
}
@@ -450,11 +435,6 @@
sh(script: 'find . -mindepth 1 -delete > /dev/null || true')
} catch (Throwable e) {
- if (alreadyMerged) {
- currentBuild.result = 'ABORTED'
- currentBuild.description = "Change ${GERRIT_CHANGE_NUMBER} is already merged, no need to gate them"
- return
- }
currentBuild.result = "FAILURE"
currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
throw e
diff --git a/test-salt-model-wrapper.groovy b/test-salt-model-wrapper.groovy
index 4dfdcd8..b499db1 100644
--- a/test-salt-model-wrapper.groovy
+++ b/test-salt-model-wrapper.groovy
@@ -191,19 +191,20 @@
if (gerritProject == reclassSystemRepo || gerritProject == cookiecutterTemplatesRepo) {
branchJobName = 'test-mk-cookiecutter-templates'
branches[branchJobName] = runTests(branchJobName, yamlJobParameters(buildTestParams))
+ }
+
+ if (!gateMode) {
// testing backward compatibility
if (gerritBranch == 'master' && gerritProject == reclassSystemRepo) {
def backwardCompatibilityRefsToTest = ['proposed', 'release/2018.11.0', 'release/2019.2.0']
for (String oldRef in backwardCompatibilityRefsToTest) {
- buildTestParams['COOKIECUTTER_TEMPLATE_REF'] = ''
- buildTestParams['COOKIECUTTER_TEMPLATE_BRANCH'] = oldRef
- threadName = "${branchJobName}-${oldRef}"
- branches[threadName] = runTests(branchJobName, yamlJobParameters(buildTestParams), threadName)
+ LinkedHashMap buildTestParamsOld = buildTestParams.clone()
+ buildTestParamsOld['COOKIECUTTER_TEMPLATE_REF'] = ''
+ buildTestParamsOld['COOKIECUTTER_TEMPLATE_BRANCH'] = oldRef
+ String threadName = "${branchJobName}-${oldRef}"
+ branches[threadName] = runTests(branchJobName, yamlJobParameters(buildTestParamsOld), threadName)
}
}
- }
-
- if (!gateMode) {
if (gerritProject == cookiecutterTemplatesRepo) {
branchJobName = 'test-drivetrain'
branches[branchJobName] = runTests(branchJobName, yamlJobParameters(buildTestParams))