summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/config.py
diff options
context:
space:
mode:
authorVicky Chijwani <vickychijwani@gmail.com>2018-05-30 18:20:29 +0530
committerVicky Chijwani <vickychijwani@gmail.com>2018-05-31 20:30:09 +0530
commit75d78b65409632c14577ba0cce74bfe2e6d3765a (patch)
treec10fe49a0b4ad6238fc53ac96e1c2dc4f76f02df /jenkins_jobs/config.py
parent307c09cff3ef030a72859cdc63ce555810af486d (diff)
downloadpython-jenkins-job-builder-75d78b65409632c14577ba0cce74bfe2e6d3765a.tar.gz
python-jenkins-job-builder-75d78b65409632c14577ba0cce74bfe2e6d3765a.tar.xz
python-jenkins-job-builder-75d78b65409632c14577ba0cce74bfe2e6d3765a.zip
Add retain_anchors config option.
If set to True, YAML anchors can be referenced across files, allowing jobs to be composed from bits of YAML defined in separate files. False by default. Story: 2000338 Task: 2547 Change-Id: I034ce3bce0030093cb8d4266dabbdb06d96306d6
Diffstat (limited to 'jenkins_jobs/config.py')
-rw-r--r--jenkins_jobs/config.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/jenkins_jobs/config.py b/jenkins_jobs/config.py
index 7b0c2a1d..ac15852d 100644
--- a/jenkins_jobs/config.py
+++ b/jenkins_jobs/config.py
@@ -41,6 +41,7 @@ recursive=False
exclude=.*
allow_duplicates=False
allow_empty_variables=False
+retain_anchors=False
# other named sections could be used in addition to the implicit [jenkins]
# if you have multiple jenkins servers.
@@ -300,6 +301,13 @@ class JJBConfig(object):
config.has_option('job_builder', 'allow_empty_variables') and
config.getboolean('job_builder', 'allow_empty_variables'))
+ # retain anchors across files?
+ retain_anchors = False
+ if config and config.has_option('job_builder', 'retain_anchors'):
+ retain_anchors = config.getboolean('job_builder',
+ 'retain_anchors')
+ self.yamlparser['retain_anchors'] = retain_anchors
+
def validate(self):
# Inform the user as to what is likely to happen, as they may specify
# a real jenkins instance in test mode to get the plugin info to check