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:
parent
10c5d9e6aa
commit
5548ac51d7
@ -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):
|
||||
|
11
tests/properties/fixtures/copyartifact-multiple.xml
Normal file
11
tests/properties/fixtures/copyartifact-multiple.xml
Normal 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>
|
3
tests/properties/fixtures/copyartifact-multiple.yaml
Normal file
3
tests/properties/fixtures/copyartifact-multiple.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
properties:
|
||||
- copyartifact:
|
||||
projects: foo*,bar
|
Loading…
Reference in New Issue
Block a user