make commit optional
Change-Id: I2022fdd2d3449522fd35fc66445139dfc913cf6a
diff --git a/generate-cookiecutter-products.groovy b/generate-cookiecutter-products.groovy
index 2fd65bc..b97af99 100644
--- a/generate-cookiecutter-products.groovy
+++ b/generate-cookiecutter-products.groovy
@@ -14,6 +14,7 @@
* RECLASS_MODEL_URL Reclass model repo address
* RECLASS_MODEL_CREDENTIALS Credentials to the Reclass model repo.
* RECLASS_MODEL_BRANCH Branch for the template to push to model.
+ * COMMIT_CHANGES Commit model to repo
*
**/
@@ -118,17 +119,19 @@
writeFile(file: nodeFile, text: nodeString)
}
- stage('Inject changes to Reclass model') {
- git.changeGitBranch(modelEnv, targetBranch)
- def outputSource = "${templateOutputDir}/${clusterName}"
- def outputDestination = "${modelEnv}/classes/cluster/${clusterName}"
- sh(returnStdout: true, script: "cp ${outputSource} ${outputDestination} -r")
- git.commitGitChanges(modelEnv, "Added new cluster ${clusterName}")
- archiveArtifacts artifacts: modelEnv
- }
+ if (COMMIT_CHANGES.toBoolean()) {
+ stage('Inject changes to Reclass model') {
+ git.changeGitBranch(modelEnv, targetBranch)
+ def outputSource = "${templateOutputDir}/${clusterName}"
+ def outputDestination = "${modelEnv}/classes/cluster/${clusterName}"
+ sh(returnStdout: true, script: "cp ${outputSource} ${outputDestination} -r")
+ git.commitGitChanges(modelEnv, "Added new cluster ${clusterName}")
+ archiveArtifacts artifacts: modelEnv
+ }
- stage ('Push changes to Reclass model') {
- git.pushGitChanges(modelEnv, targetBranch, 'origin', RECLASS_MODEL_CREDENTIALS)
+ stage ('Push changes to Reclass model') {
+ git.pushGitChanges(modelEnv, targetBranch, 'origin', RECLASS_MODEL_CREDENTIALS)
+ }
}
} catch (Throwable e) {