Method for check compatibility with semver

Based on recommended semver regex [1]

[1] https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string

Change-Id: I1299631c9aa556e1b8dff4a2fa80b0dbb9632b7f
Related-Prod: https://mirantis.jira.com/browse/PROD-33012
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index c0059bb..8eee149 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -1023,3 +1023,14 @@
     Random rand = new Random(System.currentTimeMillis())
     return (1..n).collect { pool[rand.nextInt(pool.size())] }.join()
 }
+
+/**
+ * Checks whether string is semver complaint version
+ * @param string version
+*/
+
+def isSemVer(version){
+    // Official regex for Semver2 (https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string)
+    String semVerRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
+    return version ==~ semVerRegex
+}
\ No newline at end of file