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/Git.groovy b/src/com/mirantis/mcp/Git.groovy
new file mode 100644
index 0000000..4874084
--- /dev/null
+++ b/src/com/mirantis/mcp/Git.groovy
@@ -0,0 +1,23 @@
+package com.mirantis.mcp
+
+/**
+ * Parse HEAD of current directory and return commit hash
+ */
+def getGitCommit() {
+ git_commit = sh(
+ script: 'git rev-parse HEAD',
+ returnStdout: true
+ ).trim()
+ return git_commit
+}
+
+/**
+ * Describe a commit using the most recent tag reachable from it
+ */
+def getGitDescribe() {
+ git_commit = sh (
+ script: 'git describe --tags',
+ returnStdout: true
+ ).trim()
+ return git_commit
+}