summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Rockman <kyle.rockman@mac.com>2014-11-12 11:26:53 -0600
committerKyle Rockman <kyle.rockman@mac.com>2014-11-21 08:14:37 -0600
commit009b362968385ce895099ea463965a754b3015b9 (patch)
treed90f43e357fff765f6f3ffeb2f32789ae3027546
parent445c73a298e87b0cf2b04577814d2fd863ca3882 (diff)
downloadpython-jenkins-job-builder-009b362968385ce895099ea463965a754b3015b9.tar.gz
python-jenkins-job-builder-009b362968385ce895099ea463965a754b3015b9.tar.xz
python-jenkins-job-builder-009b362968385ce895099ea463965a754b3015b9.zip
add support to git for changelog against branch
added support for another extension type, and fix how extensions are populated to xml Change-Id: Ic9cf21a268d4ee3fb9b9efdee65c3d49e0cdb31e Signed-off-by: Kyle Rockman <kyle.rockman@mac.com>
-rw-r--r--jenkins_jobs/modules/scm.py24
-rw-r--r--tests/duplicates/fixtures/allow_duplicates001.xml1
-rw-r--r--tests/duplicates/fixtures/allow_macros001.xml1
-rw-r--r--tests/duplicates/fixtures/allow_projects001.xml1
-rw-r--r--tests/duplicates/fixtures/allow_templates001.xml1
-rw-r--r--tests/duplicates/fixtures/duplicates001.xml2
-rw-r--r--tests/duplicates/fixtures/duplicates002.xml2
-rw-r--r--tests/macros/scm/multi-scms001.xml2
-rw-r--r--tests/macros/scm/multi-scms002.xml1
-rw-r--r--tests/macros/scm/scm002.xml1
-rw-r--r--tests/scm/fixtures/git-ignore-notify01.xml1
-rw-r--r--tests/scm/fixtures/git-ignore-notify02.xml1
-rw-r--r--tests/scm/fixtures/git-ignore-notify03.xml1
-rw-r--r--tests/scm/fixtures/git-multiple-remotes.xml1
-rw-r--r--tests/scm/fixtures/git-shallow-clone01.xml1
-rw-r--r--tests/scm/fixtures/git-shallow-clone02.xml1
-rw-r--r--tests/scm/fixtures/git-shallow-clone03.xml1
-rw-r--r--tests/scm/fixtures/git002.xml55
-rw-r--r--tests/scm/fixtures/git002.yaml12
-rw-r--r--tests/scm/fixtures/gitlab.xml1
-rw-r--r--tests/scm/fixtures/local-branch001.xml1
-rw-r--r--tests/scm/fixtures/stash.xml1
-rw-r--r--tests/yamlparser/fixtures/complete001.xml1
-rw-r--r--tests/yamlparser/fixtures/scm_remote_deep_bug.xml1
24 files changed, 112 insertions, 3 deletions
diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py
index 91ae0706..c250d8b4 100644
--- a/jenkins_jobs/modules/scm.py
+++ b/jenkins_jobs/modules/scm.py
@@ -96,7 +96,17 @@ remoteName/\*')
(default 'default')
:arg str git-config-name: Configure name for Git clone (optional)
:arg str git-config-email: Configure email for Git clone (optional)
- :arg str timeout: Timeout for git commands in minutes (optional)
+
+
+ :extensions:
+ :arg dict changelog-against:
+ :changelog-against:
+ * **remote** (`string`) - name of repo that contains branch to
+ create changelog against (default 'origin')
+ * **branch** (`string`) - name of the branch to create
+ create changelog against (default 'master')
+
+ :arg str timeout: Timeout for git commands in minutes (optional)
:browser values:
:auto:
@@ -223,9 +233,17 @@ remoteName/\*')
if 'local-branch' in data:
XML.SubElement(scm, 'localBranch').text = data['local-branch']
+ exts_node = XML.SubElement(scm, 'extensions')
+ if 'changelog-against' in data:
+ ext_name = 'hudson.plugins.git.extensions.impl.ChangelogToBranch'
+ ext = XML.SubElement(exts_node, ext_name)
+ opts = XML.SubElement(ext, 'options')
+ change_remote = data['changelog-against'].get('remote', 'origin')
+ change_branch = data['changelog-against'].get('branch', 'master')
+ XML.SubElement(opts, 'compareRemote').text = change_remote
+ XML.SubElement(opts, 'compareTarget').text = change_branch
if 'timeout' in data:
- ext = XML.SubElement(scm, 'extensions')
- co = XML.SubElement(ext,
+ co = XML.SubElement(exts_node,
'hudson.plugins.git.extensions.impl.'
'CheckoutOption')
XML.SubElement(co, 'timeout').text = str(data['timeout'])
diff --git a/tests/duplicates/fixtures/allow_duplicates001.xml b/tests/duplicates/fixtures/allow_duplicates001.xml
index e059d06c..7bc48b8c 100644
--- a/tests/duplicates/fixtures/allow_duplicates001.xml
+++ b/tests/duplicates/fixtures/allow_duplicates001.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
diff --git a/tests/duplicates/fixtures/allow_macros001.xml b/tests/duplicates/fixtures/allow_macros001.xml
index c24d5721..2fb2b274 100644
--- a/tests/duplicates/fixtures/allow_macros001.xml
+++ b/tests/duplicates/fixtures/allow_macros001.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
diff --git a/tests/duplicates/fixtures/allow_projects001.xml b/tests/duplicates/fixtures/allow_projects001.xml
index 0b4b1a1b..23942c9e 100644
--- a/tests/duplicates/fixtures/allow_projects001.xml
+++ b/tests/duplicates/fixtures/allow_projects001.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
diff --git a/tests/duplicates/fixtures/allow_templates001.xml b/tests/duplicates/fixtures/allow_templates001.xml
index 0b4b1a1b..23942c9e 100644
--- a/tests/duplicates/fixtures/allow_templates001.xml
+++ b/tests/duplicates/fixtures/allow_templates001.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
diff --git a/tests/duplicates/fixtures/duplicates001.xml b/tests/duplicates/fixtures/duplicates001.xml
index 6f2e535a..c7ead7a9 100644
--- a/tests/duplicates/fixtures/duplicates001.xml
+++ b/tests/duplicates/fixtures/duplicates001.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
@@ -91,6 +92,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
diff --git a/tests/duplicates/fixtures/duplicates002.xml b/tests/duplicates/fixtures/duplicates002.xml
index 4c285c54..0dccf9ce 100644
--- a/tests/duplicates/fixtures/duplicates002.xml
+++ b/tests/duplicates/fixtures/duplicates002.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
@@ -91,6 +92,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
diff --git a/tests/macros/scm/multi-scms001.xml b/tests/macros/scm/multi-scms001.xml
index 741f9ea1..433e8af4 100644
--- a/tests/macros/scm/multi-scms001.xml
+++ b/tests/macros/scm/multi-scms001.xml
@@ -44,6 +44,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>2</configVersion>
@@ -79,6 +80,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</scms>
</scm>
diff --git a/tests/macros/scm/multi-scms002.xml b/tests/macros/scm/multi-scms002.xml
index 480a4d35..517fe55a 100644
--- a/tests/macros/scm/multi-scms002.xml
+++ b/tests/macros/scm/multi-scms002.xml
@@ -56,6 +56,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</scms>
</scm>
diff --git a/tests/macros/scm/scm002.xml b/tests/macros/scm/scm002.xml
index 3c3c2f46..69df57c6 100644
--- a/tests/macros/scm/scm002.xml
+++ b/tests/macros/scm/scm002.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>
diff --git a/tests/scm/fixtures/git-ignore-notify01.xml b/tests/scm/fixtures/git-ignore-notify01.xml
index 2e3bd0df..32fb2a67 100644
--- a/tests/scm/fixtures/git-ignore-notify01.xml
+++ b/tests/scm/fixtures/git-ignore-notify01.xml
@@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>true</ignoreNotifyCommit>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/git-ignore-notify02.xml b/tests/scm/fixtures/git-ignore-notify02.xml
index 5b43eef7..d2fe74cd 100644
--- a/tests/scm/fixtures/git-ignore-notify02.xml
+++ b/tests/scm/fixtures/git-ignore-notify02.xml
@@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/git-ignore-notify03.xml b/tests/scm/fixtures/git-ignore-notify03.xml
index 5b43eef7..d2fe74cd 100644
--- a/tests/scm/fixtures/git-ignore-notify03.xml
+++ b/tests/scm/fixtures/git-ignore-notify03.xml
@@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/git-multiple-remotes.xml b/tests/scm/fixtures/git-multiple-remotes.xml
index 76a57677..18cbdf6e 100644
--- a/tests/scm/fixtures/git-multiple-remotes.xml
+++ b/tests/scm/fixtures/git-multiple-remotes.xml
@@ -40,5 +40,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/git-shallow-clone01.xml b/tests/scm/fixtures/git-shallow-clone01.xml
index e11a56f2..4fced0d2 100644
--- a/tests/scm/fixtures/git-shallow-clone01.xml
+++ b/tests/scm/fixtures/git-shallow-clone01.xml
@@ -35,5 +35,6 @@
<scmName/>
<useShallowClone>true</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/git-shallow-clone02.xml b/tests/scm/fixtures/git-shallow-clone02.xml
index 5b43eef7..d2fe74cd 100644
--- a/tests/scm/fixtures/git-shallow-clone02.xml
+++ b/tests/scm/fixtures/git-shallow-clone02.xml
@@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/git-shallow-clone03.xml b/tests/scm/fixtures/git-shallow-clone03.xml
index 5b43eef7..d2fe74cd 100644
--- a/tests/scm/fixtures/git-shallow-clone03.xml
+++ b/tests/scm/fixtures/git-shallow-clone03.xml
@@ -34,5 +34,6 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/git002.xml b/tests/scm/fixtures/git002.xml
new file mode 100644
index 00000000..61d9b41c
--- /dev/null
+++ b/tests/scm/fixtures/git002.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <scm class="hudson.plugins.git.GitSCM">
+ <configVersion>2</configVersion>
+ <userRemoteConfigs>
+ <hudson.plugins.git.UserRemoteConfig>
+ <name>origin</name>
+ <refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
+ <url>https://example.com/project.git</url>
+ </hudson.plugins.git.UserRemoteConfig>
+ </userRemoteConfigs>
+ <branches>
+ <hudson.plugins.git.BranchSpec>
+ <name>master</name>
+ </hudson.plugins.git.BranchSpec>
+ <hudson.plugins.git.BranchSpec>
+ <name>stable</name>
+ </hudson.plugins.git.BranchSpec>
+ </branches>
+ <excludedUsers/>
+ <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
+ <disableSubmodules>false</disableSubmodules>
+ <recursiveSubmodules>false</recursiveSubmodules>
+ <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
+ <authorOrCommitter>false</authorOrCommitter>
+ <clean>false</clean>
+ <wipeOutWorkspace>true</wipeOutWorkspace>
+ <pruneBranches>false</pruneBranches>
+ <remotePoll>false</remotePoll>
+ <gitTool>Default</gitTool>
+ <submoduleCfg class="list"/>
+ <relativeTargetDir/>
+ <reference/>
+ <gitConfigName/>
+ <gitConfigEmail/>
+ <skipTag>false</skipTag>
+ <scmName/>
+ <useShallowClone>false</useShallowClone>
+ <ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions>
+ <hudson.plugins.git.extensions.impl.ChangelogToBranch>
+ <options>
+ <compareRemote>origin</compareRemote>
+ <compareTarget>master</compareTarget>
+ </options>
+ </hudson.plugins.git.extensions.impl.ChangelogToBranch>
+ <hudson.plugins.git.extensions.impl.CheckoutOption>
+ <timeout>20</timeout>
+ </hudson.plugins.git.extensions.impl.CheckoutOption>
+ </extensions>
+ <browser class="hudson.plugins.git.browser.GithubWeb">
+ <url>http://github.com/foo/example.git</url>
+ </browser>
+ </scm>
+</project>
diff --git a/tests/scm/fixtures/git002.yaml b/tests/scm/fixtures/git002.yaml
new file mode 100644
index 00000000..9376df58
--- /dev/null
+++ b/tests/scm/fixtures/git002.yaml
@@ -0,0 +1,12 @@
+scm:
+ - git:
+ url: https://example.com/project.git
+ branches:
+ - master
+ - stable
+ browser: githubweb
+ browser-url: http://github.com/foo/example.git
+ timeout: 20
+ changelog-against:
+ remote: origin
+ branch: master
diff --git a/tests/scm/fixtures/gitlab.xml b/tests/scm/fixtures/gitlab.xml
index 5f3cee06..3288d203 100644
--- a/tests/scm/fixtures/gitlab.xml
+++ b/tests/scm/fixtures/gitlab.xml
@@ -34,6 +34,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
<browser class="hudson.plugins.git.browser.GitLab">
<url>https://gitlab.example.com/foo/bar/</url>
<version>5.2</version>
diff --git a/tests/scm/fixtures/local-branch001.xml b/tests/scm/fixtures/local-branch001.xml
index c47b437b..d2d919f2 100644
--- a/tests/scm/fixtures/local-branch001.xml
+++ b/tests/scm/fixtures/local-branch001.xml
@@ -35,5 +35,6 @@
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<localBranch>master</localBranch>
+ <extensions/>
</scm>
</project>
diff --git a/tests/scm/fixtures/stash.xml b/tests/scm/fixtures/stash.xml
index 6c039e4d..f347d2b2 100644
--- a/tests/scm/fixtures/stash.xml
+++ b/tests/scm/fixtures/stash.xml
@@ -34,6 +34,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
<browser class="hudson.plugins.git.browser.Stash">
<url>https://stash.example.com/projects/foo/repos/bar/</url>
</browser>
diff --git a/tests/yamlparser/fixtures/complete001.xml b/tests/yamlparser/fixtures/complete001.xml
index 5e6ee427..6fe64b89 100644
--- a/tests/yamlparser/fixtures/complete001.xml
+++ b/tests/yamlparser/fixtures/complete001.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
<browser class="hudson.plugins.git.browser.GitWeb">
<url>http://review.openstack.org/gitweb?p=openstack-infra/jenkins-job-builder.git</url>
</browser>
diff --git a/tests/yamlparser/fixtures/scm_remote_deep_bug.xml b/tests/yamlparser/fixtures/scm_remote_deep_bug.xml
index b267a116..e80600cc 100644
--- a/tests/yamlparser/fixtures/scm_remote_deep_bug.xml
+++ b/tests/yamlparser/fixtures/scm_remote_deep_bug.xml
@@ -42,6 +42,7 @@
<scmName/>
<useShallowClone>false</useShallowClone>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
+ <extensions/>
</scm>
<builders/>
<publishers/>