Properties: fix copyartifact permissions with several projects

The copyartifacts property on Jenkins requires that the config XML
provide an string element for each allowed project. On JJB the
documentation says that the projects needed only to be comma-separated,
however JJB is not doing the job separation.

Parsing the projects string, spliting it by commas and then adding it to
a different string element solves this.

Change-Id: I59d8b2c070f28df4cfa9da0ab58f2c57e4243384
Signed-off-by: Lucas Dutra Nunes <ldnunes@ossystems.com.br>
This commit is contained in:
Lucas Dutra Nunes 2016-06-27 17:43:29 -03:00
parent 10c5d9e6aa
commit 5548ac51d7
3 changed files with 16 additions and 1 deletions

View File

@ -507,7 +507,8 @@ def copyartifact(parser, xml_parent, data):
raise JenkinsJobsException("projects string must exist and "
"not be empty")
projectlist = XML.SubElement(copyartifact, 'projectNameList')
XML.SubElement(projectlist, 'string').text = data.get('projects')
for project in str(data.get('projects')).split(','):
XML.SubElement(projectlist, 'string').text = project
def batch_tasks(parser, xml_parent, data):

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<hudson.plugins.copyartifact.CopyArtifactPermissionProperty plugin="copyartifact">
<projectNameList>
<string>foo*</string>
<string>bar</string>
</projectNameList>
</hudson.plugins.copyartifact.CopyArtifactPermissionProperty>
</properties>
</project>

View File

@ -0,0 +1,3 @@
properties:
- copyartifact:
projects: foo*,bar