Fix Generic Artifactory repository key selection options.
Change-Id: Id564409a3a183ecfe3984fe8b3cf7de3784c99df Co-Authored-By: Steven Armstrong <Steven.9.armstrong@gmail.com>
This commit is contained in:
parent
b52cafb498
commit
211efc5819
@ -1757,8 +1757,13 @@ def artifactory_generic(parser, xml_parent, data):
|
||||
:arg str name: Artifactory user with permissions use for
|
||||
connected to the selected Artifactory Server
|
||||
(default '')
|
||||
:arg str repo-key: Release repository name (default '')
|
||||
:arg str snapshot-repo-key: Snapshots repository name (default '')
|
||||
:arg str repo-key: Release repository name (plugin < 2.3.0) (default '')
|
||||
:arg str snapshot-repo-key: Snapshots repository name (plugin < 2.3.0)
|
||||
(default '')
|
||||
:arg str key-from-select: Repository key to use (plugin >= 2.3.0)
|
||||
(default '')
|
||||
:arg str key-from-text: Repository key to use that can be configured
|
||||
dynamically using Jenkins variables (plugin >= 2.3.0) (default '')
|
||||
:arg list deploy-pattern: List of patterns for mappings
|
||||
build artifacts to published artifacts. Supports Ant-style wildcards
|
||||
mapping to target directories. E.g.: */*.zip=>dir (default [])
|
||||
@ -1800,9 +1805,23 @@ def artifactory_generic(parser, xml_parent, data):
|
||||
details = XML.SubElement(artifactory, 'details')
|
||||
artifactory_common_details(details, data)
|
||||
|
||||
XML.SubElement(details, 'repositoryKey').text = data.get('repo-key', '')
|
||||
XML.SubElement(details, 'snapshotsRepositoryKey').text = data.get(
|
||||
'snapshot-repo-key', '')
|
||||
# Get plugin information to maintain backwards compatibility
|
||||
info = parser.registry.get_plugin_info('artifactory')
|
||||
version = pkg_resources.parse_version(info.get('version', '0'))
|
||||
|
||||
if version >= pkg_resources.parse_version('2.3.0'):
|
||||
deployReleaseRepo = XML.SubElement(details, 'deployReleaseRepository')
|
||||
XML.SubElement(deployReleaseRepo, 'keyFromText').text = data.get(
|
||||
'key-from-text', '')
|
||||
XML.SubElement(deployReleaseRepo, 'keyFromSelect').text = data.get(
|
||||
'key-from-select', '')
|
||||
XML.SubElement(deployReleaseRepo, 'dynamicMode').text = str(
|
||||
'key-from-text' in data.keys()).lower()
|
||||
else:
|
||||
XML.SubElement(details, 'repositoryKey').text = data.get(
|
||||
'repo-key', '')
|
||||
XML.SubElement(details, 'snapshotsRepositoryKey').text = data.get(
|
||||
'snapshot-repo-key', '')
|
||||
|
||||
XML.SubElement(artifactory, 'deployPattern').text = ','.join(data.get(
|
||||
'deploy-pattern', []))
|
||||
|
3
tests/wrappers/fixtures/artifactory004.plugins_info.yaml
Normal file
3
tests/wrappers/fixtures/artifactory004.plugins_info.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
- longName: 'Jenkins Artifactory Plugin'
|
||||
shortName: 'artifactory'
|
||||
version: "2.3.0"
|
27
tests/wrappers/fixtures/artifactory004.xml
Normal file
27
tests/wrappers/fixtures/artifactory004.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<org.jfrog.hudson.generic.ArtifactoryGenericConfigurator>
|
||||
<details>
|
||||
<artifactoryName>test</artifactoryName>
|
||||
<artifactoryUrl>http://artifactory.example.net/artifactory</artifactoryUrl>
|
||||
<deployReleaseRepository>
|
||||
<keyFromText/>
|
||||
<keyFromSelect>repo</keyFromSelect>
|
||||
<dynamicMode>false</dynamicMode>
|
||||
</deployReleaseRepository>
|
||||
</details>
|
||||
<deployPattern>*.zip=>results</deployPattern>
|
||||
<resolvePattern>libs-release-local:prod/*=>prod-jars</resolvePattern>
|
||||
<matrixParams>custom_prop=${PROJECT_ENV_VAR}</matrixParams>
|
||||
<deployBuildInfo>true</deployBuildInfo>
|
||||
<includeEnvVars>true</includeEnvVars>
|
||||
<discardOldBuilds>true</discardOldBuilds>
|
||||
<discardBuildArtifacts>true</discardBuildArtifacts>
|
||||
<envVarsPatterns>
|
||||
<includePatterns>PROJECT_*,ORG_*</includePatterns>
|
||||
<excludePatterns/>
|
||||
</envVarsPatterns>
|
||||
</org.jfrog.hudson.generic.ArtifactoryGenericConfigurator>
|
||||
</buildWrappers>
|
||||
</project>
|
18
tests/wrappers/fixtures/artifactory004.yaml
Normal file
18
tests/wrappers/fixtures/artifactory004.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
wrappers:
|
||||
- artifactory-generic:
|
||||
url: http://artifactory.example.net/artifactory
|
||||
name: 'test'
|
||||
deploy-build-info: true
|
||||
key-from-select: 'repo'
|
||||
deploy-pattern:
|
||||
- '*.zip=>results'
|
||||
resolve-pattern:
|
||||
- 'libs-release-local:prod/*=>prod-jars'
|
||||
matrix-params:
|
||||
- 'custom_prop=${PROJECT_ENV_VAR}'
|
||||
env-vars-include: true
|
||||
env-vars-include-patterns:
|
||||
- 'PROJECT_*'
|
||||
- 'ORG_*'
|
||||
discard-old-builds: true
|
||||
discard-build-artifacts: true
|
Loading…
Reference in New Issue
Block a user