summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-09-16 17:50:14 +0000
committerGerrit Code Review <review@openstack.org>2018-09-16 17:50:14 +0000
commitc32bb73d70048a6fac423025efe2ce5560d24282 (patch)
treebfea1d47a678969d7c76893a113bb4bda4756bd0
parent723ca6951c8ae6fec1a23843dfb781cf038dc8a9 (diff)
parent01dc48dcf721609f4af849b060d4511d7a7a1a0c (diff)
Merge "artifactory-generic: Utilize convert_mapping_to_xml"
-rw-r--r--jenkins_jobs/modules/wrappers.py43
-rw-r--r--tests/wrappers/fixtures/artifactory004.xml2
2 files changed, 24 insertions, 21 deletions
diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py
index 04635d6..747f5e4 100644
--- a/jenkins_jobs/modules/wrappers.py
+++ b/jenkins_jobs/modules/wrappers.py
@@ -2341,18 +2341,22 @@ def artifactory_generic(registry, xml_parent, data):
2341 info.get('version', str(sys.maxsize))) 2341 info.get('version', str(sys.maxsize)))
2342 2342
2343 if version >= pkg_resources.parse_version('2.3.0'): 2343 if version >= pkg_resources.parse_version('2.3.0'):
2344 deployReleaseRepo = XML.SubElement(details, 'deployReleaseRepository') 2344 deploy_release_repo = XML.SubElement(
2345 XML.SubElement(deployReleaseRepo, 'keyFromText').text = data.get( 2345 details, 'deployReleaseRepository')
2346 'key-from-text', '') 2346 mapping = [
2347 XML.SubElement(deployReleaseRepo, 'keyFromSelect').text = data.get( 2347 ('key-from-text', 'keyFromText', ''),
2348 'key-from-select', '') 2348 ('key-from-select', 'keyFromSelect', ''),
2349 XML.SubElement(deployReleaseRepo, 'dynamicMode').text = str( 2349 ('key-from-text', 'dynamicMode', ''),
2350 'key-from-text' in data.keys()).lower() 2350 ]
2351 helpers.convert_mapping_to_xml(
2352 deploy_release_repo, data, mapping, fail_required=False)
2351 else: 2353 else:
2352 XML.SubElement(details, 'repositoryKey').text = data.get( 2354 mapping = [
2353 'repo-key', '') 2355 ('repo-key', 'repositoryKey', ''),
2354 XML.SubElement(details, 'snapshotsRepositoryKey').text = data.get( 2356 ('snapshot-repo-key', 'snapshotsRepositoryKey', ''),
2355 'snapshot-repo-key', '') 2357 ]
2358 helpers.convert_mapping_to_xml(
2359 details, data, mapping, fail_required=False)
2356 2360
2357 XML.SubElement(artifactory, 'deployPattern').text = ','.join(data.get( 2361 XML.SubElement(artifactory, 'deployPattern').text = ','.join(data.get(
2358 'deploy-pattern', [])) 2362 'deploy-pattern', []))
@@ -2360,15 +2364,14 @@ def artifactory_generic(registry, xml_parent, data):
2360 data.get('resolve-pattern', [])) 2364 data.get('resolve-pattern', []))
2361 XML.SubElement(artifactory, 'matrixParams').text = ','.join( 2365 XML.SubElement(artifactory, 'matrixParams').text = ','.join(
2362 data.get('matrix-params', [])) 2366 data.get('matrix-params', []))
2363 2367 mapping = [
2364 XML.SubElement(artifactory, 'deployBuildInfo').text = str( 2368 ('deploy-build-info', 'deployBuildInfo', False),
2365 data.get('deploy-build-info', False)).lower() 2369 ('env-vars-include', 'includeEnvVars', False),
2366 XML.SubElement(artifactory, 'includeEnvVars').text = str( 2370 ('discard-old-builds', 'discardOldBuilds', False),
2367 data.get('env-vars-include', False)).lower() 2371 ('discard-build-artifacts', 'discardBuildArtifacts', True),
2368 XML.SubElement(artifactory, 'discardOldBuilds').text = str( 2372 ]
2369 data.get('discard-old-builds', False)).lower() 2373 helpers.convert_mapping_to_xml(
2370 XML.SubElement(artifactory, 'discardBuildArtifacts').text = str( 2374 artifactory, data, mapping, fail_required=False)
2371 data.get('discard-build-artifacts', True)).lower()
2372 2375
2373 # envVarsPatterns 2376 # envVarsPatterns
2374 helpers.artifactory_env_vars_patterns(artifactory, data) 2377 helpers.artifactory_env_vars_patterns(artifactory, data)
diff --git a/tests/wrappers/fixtures/artifactory004.xml b/tests/wrappers/fixtures/artifactory004.xml
index 9878620..f63afae 100644
--- a/tests/wrappers/fixtures/artifactory004.xml
+++ b/tests/wrappers/fixtures/artifactory004.xml
@@ -8,7 +8,7 @@
8 <deployReleaseRepository> 8 <deployReleaseRepository>
9 <keyFromText/> 9 <keyFromText/>
10 <keyFromSelect>repo</keyFromSelect> 10 <keyFromSelect>repo</keyFromSelect>
11 <dynamicMode>false</dynamicMode> 11 <dynamicMode/>
12 </deployReleaseRepository> 12 </deployReleaseRepository>
13 </details> 13 </details>
14 <deployPattern>*.zip=&gt;results</deployPattern> 14 <deployPattern>*.zip=&gt;results</deployPattern>