Add test for name defaults overridden by template

JJB currently allows for named defaults to be specified at both the
project and template level. Add a test case that exercises this and
demonstrates that current interpolation ignores variables without
definitions if they are not subsequently used when expanding the
template.

Change-Id: Iffdda9f79c12fb71077bf621f8b08381dbcc9ac1
This commit is contained in:
Darragh Bailey 2015-01-12 17:54:53 +00:00 committed by Wayne
parent fbd432a0ad
commit 3ae187b1a7
2 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>
<displayName>experimental foo</displayName>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<builders/>
<publishers>
<hudson.plugins.emailext.ExtendedEmailPublisher>
<recipientList>dev@example.com</recipientList>
<configuredTriggers>
<hudson.plugins.emailext.plugins.trigger.FailureTrigger>
<email>
<recipientList/>
<subject>$PROJECT_DEFAULT_SUBJECT</subject>
<body>$PROJECT_DEFAULT_CONTENT</body>
<sendToRequester>false</sendToRequester>
<sendToDevelopers>false</sendToDevelopers>
<includeCulprits>false</includeCulprits>
<sendToRecipientList>true</sendToRecipientList>
</email>
</hudson.plugins.emailext.plugins.trigger.FailureTrigger>
</configuredTriggers>
<contentType>default</contentType>
<defaultSubject>$DEFAULT_SUBJECT</defaultSubject>
<defaultContent>$DEFAULT_CONTENT</defaultContent>
<attachmentsPattern/>
<presendScript/>
<attachBuildLog>false</attachBuildLog>
<saveOutput>false</saveOutput>
<replyTo>$DEFAULT_REPLYTO</replyTo>
</hudson.plugins.emailext.ExtendedEmailPublisher>
</publishers>
<buildWrappers/>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>
<displayName>production bar</displayName>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<builders/>
<publishers>
<hudson.tasks.Mailer>
<recipients>qa@example.com</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>
</hudson.tasks.Mailer>
</publishers>
<buildWrappers/>
</project>

View File

@ -0,0 +1,33 @@
- job-template:
name: '{publish}_foo'
display-name: '{publish} foo'
defaults: testdefaults
- job-template:
name: '{publish}_bar'
display-name: '{publish} bar'
defaults: testdefaults
publishers:
- email:
recipients: qa@example.com
- project:
name: dev
publish: 'experimental'
defaults: testdefaults
recipients: dev@example.com
jobs:
- '{publish}_foo'
- project:
name: foobar
publish: 'production'
defaults: testdefaults
jobs:
- '{publish}_bar'
- defaults:
name: testdefaults
publishers:
- email-ext:
recipients: '{recipients}'