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

changes/82/602982/5
Zuul 4 years ago committed by Gerrit Code Review
commit 21d902a633
  1. 11
      jenkins_jobs/modules/properties.py
  2. 4
      tests/properties/fixtures/docker-container-full.xml
  3. 2
      tests/properties/fixtures/docker-container-full.yaml
  4. 4
      tests/properties/fixtures/docker-container-minimal.xml
  5. 4
      tests/properties/fixtures/docker-container-nondefault.xml

@ -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', ''),

@ -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>

@ -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

@ -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>

@ -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>

Loading…
Cancel
Save