Add support for the Jenkins Docker Plugin's..
..job configurations. Change-Id: Id29d6e877830e43ca06dde367fc3ca93c85866b6
This commit is contained in:
parent
0328c88755
commit
e4f047895c
@ -1003,6 +1003,45 @@ def lockable_resources(registry, xml_parent, data):
|
||||
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):
|
||||
sequence = 20
|
||||
|
||||
|
11
tests/properties/fixtures/docker-container-full.xml
Normal file
11
tests/properties/fixtures/docker-container-full.xml
Normal 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>
|
6
tests/properties/fixtures/docker-container-full.yaml
Normal file
6
tests/properties/fixtures/docker-container-full.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
properties:
|
||||
- docker-container:
|
||||
commit-on-success: true
|
||||
additional-tag: latest
|
||||
push-on-success: true
|
||||
clean-local-images: true
|
11
tests/properties/fixtures/docker-container-minimal.xml
Normal file
11
tests/properties/fixtures/docker-container-minimal.xml
Normal 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>
|
2
tests/properties/fixtures/docker-container-minimal.yaml
Normal file
2
tests/properties/fixtures/docker-container-minimal.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
properties:
|
||||
- docker-container
|
11
tests/properties/fixtures/docker-container-nondefault.xml
Normal file
11
tests/properties/fixtures/docker-container-nondefault.xml
Normal 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>
|
@ -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
|
Loading…
Reference in New Issue
Block a user