Merge "docker-container: Improve support for more options"

This commit is contained in:
Zuul 2018-09-22 16:14:29 +00:00 committed by Gerrit Code Review
commit 21d902a633
5 changed files with 25 additions and 0 deletions

View File

@ -1100,6 +1100,9 @@ def docker_container(registry, xml_parent, data):
"""yaml: docker-container
Requires the Jenkins: :jenkins-wiki:`Docker Plugin<Docker+Plugin>`.
:arg str docker-registry-url: URL of the Docker registry. (default '')
:arg str credentials-id: Credentials Id for the Docker registey.
(default '')
: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)
@ -1125,6 +1128,14 @@ def docker_container(registry, xml_parent, data):
xml_docker = XML.SubElement(
xml_parent, 'com.nirima.jenkins.plugins.docker.DockerJobProperty')
registry = XML.SubElement(xml_docker, 'registry')
registry.set('plugin', 'docker-commons')
registry_mapping = [
('docker-registry-url', 'url', ''),
('credentials-id', 'credentialsId', ''),
]
helpers.convert_mapping_to_xml(
registry, data, registry_mapping, fail_required=False)
mapping = [
('commit-on-success', 'tagOnCompletion', False),
('additional-tag', 'additionalTag', ''),

View File

@ -2,6 +2,10 @@
<project>
<properties>
<com.nirima.jenkins.plugins.docker.DockerJobProperty>
<registry plugin="docker-commons">
<url>https://index.docker.io/v1/</url>
<credentialsId>71e4f29c-162b-40d0-85d9-3ddfba2911a0</credentialsId>
</registry>
<tagOnCompletion>true</tagOnCompletion>
<additionalTag>latest</additionalTag>
<pushOnSuccess>true</pushOnSuccess>

View File

@ -4,3 +4,5 @@ properties:
additional-tag: latest
push-on-success: true
clean-local-images: true
docker-registry-url: https://index.docker.io/v1/
credentials-id: 71e4f29c-162b-40d0-85d9-3ddfba2911a0

View File

@ -2,6 +2,10 @@
<project>
<properties>
<com.nirima.jenkins.plugins.docker.DockerJobProperty>
<registry plugin="docker-commons">
<url/>
<credentialsId/>
</registry>
<tagOnCompletion>false</tagOnCompletion>
<additionalTag/>
<pushOnSuccess>false</pushOnSuccess>

View File

@ -2,6 +2,10 @@
<project>
<properties>
<com.nirima.jenkins.plugins.docker.DockerJobProperty>
<registry plugin="docker-commons">
<url/>
<credentialsId/>
</registry>
<tagOnCompletion>true</tagOnCompletion>
<additionalTag>my-hands-are-typing-words</additionalTag>
<pushOnSuccess>true</pushOnSuccess>