Refactor structure of Pipeline library

* Moved everything under com.mirantis.mcp package
* Functions are grouped under different files, each with specific
  functionality (e.g Artifactory, Docker, Git, etc)
* Tools.groovy remains as is to avoid breaking existing jobs that
  use it

Next steps:
* Modify existing pipelines to use functions from new package
* Gradually get rid of Tools.groovy

Change-Id: I56386f994666baa1c6db51b27beef4de4284ecb8
diff --git a/src/com/mirantis/mcp/Docker.groovy b/src/com/mirantis/mcp/Docker.groovy
new file mode 100644
index 0000000..230ea73
--- /dev/null
+++ b/src/com/mirantis/mcp/Docker.groovy
@@ -0,0 +1,38 @@
+package com.mirantis.mcp
+
+/**
+ * Add LABEL to the end of the Dockerfile
+ * User can also add some custom properties
+ *
+ * @param dockerfilePath is the path to Dockerfile, the default is ./Dockerfile
+ * @param customProperties a Array of Strings that should be added to mandatory props
+ *        in format ["prop1=value1", "prop2=value2"]
+ * */
+def setDockerfileLabels(String dockerfilePath = "./Dockerfile", ArrayList customProperties = null) {
+
+    if (!fileExists(dockerfilePath)) {
+        throw new RuntimeException("Unable to add LABEL to Dockerfile, ${dockerfilePath} doesn't exists")
+    }
+    echo "Updating ${dockerfilePath}"
+
+    def namespace = "com.mirantis.image-specs."
+    def properties = [
+            "gerritProject=${env.GERRIT_PROJECT}",
+            "gerritChangeNumber=${env.GERRIT_CHANGE_NUMBER}",
+            "gerritPatchsetNumber=${env.GERRIT_PATCHSET_NUMBER}",
+            "gerritChangeId=${env.GERRIT_CHANGE_ID}",
+            "gerritPatchsetRevision=${env.GERRIT_PATCHSET_REVISION}"
+    ]
+
+    if (customProperties != null) {
+        properties.addAll(customProperties)
+    }
+    def common = new com.mirantis.mcp.Common()
+    def metadata = common.constructString(properties, namespace, " ")
+    sh """
+      cat <<EOF>> ${dockerfilePath}
+      # Apply additional build metadata
+      LABEL ${metadata}
+    """
+    return metadata
+}