Skip to content

Commit

Permalink
enhanced support for the Exclusion Plugin, deprecated support for old…
Browse files Browse the repository at this point in the history
…er versions

[FIXES JENKINS-36683]
  • Loading branch information
daspilker committed Sep 16, 2016
1 parent 830438d commit d1cbde5
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docs/Home.md
Expand Up @@ -28,6 +28,11 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
## Release Notes ## Release Notes
* 1.52 (unreleased) * 1.52 (unreleased)
* Increased the minimum supported Jenkins version to 1.642 * Increased the minimum supported Jenkins version to 1.642
* Enhanced support for the [Exclusion Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Exclusion-Plugin)
([JENKINS-36683](https://issues.jenkins-ci.org/browse/JENKINS-36683))
* Support for the older versions of the
[Exclusion Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Exclusion-Plugin) is deprecated, see
[Migration](Migration#migrating-to-152)
* 1.51 (September 13 2016) * 1.51 (September 13 2016)
* Enhanced support for the [RunDeck Plugin](https://wiki.jenkins-ci.org/display/JENKINS/RunDeck+Plugin) * Enhanced support for the [RunDeck Plugin](https://wiki.jenkins-ci.org/display/JENKINS/RunDeck+Plugin)
([#885](https://github.com/jenkinsci/job-dsl-plugin/pull/885)) ([#885](https://github.com/jenkinsci/job-dsl-plugin/pull/885))
Expand Down
8 changes: 8 additions & 0 deletions docs/Migration.md
@@ -1,3 +1,11 @@
## Migrating to 1.52

### Exclusion

Support for versions older than 0.12 of the
[Exclusion Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Exclusion-Plugin) is [[deprecated|Deprecation-Policy]]
and will be removed.

## Migrating to 1.51 ## Migrating to 1.51


### Rundeck ### Rundeck
Expand Down
@@ -1,6 +1,6 @@
job('example') { job('example') {
wrappers { wrappers {
exclusionResources('first', 'second') exclusionResources('FIRST', 'SECOND')
} }
steps { steps {
criticalBlock { criticalBlock {
Expand Down
Expand Up @@ -690,6 +690,8 @@ class StepContext extends AbstractExtensibleContext {
*/ */
@RequiresPlugin(id = 'Exclusion') @RequiresPlugin(id = 'Exclusion')
void criticalBlock(@DslContext(StepContext) Closure closure) { void criticalBlock(@DslContext(StepContext) Closure closure) {
jobManagement.logPluginDeprecationWarning('Exclusion', '0.12')

StepContext stepContext = new StepContext(jobManagement, item) StepContext stepContext = new StepContext(jobManagement, item)
ContextHelper.executeInContext(closure, stepContext) ContextHelper.executeInContext(closure, stepContext)


Expand Down
Expand Up @@ -462,11 +462,13 @@ class WrapperContext extends AbstractExtensibleContext {
*/ */
@RequiresPlugin(id = 'Exclusion') @RequiresPlugin(id = 'Exclusion')
void exclusionResources(Iterable<String> resourceNames) { void exclusionResources(Iterable<String> resourceNames) {
jobManagement.logPluginDeprecationWarning('Exclusion', '0.12')

wrapperNodes << new NodeBuilder().'org.jvnet.hudson.plugins.exclusion.IdAllocator' { wrapperNodes << new NodeBuilder().'org.jvnet.hudson.plugins.exclusion.IdAllocator' {
ids { ids {
resourceNames.each { String resourceName -> resourceNames.each { String resourceName ->
'org.jvnet.hudson.plugins.exclusion.DefaultIdType' { 'org.jvnet.hudson.plugins.exclusion.DefaultIdType' {
name resourceName name(resourceName.toUpperCase(Locale.ENGLISH))
} }
} }
} }
Expand Down
Expand Up @@ -2642,6 +2642,7 @@ class StepContextSpec extends Specification {
context.stepNodes[1].name() == 'hudson.tasks.Shell' context.stepNodes[1].name() == 'hudson.tasks.Shell'
context.stepNodes[2].name() == 'org.jvnet.hudson.plugins.exclusion.CriticalBlockEnd' context.stepNodes[2].name() == 'org.jvnet.hudson.plugins.exclusion.CriticalBlockEnd'
1 * jobManagement.requirePlugin('Exclusion') 1 * jobManagement.requirePlugin('Exclusion')
1 * jobManagement.logPluginDeprecationWarning('Exclusion', '0.12')
} }


def 'call rake method'() { def 'call rake method'() {
Expand Down
Expand Up @@ -1094,9 +1094,10 @@ class WrapperContextSpec extends Specification {
then: then:
with(context.wrapperNodes[0]) { with(context.wrapperNodes[0]) {
name() == 'org.jvnet.hudson.plugins.exclusion.IdAllocator' name() == 'org.jvnet.hudson.plugins.exclusion.IdAllocator'
ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[0].name[0].value() == 'first' ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[0].name[0].value() == 'FIRST'
} }
(1.._) * mockJobManagement.requirePlugin('Exclusion') (1.._) * mockJobManagement.requirePlugin('Exclusion')
1 * mockJobManagement.logPluginDeprecationWarning('Exclusion', '0.12')
} }


def 'call exclusion with multiple args'() { def 'call exclusion with multiple args'() {
Expand All @@ -1106,11 +1107,12 @@ class WrapperContextSpec extends Specification {
then: then:
with(context.wrapperNodes[0]) { with(context.wrapperNodes[0]) {
name() == 'org.jvnet.hudson.plugins.exclusion.IdAllocator' name() == 'org.jvnet.hudson.plugins.exclusion.IdAllocator'
ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[0].name[0].value() == 'first' ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[0].name[0].value() == 'FIRST'
ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[1].name[0].value() == 'second' ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[1].name[0].value() == 'SECOND'
ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[2].name[0].value() == 'third' ids[0].'org.jvnet.hudson.plugins.exclusion.DefaultIdType'[2].name[0].value() == 'THIRD'
} }
1 * mockJobManagement.requirePlugin('Exclusion') 1 * mockJobManagement.requirePlugin('Exclusion')
1 * mockJobManagement.logPluginDeprecationWarning('Exclusion', '0.12')
} }


def 'set delivery pipeline version'() { def 'set delivery pipeline version'() {
Expand Down

0 comments on commit d1cbde5

Please sign in to comment.