Initial structure and basic funtions
* Create initial repository structure
* Add gerritPatchsetCheckout and runTox global functions
Change-Id: I3c716e12dec76bb405d33501bc260425419814be
diff --git a/src/ci/mcp/placeholder b/src/ci/mcp/placeholder
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/ci/mcp/placeholder
diff --git a/vars/gerritPatchsetCheckout.groovy b/vars/gerritPatchsetCheckout.groovy
new file mode 100644
index 0000000..363a256
--- /dev/null
+++ b/vars/gerritPatchsetCheckout.groovy
@@ -0,0 +1,26 @@
+def call(body) {
+ // evaluate the body block, and collect configuration into the object
+ def config = [:]
+ body.resolveStrategy = Closure.DELEGATE_FIRST
+ body.delegate = config
+ body()
+
+ stage("Gerrit Patchset Checkout") {
+ checkout(
+ scm: [
+ $class: 'GitSCM',
+ branches: [[name: "${GERRIT_BRANCH}"]],
+ extensions: [
+ [$class: 'CleanCheckout'],
+ [$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]
+ ],
+ userRemoteConfigs: [[
+ credentialsId: "${config.credentialsId}",
+ name: 'gerrit',
+ url: "ssh://${GERRIT_NAME}@${GERRIT_HOST}:${GERRIT_PORT}/${GERRIT_PROJECT}.git",
+ refspec: "${GERRIT_REFSPEC}"
+ ]]
+ ]
+ )
+ }
+}
diff --git a/vars/gerritPatchsetCheckout.txt b/vars/gerritPatchsetCheckout.txt
new file mode 100644
index 0000000..4575695
--- /dev/null
+++ b/vars/gerritPatchsetCheckout.txt
@@ -0,0 +1,6 @@
+// Usage example
+node {
+ gerritPatchsetCheckout{
+ credentialsId = "credentials-id-string"
+ }
+}
diff --git a/vars/runTox.groovy b/vars/runTox.groovy
new file mode 100644
index 0000000..8b3f97c
--- /dev/null
+++ b/vars/runTox.groovy
@@ -0,0 +1,8 @@
+def call(String env=null) {
+ // Run tox with or without specified environment
+ if (env==null) {
+ sh "tox -v"
+ } else {
+ sh "tox -v -e ${env}"
+ }
+}