Implement getBinaryBuildProperties method

1. getBinaryBuildProperties() should be used to define mandatory
properties for binary artifact, which are:

    "gerritProject=${env.GERRIT_PROJECT}",
    "gerritChangeNumber=${env.GERRIT_CHANGE_NUMBER}",
    "gerritPatchsetNumber=${env.GERRIT_PATCHSET_NUMBER}",
    "gerritChangeId=${env.GERRIT_CHANGE_ID}",
    "gitSha=${env.GERRIT_PATCHSET_REVISION}"

2. User can add some custom properties, e.g:

def properties = tools.getBinaryBuildProperties(
   ["test=123",
    "prop1=val1",
     prop2=val2"
   ])

3. The resulting values will be the string in props format with
namespace com.mirantis, e.g:

  gerritProject=asd;gerritChangeNumber=123;gerritChangeId=ddd

4. How to use:

    def tools = new ci.mcp.Tools()
    ...
    def buildInfo = Artifactory.newBuildInfo()
    ...
    def properties = tools.getBinaryBuildProperties()
    ...
    // Create the upload spec.
    def uploadSpec = """{
        "files": [
                {
                    "pattern": "**",
                    "target": "some/target",
                    "props": "${properties}"
                }
            ]
        }"""
    server.upload(uploadSpec, buildInfo)
    server.publishBuildInfo buildInfo

Change-Id: I6dcc879c10b7fccf6dfcd8cb3ce86f52311c1a5a
diff --git a/src/ci/mcp/Tools.groovy b/src/ci/mcp/Tools.groovy
index 2c1986f..6772288 100644
--- a/src/ci/mcp/Tools.groovy
+++ b/src/ci/mcp/Tools.groovy
@@ -3,6 +3,13 @@
 /**
  * https://issues.jenkins-ci.org/browse/JENKINS-26481
  * fix groovy List.collect()
+**/
+@NonCPS
+def constructString(ArrayList options, String keyOption, String separator = " ") {
+  return options.collect{ keyOption + it }.join(separator).replaceAll("\n", "")
+}
+
+/**
  * Build command line options, e.g:
  *    cmd_opts=["a=b", "c=d", "e=f"]
  *    key = "--build-arg "
@@ -15,8 +22,31 @@
  * @param keyOption key that should be added before each option
  * @param separator Separator between key+Option pairs
  */
-
-@NonCPS
 def getCommandBuilder(ArrayList options, String keyOption, String separator = " ") {
-  return options.collect{ keyOption + it }.join(separator).replaceAll("\n", "")
+  return constructString(options, keyOption)
+}
+
+/**
+* Return string of mandatory build properties for binaries
+* User can also add some custom properties
+*
+* @param customProperties a Array of Strings that should be added to mandatory props
+*        in format ["prop1=value1", "prop2=value2"]
+**/
+def getBinaryBuildProperties(ArrayList customProperties) {
+
+  def namespace = "com.mirantis."
+  def properties = [
+    "gerritProject=${env.GERRIT_PROJECT}",
+    "gerritChangeNumber=${env.GERRIT_CHANGE_NUMBER}",
+    "gerritPatchsetNumber=${env.GERRIT_PATCHSET_NUMBER}",
+    "gerritChangeId=${env.GERRIT_CHANGE_ID}",
+    "gitSha=${env.GERRIT_PATCHSET_REVISION}"
+  ]
+
+  if (customProperties){
+    properties.addAll(customProperties)
+  }
+
+  return constructString(properties, namespace, ";")
 }
diff --git a/src/ci/mcp/Tools.txt b/src/ci/mcp/Tools.txt
new file mode 100644
index 0000000..12377b1
--- /dev/null
+++ b/src/ci/mcp/Tools.txt
@@ -0,0 +1,45 @@
+getBinaryBuildProperties
+------------------------
+
+1. getBinaryBuildProperties() should be used to define mandatory
+properties for binary artifact, which are:
+
+    "gerritProject=${env.GERRIT_PROJECT}",
+    "gerritChangeNumber=${env.GERRIT_CHANGE_NUMBER}",
+    "gerritPatchsetNumber=${env.GERRIT_PATCHSET_NUMBER}",
+    "gerritChangeId=${env.GERRIT_CHANGE_ID}",
+    "gitSha=${env.GERRIT_PATCHSET_REVISION}"
+
+2. User can add some custom properties, e.g:
+
+def properties = tools.getBinaryBuildProperties(
+   ["test=123",
+    "prop1=val1",
+     prop2=val2"
+   ])
+
+3. The resulting values will be the string in props format with
+namespace com.mirantis, e.g:
+
+  com.mirantis.gerritProject=asd;com.mirantis.gerritChangeNumber=123;com.mirantis.gerritChangeId=ddd
+
+4. How to use:
+
+    def tools = new ci.mcp.Tools()
+    ...
+    def buildInfo = Artifactory.newBuildInfo()
+    ...
+    def properties = tools.getBinaryBuildProperties()
+    ...
+    // Create the upload spec.
+    def uploadSpec = """{
+        "files": [
+                {
+                    "pattern": "**",
+                    "target": "some/target",
+                    "props": "${properties}"
+                }
+            ]
+        }"""
+    server.upload(uploadSpec, buildInfo)
+    server.publishBuildInfo buildInfo