Merge "Add support for the Jenkins Docker Plugin's.."

This commit is contained in:
Jenkins 2017-07-26 17:04:47 +00:00 committed by Gerrit Code Review
commit 8cfe815e88
7 changed files with 86 additions and 0 deletions

View File

@ -1003,6 +1003,45 @@ def lockable_resources(registry, xml_parent, data):
lockable_resources, data, mapping, fail_required=True) lockable_resources, data, mapping, fail_required=True)
def docker_container(registry, xml_parent, data):
"""yaml: docker-container
Requires the Jenkins: :jenkins-wiki:`Docker Plugin<Docker+Plugin>`.
:arg bool commit-on-success: When a job completes, the docker slave
instance is committed with repository based on the job name and build
number as tag. (default false)
:arg str additional-tag: Additional tag to apply to the docker slave
instance when committing it. (default '')
:arg bool push-on-success: Also push the resulting image when committing
the docker slave instance. (default false)
:arg bool clean-local-images: Clean images from the local daemon after
building. (default true)
Minimal Example:
.. literalinclude::
/../../tests/properties/fixtures/docker-container-minimal.yaml
:language: yaml
Full Example:
.. literalinclude::
/../../tests/properties/fixtures/docker-container-full.yaml
:language: yaml
"""
xml_docker = XML.SubElement(
xml_parent, 'com.nirima.jenkins.plugins.docker.DockerJobProperty')
mapping = [
('commit-on-success', 'tagOnCompletion', False),
('additional-tag', 'additionalTag', ''),
('push-on-success', 'pushOnSuccess', False),
('clean-local-images', 'cleanImages', True)
]
helpers.convert_mapping_to_xml(
xml_docker, data, mapping, fail_required=True)
class Properties(jenkins_jobs.modules.base.Base): class Properties(jenkins_jobs.modules.base.Base):
sequence = 20 sequence = 20

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.nirima.jenkins.plugins.docker.DockerJobProperty>
<tagOnCompletion>true</tagOnCompletion>
<additionalTag>latest</additionalTag>
<pushOnSuccess>true</pushOnSuccess>
<cleanImages>true</cleanImages>
</com.nirima.jenkins.plugins.docker.DockerJobProperty>
</properties>
</project>

View File

@ -0,0 +1,6 @@
properties:
- docker-container:
commit-on-success: true
additional-tag: latest
push-on-success: true
clean-local-images: true

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.nirima.jenkins.plugins.docker.DockerJobProperty>
<tagOnCompletion>false</tagOnCompletion>
<additionalTag/>
<pushOnSuccess>false</pushOnSuccess>
<cleanImages>true</cleanImages>
</com.nirima.jenkins.plugins.docker.DockerJobProperty>
</properties>
</project>

View File

@ -0,0 +1,2 @@
properties:
- docker-container

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.nirima.jenkins.plugins.docker.DockerJobProperty>
<tagOnCompletion>true</tagOnCompletion>
<additionalTag>my-hands-are-typing-words</additionalTag>
<pushOnSuccess>true</pushOnSuccess>
<cleanImages>false</cleanImages>
</com.nirima.jenkins.plugins.docker.DockerJobProperty>
</properties>
</project>

View File

@ -0,0 +1,6 @@
properties:
- docker-container:
commit-on-success: true
additional-tag: my-hands-are-typing-words
push-on-success: true
clean-local-images: false