summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/project_maven.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-01-27 23:17:04 +0100
committerGuido Günther <agx@sigxcpu.org>2014-01-27 23:32:50 +0100
commit04052d8769ae1fdf05f070ff056598e2e58d59d6 (patch)
tree8ec034bd85c0dc22d794ffb8e48a7ee489c862de /jenkins_jobs/modules/project_maven.py
parentb0bd8e029e01f7e154187cb748cdd48bd07dd40e (diff)
downloadpython-jenkins-job-builder-04052d8769ae1fdf05f070ff056598e2e58d59d6.tar.gz
python-jenkins-job-builder-04052d8769ae1fdf05f070ff056598e2e58d59d6.tar.xz
python-jenkins-job-builder-04052d8769ae1fdf05f070ff056598e2e58d59d6.zip
project_maven: allow to set private repository
The values map to these GUI choices * default -> Default * local-to-executor -> Local to the executor * local-to-workspace -> Local to the workspace This is on the project level what the similar option is on the builder level. Change-Id: I90ee3385ee12a46b5ab1eb26e3af1bdbfc36946a
Diffstat (limited to 'jenkins_jobs/modules/project_maven.py')
-rwxr-xr-x[-rw-r--r--]jenkins_jobs/modules/project_maven.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/jenkins_jobs/modules/project_maven.py b/jenkins_jobs/modules/project_maven.py
index 00520306..7dd8a964 100644..100755
--- a/jenkins_jobs/modules/project_maven.py
+++ b/jenkins_jobs/modules/project_maven.py
@@ -30,6 +30,9 @@ in the :ref:`Job` definition.
* **maven-name** (`str`): Installation of maven which should be used.
Not setting ``maven-name`` appears to use the first maven install
defined in the global jenkins config.
+ * **private-repository** ('str'): Whether to use a private maven repository
+ Possible values are `default`, `local-to-workspace` and
+ `local-to-executor`.
* **ignore-upstream-changes** (`bool`): Do not start a build whenever
a SNAPSHOT dependency is built or not. (defaults to true)
* **automatic-archiving** (`bool`): Activate automatic artifact archiving
@@ -59,6 +62,15 @@ import jenkins_jobs.modules.base
class Maven(jenkins_jobs.modules.base.Base):
sequence = 0
+ choices_private_repo = {
+ 'default':
+ 'hudson.maven.local_repo.DefaultLocalRepositoryLocator',
+ 'local-to-workspace':
+ 'hudson.maven.local_repo.PerJobLocalRepositoryLocator',
+ 'local-to-executor':
+ 'hudson.maven.local_repo.PerExecutorLocalRepositoryLocator',
+ }
+
def root_xml(self, data):
xml_parent = XML.Element('maven2-moduleset')
if 'maven' not in data:
@@ -79,6 +91,18 @@ class Maven(jenkins_jobs.modules.base.Base):
if maven_name:
XML.SubElement(xml_parent, 'mavenName').text = maven_name
+ private_repo = data['maven'].get('private-repository')
+ if private_repo:
+ if private_repo not in self.choices_private_repo.keys():
+ raise ValueError('Not a valid private-repository "%s", '
+ 'must be one of "%s"' %
+ (private_repo,
+ ", ".join(self.choices_private_repo.keys())))
+ XML.SubElement(xml_parent,
+ 'localRepository',
+ attrib={'class':
+ self.choices_private_repo[private_repo]})
+
XML.SubElement(xml_parent, 'ignoreUpstremChanges').text = str(
data['maven'].get('ignore-upstream-changes', True)).lower()