Merge "Ability to handle new artifact server"
diff --git a/src/com/mirantis/mcp/MCPArtifactory.groovy b/src/com/mirantis/mcp/MCPArtifactory.groovy
index da6d508..14bd19f 100644
--- a/src/com/mirantis/mcp/MCPArtifactory.groovy
+++ b/src/com/mirantis/mcp/MCPArtifactory.groovy
@@ -607,3 +607,15 @@
}
return artifactsDescription
}
+
+/**
+ * Get artifactory server object
+ *
+ * @param serverName Artifactory server name
+ */
+def getArtifactoryServer(serverName = ''){
+ if (!serverName) {
+ error ("Artifactory serverName must be specified")
+ }
+ return Artifactory.server(serverName)
+}
diff --git a/src/com/mirantis/mk/Git.groovy b/src/com/mirantis/mk/Git.groovy
index 4c06288..17b0cf3 100644
--- a/src/com/mirantis/mk/Git.groovy
+++ b/src/com/mirantis/mk/Git.groovy
@@ -539,6 +539,7 @@
def amend = params.get('amend', false)
def jsonChange = params.get('gerritPatch', [:])
def changeId = params.get('changeId', '')
+ def remote = params.get('remote', 'origin')
def commit
if (!jsonChange) {
@@ -572,7 +573,7 @@
dir(repo){
commit = getGitCommit()
}
- pushForReview(repo, creds, commit, branch, topic)
+ pushForReview(repo, creds, commit, branch, topic, remote)
}
/**
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index ee72758..311b420 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -69,10 +69,13 @@
def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false
def runUie2eNew = env.RUN_UI_E2E_NEW ? env.RUN_UI_E2E_NEW.toBoolean() : false
def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false
+ def runMgmtConformanceNetworkPolicy = env.RUN_MGMT_CFM_NETWORK_POLICY ? env.RUN_MGMT_CFM_NETWORK_POLICY.toBoolean() : false
def runLMATest = env.RUN_LMA_TEST ? env.RUN_LMA_TEST.toBoolean() : false
def runMgmtUserControllerTest = env.RUN_MGMT_USER_CONTROLLER_TEST ? env.RUN_MGMT_USER_CONTROLLER_TEST.toBoolean() : false
def runProxyChildTest = env.RUN_PROXY_CHILD_TEST ? env.RUN_PROXY_CHILD_TEST.toBoolean() : false
def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false
+ def runChildConformanceNetworkPolicy = env.RUN_CHILD_CFM_NETWORK_POLICY ? env.RUN_CHILD_CFM_NETWORK_POLICY.toBoolean() : false
+ def runChildHPA = env.RUN_CHILD_HPA ? env.RUN_CHILD_HPA.toBoolean() : false
def fetchServiceBinaries = env.FETCH_BINARIES_FROM_UPSTREAM ? env.FETCH_BINARIES_FROM_UPSTREAM.toBoolean() : false
def equinixMetalV2ChildDiffMetro = env.EQUINIXMETALV2_CHILD_DIFF_METRO ? env.EQUINIXMETALV2_CHILD_DIFF_METRO.toBoolean() : false
def runMaintenanceTest = env.RUN_MAINTENANCE_TEST ? env.RUN_MAINTENANCE_TEST.toBoolean() : false
@@ -85,6 +88,7 @@
def runChildMachineDeletionPolicyTest = env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST ? env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST.toBoolean() : false
def runChildCustomCertTest = env.RUN_CHILD_CUSTOM_CERT_TEST ? env.RUN_CHILD_CUSTOM_CERT_TEST.toBoolean() : false
def runByoChildCustomCertTest = env.RUN_BYO_CHILD_CUSTOM_CERT_TEST ? env.RUN_BYO_CHILD_CUSTOM_CERT_TEST.toBoolean() : false
+ def runMgmtCustomCacheCertTest = env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST ? env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST.toBoolean() : false
// multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider
def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [
enabled: false,
@@ -118,6 +122,7 @@
def enableFips = env.ENABLE_FIPS ? env.ENABLE_FIPS.toBoolean() : false
def aioCluster = env.AIO_CLUSTER ? env.AIO_CLUSTER.toBoolean() : false
def useVsphereVvmtObjects = env.VSPHERE_USE_VVMT_OBJECTS ? env.VSPHERE_USE_VVMT_OBJECTS.toBoolean() : false
+ def enableBv2Smoke = true
def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) {
@@ -127,7 +132,8 @@
if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) {
seedMacOs = true
}
- if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ || upgradeChild || runChildConformance || runProxyChildTest) {
+ if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ ||
+ upgradeChild || runChildConformance || runProxyChildTest || runChildHPA || runChildConformanceNetworkPolicy) {
deployChild = true
}
if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) {
@@ -207,6 +213,9 @@
if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) {
runMgmtConformance = true
}
+ if (commitMsg ==~ /(?s).*\[mgmt-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm-netpolicy.*/) {
+ runMgmtConformanceNetworkPolicy = true
+ }
if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) {
runMgmtUserControllerTest = true
}
@@ -219,6 +228,14 @@
runChildConformance = true
deployChild = true
}
+ if (commitMsg ==~ /(?s).*\[child-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm-netpolicy.*/) {
+ runChildConformanceNetworkPolicy = true
+ deployChild = true
+ }
+ if (commitMsg ==~ /(?s).*\[child-hpa\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-hpa.*/) {
+ runChildHPA = true
+ deployChild = true
+ }
if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) {
runLMATest = true
enableLMALogging = true
@@ -297,6 +314,13 @@
if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) {
azureOnDemandDemo = true
}
+ if (commitMsg ==~ /(?s).*\[disable-all-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-all-demo\.*/) {
+ enableVsphereDemo = false
+ enableOSDemo = false
+ enableBMDemo = false
+ common.errorMsg('vSphere, BM, Openstack demo deployments will be aborted, VF -1 will be set')
+ }
+
if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) {
enableOSDemo = false
common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set')
@@ -315,6 +339,10 @@
enableVsphereUbuntu = true
common.warningMsg('Ubuntu will be used to deploy vsphere machines')
}
+ if (commitMsg ==~ /(?s).*\[disable-bv2-smoke\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bv2-smoke\.*/) {
+ enableBv2Smoke = false
+ common.errorMsg('Bootstrap v2 smoke checks will be aborted, WF -1 will be set')
+ }
if (commitMsg ==~ /(?s).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) {
enableArtifactsBuild = false
@@ -332,6 +360,12 @@
common.warningMsg('Child cluster deployment will be enabled since custom cert child test suite will be executed')
}
+ if (commitMsg ==~ /(?s).*\[mgmt-custom-cache-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-custom-cache-cert-test\.*/) {
+ runMgmtCustomCacheCertTest = true
+ deployChild = true
+ common.warningMsg('Child cluster deployment will be enabled as the test replaces the mgmt and cluster childcertificates')
+ }
+
if (commitMsg ==~ /(?s).*\[byo-child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-child-custom-cert-test\.*/) {
runByoChildCustomCertTest = true
attachBYO = true
@@ -452,6 +486,8 @@
MOS child deploy scheduled: ${mosDeployChild}
MOS child upgrade scheduled: ${mosUpgradeChild}
Child conformance testing scheduled: ${runChildConformance}
+ Child conformance network policy testing scheduled: ${runChildConformanceNetworkPolicy}
+ Child HPA testing scheduled: ${runChildHPA}
Single BYO cluster attachment scheduled: ${attachBYO}
Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO}
BYO test matrix whole suite scheduled: ${runBYOMatrix}
@@ -461,6 +497,7 @@
Mgmt LMA logging enabled: ${enableLMALogging}
Deploy Os on child with mos release ${deployOsOnMos}
Mgmt conformance testing scheduled: ${runMgmtConformance}
+ Mgmt conformance network policy testing scheduled: ${runMgmtConformanceNetworkPolicy}
LMA testing scheduled: ${runLMATest}
Mgmt user controller testing scheduled: ${runMgmtUserControllerTest}
Mgmt UI e2e testing scheduled: ${runUie2e}
@@ -475,6 +512,7 @@
Child machine deletion policy test: ${runChildMachineDeletionPolicyTest}
Custom cert test for child clusters: ${runChildCustomCertTest}
Custom cert test for Byo child clusters: ${runByoChildCustomCertTest}
+ Custom cache cert test for mgmt and child clusters: ${runMgmtCustomCacheCertTest}
AWS provider deployment scheduled: ${awsOnDemandDemo}
Equinix provider deployment scheduled: ${equinixOnDemandDemo}
EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo}
@@ -497,6 +535,7 @@
Pause for debug enabled: ${pauseForDebug}
AIO cluster: ${aioCluster}
Use Vsphere VVMT Objects: ${useVsphereVvmtObjects}
+ Bootsrap v2 smoke checks enabled: ${enableBv2Smoke}
Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
return [
osCloudLocation : openstackIMC,
@@ -510,6 +549,8 @@
mosDeployChildEnabled : mosDeployChild,
mosUpgradeChildEnabled : mosUpgradeChild,
runChildConformanceEnabled : runChildConformance,
+ runChildConformanceNetworkPolicyEnabled : runChildConformanceNetworkPolicy,
+ runChildHPAEnabled : runChildHPA,
attachBYOEnabled : attachBYO,
upgradeBYOEnabled : upgradeBYO,
runBYOMatrixEnabled : runBYOMatrix,
@@ -521,6 +562,7 @@
runUie2eEnabled : runUie2e,
runUie2eNewEnabled : runUie2eNew,
runMgmtConformanceEnabled : runMgmtConformance,
+ runMgmtConformanceNetworkPolicyEnabled : runMgmtConformanceNetworkPolicy,
runMaintenanceTestEnabled : runMaintenanceTest,
runContainerregistryTestEnabled : runContainerregistryTest,
runGracefulRebootTestEnabled : runGracefulRebootTest,
@@ -529,6 +571,7 @@
runRgnlDeleteMasterTestEnabled : runRgnlDeleteMasterTest,
runChildDeleteMasterTestEnabled : runChildDeleteMasterTest,
runChildCustomCertTestEnabled : runChildCustomCertTest,
+ runMgmtCustomCacheCertTestEnabled : runMgmtCustomCacheCertTest,
runByoChildCustomCertTestEnabled : runByoChildCustomCertTest,
runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest,
runLMATestEnabled : runLMATest,
@@ -555,7 +598,8 @@
equinixMetalV2Metro : equinixMetalV2Metro,
enableFips : enableFips,
aioCluster : aioCluster,
- useVsphereVvmtObjects : useVsphereVvmtObjects]
+ useVsphereVvmtObjects : useVsphereVvmtObjects,
+ bv2SmokeEnabled : enableBv2Smoke]
}
/**
@@ -830,6 +874,7 @@
booleanParam(name: 'DEPLOY_OS_ON_MOS', value: triggers.deployOsOnMosEnabled),
booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled),
booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled),
+ booleanParam(name: 'RUN_MGMT_CFM_NETWORK_POLICY', value: triggers.runMgmtConformanceNetworkPolicyEnabled),
booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnabled),
booleanParam(name: 'RUN_CONTAINER_REGISTRY_TEST', value: triggers.runContainerregistryTestEnabled),
booleanParam(name: 'RUN_GRACEFUL_REBOOT_TEST', value: triggers.runGracefulRebootTestEnabled),
@@ -837,6 +882,7 @@
booleanParam(name: 'RUN_RGNL_DELETE_MASTER_TEST', value: triggers.runRgnlDeleteMasterTestEnabled),
booleanParam(name: 'RUN_CHILD_DELETE_MASTER_TEST', value: triggers.runChildDeleteMasterTestEnabled),
booleanParam(name: 'RUN_CHILD_CUSTOM_CERT_TEST', value: triggers.runChildCustomCertTestEnabled),
+ booleanParam(name: 'RUN_MGMT_CUSTOM_CACHE_CERT_TEST', value: triggers.runMgmtCustomCacheCertTestEnabled),
booleanParam(name: 'RUN_BYO_CHILD_CUSTOM_CERT_TEST', value: triggers.runByoChildCustomCertTestEnabled),
booleanParam(name: 'RUN_CHILD_MACHINE_DELETION_POLICY_TEST', value: triggers.runChildMachineDeletionPolicyTestEnabled),
booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled),
@@ -849,6 +895,8 @@
booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled),
booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled),
booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled),
+ booleanParam(name: 'RUN_CHILD_CFM_NETPOLICY', value: triggers.runChildConformanceNetworkPolicyEnabled),
+ booleanParam(name: 'RUN_CHILD_HPA', value: triggers.runChildHPAEnabled),
booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled),
booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled),
booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled),
@@ -1371,3 +1419,84 @@
// return the least loaded node
return common.SortMapByValueAsc(nodesMap).collect { it.key }[0]
}
+
+
+/**
+ * Get latest tag for test/frontend & equinix-private-infra images
+ * @param version (str) default tag value from main workflow
+ * @param isChanged (bool) is dependent directory files were changed
+ * @param imageName (string) image name for information message
+ * @return: (string) tag name
+ */
+def getImageTag(version, isChanged, imageName) {
+ def common = new com.mirantis.mk.Common()
+ def latestTag = ''
+ if (!(env.GERRIT_EVENT_TYPE in ['change-merged', 'ref-updated']) && isChanged) {
+ latestTag = version
+ } else {
+ if (env.GERRIT_EVENT_TYPE == 'ref-updated') {
+ latestTag = env.GERRIT_REFNAME.replace('refs/tags/v', '').trim()
+ } else {
+ latestTag = env.GERRIT_BRANCH ? env.GERRIT_BRANCH : env.GERRIT_REFSPEC ? env.GERRIT_REFSPEC : 'master'
+ if (latestTag != 'master') {
+ latestTag = latestTag.replaceAll('/', '_')
+ }
+ }
+ }
+ common.infoMsg("${imageName} image will use tag '${latestTag}'")
+ return latestTag
+}
+
+
+/**
+ * Translates set of environment vars into actual replicator command line
+ * @return: (string cmdParams, string jobDescription)
+ * cmdParams - generated command line
+ * jobDescription - job description
+ */
+def genReplicatorCommandLine() {
+ def mainModes = ['REPLICATE', 'CLEANUP', 'CHECK_REPOS', 'BIN_CLEANUP']
+ def parameterWithoutArgument = mainModes
+ def parametersList = parameterWithoutArgument + [
+ 'ARTIFACT_FILTER',
+ 'ARTIFACT_TYPE',
+ 'BIN_CLEAN_KEEP_DAYS',
+ 'BIN_CLEAN_PREFIX',
+ 'DOCKER_TAG',
+ // DST_ will be changed to TARGET_
+ 'DST_REPO',
+ 'DST_REPO_TYPE',
+ 'DST_USER',
+ 'OLDER_THAN_DAYS',
+ 'SLACK_BUILD_URL',
+ 'SLACK_CHANNEL',
+ 'SLACK_USER',
+ 'SRC_REPO',
+ 'SRC_REPO_TYPE',
+ 'SRC_USER',
+ 'SYNC_PATTERN',
+ 'THREAD_COUNT'
+ ]
+ def mainModesDescriptions = [
+ 'REPLICATE': 'Replicating binaries/Docker images',
+ 'CLEANUP': 'Cleaning Docker images',
+ 'BIN_CLEANUP': 'Cleaning binaries',
+ 'CHECK_REPOS': 'Checking binaries'
+ ]
+
+ def cmdParams = ''
+ def jobDescription = ''
+ for (e in parametersList) {
+ if (env[e] == null || env[e] == '') {
+ continue
+ }
+ if (e in mainModes) {
+ jobDescription = mainModesDescriptions[e]
+ }
+ cmdParams += "-${e.replaceAll('_', '-').toLowerCase()} "
+ if (!(e in parameterWithoutArgument)) {
+ cmdParams += "'${env[e]}' "
+ }
+ }
+ return [cmdParams, jobDescription]
+}