[JIRA] (JENKINS-37991) jenkins-dsl-plugin gradle test fails when using new slackNotifier syntax

7 views
Skip to first unread message

cvvs+jenkins@cvvs.us (JIRA)

unread,
Sep 6, 2016, 11:51:03 AM9/6/16
to jenkinsc...@googlegroups.com
C WS created an issue
 
Jenkins / Bug JENKINS-37991
jenkins-dsl-plugin gradle test fails when using new slackNotifier syntax
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 2016/Sep/06 3:50 PM
Environment: Jenkins ver. 1.658
Job-DSL ver. 1.48
Slack Notification Plugin 2.0.1
Labels: dsl
Priority: Minor Minor
Reporter: C WS

I have a seed job definition which is failing gradle test even though it seems to work fine when we use it in Jenkins.

//package master
// GitURL
def gitUrl = 'https://github.com/team/myapp'
def slackRoom = null

job('seed-dsl') {
    description('This seed is updated from the seed-dsl-updater job')
    properties {
        //Set github project URL
        githubProjectUrl(gitUrl)
    }
    ...
    // publishers is another name for post build steps
    publishers {
        mailer('', false, true)
        slackNotifier {
            room(slackRoom)
            notifyAborted(true)
            notifyFailure(true)
            notifyNotBuilt(true)
            notifyUnstable(true)
            notifyBackToNormal(true)
            notifySuccess(false)
            notifyRepeatedFailure(false)
            startNotification(false)
            includeTestSummary(false)
            includeCustomMessage(false)
            customMessage(null)
            buildServerUrl(null)
            sendAs(null)
            commitInfoChoice('NONE')
            teamDomain(null)
            authToken(null)
        }
    }
}

The gradle test command works fine when I comment out the with the slackNotifier declaration, but fail with the following error when it's enabled:

test fail excerpt
Caused by:
        javaposse.jobdsl.dsl.DslScriptException: (script, line 79) No signature of method: javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.slackNotifier() is applicable for argument types: (script$_run_closure1$_closure9$_closure14) values: [script$_run_closure1$_closure9$_closure14@d2392a1]
        Possible solutions: stashNotifier(), stashNotifier(groovy.lang.Closure)
            at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:135)
            at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader_closure1(DslScriptLoader.groovy:78)

full output

According to the migration doc, slackNotifer has been supported since 1.47. In my gradle.build, I'm using 1.48. I see the same errors with plugin version 1.50

gradle.build
ext {
 jobDslVersion = '1.48'
 ...
}
...
// Job DSL plugin including plugin dependencies
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}"
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}@jar"
...

The gradle.build also includes the following, as suggested by the testing docs.

testPlugins 'org.jenkins-ci.plugins:slack:2.0.1'

To reproduce:
Download the seed job into the jobs directory, and run gradle test with the slackNotifier directive enabled. Comment out the slackNotifier directive and observe passing tests.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

cvvs+jenkins@cvvs.us (JIRA)

unread,
Sep 6, 2016, 11:54:01 AM9/6/16
to jenkinsc...@googlegroups.com
C WS updated an issue
Change By: C WS
I have a [seed job definition|https://gist.github.com/cvvs/2451c9444e536b1c60fe9df7d1ea37b8] which is failing gradle test even though it seems to work fine when we use it in Jenkins.

{code}
{code}


The gradle test command works fine when I comment out the with the slackNotifier declaration, but fail with the following error when it's enabled:

{code:title=test fail excerpt}

Caused by:
        javaposse.jobdsl.dsl.DslScriptException: (script, line 79) No signature of method: javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.slackNotifier() is applicable for argument types: (script$_run_closure1$_closure9$_closure14) values: [script$_run_closure1$_closure9$_closure14@d2392a1]
        Possible solutions: stashNotifier(), stashNotifier(groovy.lang.Closure)
            at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:135)
            at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader_closure1(DslScriptLoader.groovy:78)
{code}
[full output|https://gist.github.com/cvvs/dd63b0ea4266f19657081c6770ca3388]

According to the [migration doc|https://github.com/jenkinsci/job-dsl-plugin/blob/master/docs/Migration.md#slack], slackNotifer has been supported since 1.47. In my [gradle.build|https://gist.github.com/cvvs/c5dfd8cc27a2a0b7f017bc21405c980e], I'm using 1.48. I see the same errors with plugin version 1.50
{code:title=gradle.build}

ext {
jobDslVersion = '1.48'
...
}
...
// Job DSL plugin including plugin dependencies
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}"
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}@jar"
...
{code}

The gradle.build also includes the following, as suggested by the [testing docs|https://github.com/jenkinsci/job-dsl-plugin/wiki/Testing-DSL-Scripts].
{code}
testPlugins 'org.jenkins-ci.plugins:slack:2.0.1'
{code}


To reproduce:
Download the seed job into the jobs directory, and run gradle test with the slackNotifier directive enabled. Comment out the slackNotifier directive and observe passing tests.


Note: The job definition fails when ran on the DSL playground, as well.

cvvs+jenkins@cvvs.us (JIRA)

unread,
Sep 6, 2016, 12:47:01 PM9/6/16
to jenkinsc...@googlegroups.com
C WS commented on Bug JENKINS-37991
 
Re: jenkins-dsl-plugin gradle test fails when using new slackNotifier syntax

So after discussion with peers and digging through various wikis, we've come to the conclusion that Automatically Generated DSL isn't testable using gradlew? test

cvvs+jenkins@cvvs.us (JIRA)

unread,
Sep 6, 2016, 1:04:03 PM9/6/16
to jenkinsc...@googlegroups.com
C WS closed an issue as Won't Fix
 
Change By: C WS
Status: Open Closed
Resolution: Won't Fix

mail@daniel-spilker.com (JIRA)

unread,
Sep 13, 2016, 9:30:01 AM9/13/16
to jenkinsc...@googlegroups.com

punnie@ethereal.io (JIRA)

unread,
Nov 21, 2016, 9:17:01 PM11/21/16
to jenkinsc...@googlegroups.com

I have the exact same problem with both slackNotifier (plugin version 2.1) and ghprbTrigger (plugin version 1.33.1). Jenkins version is 2.33.

I have been using the build script at https://github.com/sheehan/job-dsl-gradle-example which is an augmented version of the one you mention.

Tests pass locally and it fail when running in Jenkins, in a seed job that executes the gradle steps as it does locally. Everything works in Jenkins when ignoring the tests.

This did not happen two weeks earlier. I am unsure at this point what I've upgraded, but if you wish to revisit this bug I'll be happy to investigate.

Reply all
Reply to author
Forward
0 new messages