Add support for docker-stop-container
Change-Id: I0c93113acdba170d1e2e54f2295819acc7a37d21 Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
This commit is contained in:
parent
4d5397c496
commit
2ac70b93c5
@ -5202,6 +5202,34 @@ def doxygen(registry, xml_parent, data):
|
||||
data.get('keep-all', False)).lower()
|
||||
|
||||
|
||||
def docker_stop_container(registry, xml_parent, data):
|
||||
"""yaml: docker-stop-container
|
||||
This plugin allows removing stopped docker containers.
|
||||
It requires the :jenkins-wiki:`Docker build step plugin
|
||||
<Docker+build+step+plugin>`.
|
||||
|
||||
:arg bool remove-stopped-containers: Boolean value to remove
|
||||
stopped docker containers (default False)
|
||||
|
||||
Minimal Example:
|
||||
.. literalinclude:: /../../tests/
|
||||
publishers/fixtures/docker-stop-container-minimal.yaml
|
||||
|
||||
Full Example:
|
||||
.. literalinclude:: /../../tests/
|
||||
publishers/fixtures/docker-stop-container-full.yaml
|
||||
"""
|
||||
docker_stop_container = XML.SubElement(xml_parent,
|
||||
'com.nirima.jenkins.plugins.docker'
|
||||
'.publisher.DockerPublisherControl')
|
||||
docker_stop_container.set('plugin', 'docker-plugin')
|
||||
mapping = [
|
||||
('remove-stopped-containers', 'remove', False),
|
||||
]
|
||||
helpers.convert_mapping_to_xml(
|
||||
docker_stop_container, data, mapping, fail_required=False)
|
||||
|
||||
|
||||
def sitemonitor(registry, xml_parent, data):
|
||||
"""yaml: sitemonitor
|
||||
This plugin checks the availability of an url.
|
||||
|
8
tests/publishers/fixtures/docker-stop-container-full.xml
Normal file
8
tests/publishers/fixtures/docker-stop-container-full.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<com.nirima.jenkins.plugins.docker.publisher.DockerPublisherControl plugin="docker-plugin">
|
||||
<remove>true</remove>
|
||||
</com.nirima.jenkins.plugins.docker.publisher.DockerPublisherControl>
|
||||
</publishers>
|
||||
</project>
|
@ -0,0 +1,3 @@
|
||||
publishers:
|
||||
- docker-stop-container:
|
||||
remove-stopped-containers: true
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<com.nirima.jenkins.plugins.docker.publisher.DockerPublisherControl plugin="docker-plugin">
|
||||
<remove>false</remove>
|
||||
</com.nirima.jenkins.plugins.docker.publisher.DockerPublisherControl>
|
||||
</publishers>
|
||||
</project>
|
@ -0,0 +1,2 @@
|
||||
publishers:
|
||||
- docker-stop-container
|
Loading…
Reference in New Issue
Block a user