diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index eb485521b..33707d42c 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -37,6 +37,31 @@ import jenkins_jobs.modules.base from jenkins_jobs.errors import JenkinsJobsException +def builds_chain_fingerprinter(parser, xml_parent, data): + """yaml: builds-chain-fingerprinter + Builds chain fingerprinter. + Requires the Jenkins `Builds chain fingerprinter Plugin. + `_ + + :arg bool per-builds-chain: enable builds hierarchy fingerprinting + (default False) + :arg bool per-job-chain: enable jobs hierarchy fingerprinting + (default False) + + Example: + + .. literalinclude:: /../../tests/properties/fixtures/fingerprinter.yaml + """ + fingerprinter = XML.SubElement(xml_parent, + 'org.jenkinsci.plugins.' + 'buildschainfingerprinter.' + 'AutomaticFingerprintJobProperty') + XML.SubElement(fingerprinter, 'isPerBuildsChainEnabled').text = str( + data.get('per-builds-chain', False)).lower() + XML.SubElement(fingerprinter, 'isPerJobsChainEnabled').text = str( + data.get('per-job-chain', False)).lower() + + def ownership(parser, xml_parent, data): """yaml: ownership Plugin provides explicit ownership for jobs and slave nodes. diff --git a/setup.py b/setup.py index f14a9a510..cce069bad 100644 --- a/setup.py +++ b/setup.py @@ -80,6 +80,8 @@ setuptools.setup( ('authenticated-build=jenkins_jobs.modules.properties:' 'authenticated_build'), 'authorization=jenkins_jobs.modules.properties:authorization', + ('builds-chain-fingerprinter=jenkins_jobs.modules.properties:' + 'builds_chain_fingerprinter'), 'batch-tasks=jenkins_jobs.modules.properties:batch_tasks', 'build-blocker=jenkins_jobs.modules.properties:build_blocker', 'extended-choice=jenkins_jobs.modules.properties:extended_choice', diff --git a/tests/properties/fixtures/fingerprinter.xml b/tests/properties/fixtures/fingerprinter.xml new file mode 100644 index 000000000..d1ea7089d --- /dev/null +++ b/tests/properties/fixtures/fingerprinter.xml @@ -0,0 +1,9 @@ + + + + + true + true + + + diff --git a/tests/properties/fixtures/fingerprinter.yaml b/tests/properties/fixtures/fingerprinter.yaml new file mode 100644 index 000000000..ee214680f --- /dev/null +++ b/tests/properties/fixtures/fingerprinter.yaml @@ -0,0 +1,4 @@ +properties: + - builds-chain-fingerprinter: + per-builds-chain: true + per-job-chain: true