Merge "Adding nexus-artifact-uploader plugin"

This commit is contained in:
Jenkins 2016-10-21 11:52:06 +00:00 committed by Gerrit Code Review
commit 9c981a1be2
3 changed files with 86 additions and 0 deletions

View File

@ -3616,3 +3616,59 @@ def build_name_setter(registry, xml_parent, data):
]
convert_mapping_to_xml(
build_name_setter, data, mapping, fail_required=True)
def nexus_artifact_uploader(registry, xml_parent, data):
"""yaml: nexus-artifact-uploader
To upload result of a build as an artifact in Nexus without the need of
Maven. Requires the Jenkins :nexus-artifact-uploader:
`Nexus Artifact Uploader Plugin <Nexus+Artifact+Uploader>`.
:arg str protocol: Protocol to use to connect to Nexus (default https)
:arg str nexus_url: Nexus url (without protocol) (default '')
:arg str nexus_user: Username to upload artifact to Nexus (default '')
:arg str nexus_password: Password to upload artifact to Nexus
(default '')
:arg str group_id: GroupId to set for the artifact to upload
(default '')
:arg str artifact_id: ArtifactId to set for the artifact to upload
(default '')
:arg str version: Version to set for the artifact to upload
(default '')
:arg str packaging: Packaging to set for the artifact to upload
(default '')
:arg str type: Type to set for the artifact to upload (default '')
:arg str classifier: Classifier to set for the artifact to upload
(default '')
:arg str repository: In which repository to upload the artifact
(default '')
:arg str file: File which will be the uploaded artifact (default '')
:arg str credentials_id: Credentials to use (instead of password)
(default '')
File Example:
.. literalinclude::
/../../tests/builders/fixtures/nexus-artifact-uploader.yaml
:language: yaml
"""
nexus_artifact_uploader = XML.SubElement(
xml_parent,
'sp.sd.nexusartifactuploader.NexusArtifactUploader')
mapping = [
('protocol', 'protocol', 'https'),
('nexus_url', 'nexusUrl', ''),
('nexus_user', 'nexusUser', ''),
('nexus_password', 'nexusPassword', ''),
('group_id', 'groupId', ''),
('artifact_id', 'artifactId', ''),
('version', 'version', ''),
('packaging', 'packaging', ''),
('type', 'type', ''),
('classifier', 'classifier', ''),
('repository', 'repository', ''),
('file', 'file', ''),
('credentials_id', 'credentialsId', ''),
]
convert_mapping_to_xml(
nexus_artifact_uploader, data, mapping, fail_required=True)

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<sp.sd.nexusartifactuploader.NexusArtifactUploader>
<protocol>https</protocol>
<nexusUrl>nexus.org</nexusUrl>
<nexusUser/>
<nexusPassword/>
<groupId>com.example</groupId>
<artifactId>artifact</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<type>zip</type>
<classifier/>
<repository>my-hosted-repo</repository>
<file>/var/lib/jenkins/workspace/my_job/result.zip</file>
<credentialsId/>
</sp.sd.nexusartifactuploader.NexusArtifactUploader>
</builders>
</project>

View File

@ -0,0 +1,10 @@
builders:
- nexus-artifact-uploader:
nexus_url: 'nexus.org'
group_id: 'com.example'
artifact_id: 'artifact'
version: '1.0'
packaging: 'pom'
type: 'zip'
repository: 'my-hosted-repo'
file: '/var/lib/jenkins/workspace/my_job/result.zip'