[JIRA] (JENKINS-58192) No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.label() is applicable for argument types

10 views
Skip to first unread message

jonkelley@gmail.com (JIRA)

unread,
Jun 25, 2019, 1:17:02 PM6/25/19
to jenkinsc...@googlegroups.com
Jon Kelley created an issue
 
Jenkins / Bug JENKINS-58192
No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.label() is applicable for argument types
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 2019-06-25 17:16
Environment: Job-dsl-plugin: 1.74
Jenkins: 2.176.1
Priority: Minor Minor
Reporter: Jon Kelley

I have defined a job pipeline DSL from SCM according to documentation:

node('master')
{
    withEnv([
        'JENKINS_CREDENTIAL_ID_GITHUB=540d97fc-bcfe-419b-a6a4-dcc1b2b0be0f',
        'GIT_BRANCH=development,
        'GIT_REPO=g...@github.com:x/x.git',
        'GROOVY_SCRIPT_DIR=jenkinsfiles',
        'GROOVY_SCRIPT_FILENAME=dslCreatePipeline.groovy'
    ]){
        stage('Clean Workspace') {
            cleanWs()
        }
        stage('Clone sources') {
            git branch: "${env.GIT_BRANCH}", credentialsId: "${env.JENKINS_CREDENTIAL_ID_GITHUB}", url:  "${env.GIT_REPO}"
        }
        stage("ExecuteDslScripts: ${GROOVY_SCRIPT_FILENAME}") {
            def repos = "a,b,c,d"
            dir("${env.GROOVY_SCRIPT_DIR}") {
                sh "echo CWD is `pwd`"
                // https://github.com/jenkinsci/job-dsl-plugin/wiki/User-Power-Moves
                step([
                    $class: 'ExecuteDslScripts',
                    targets: "${env.GROOVY_SCRIPT_FILENAME}",
                    removedJobAction: 'IGNORE',
                    removedViewAction: 'IGNORE',
                    removedViewAction: 'IGNORE',
                    lookupStrategy: 'SEED_JOB',
                    additionalParameters: [REPO_LIST: "${repos}"]
                ])
            }
        }
    }
}
 

 

This executes my groovy script, which fails when building with the error:
ERROR: (dslCreatePushPipeline.groovy, line 9) No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.label() is applicable for argument types: (java.lang.String) values: [swarm]
 

Here is "dslCreatePipeline.groovy" for reference. If there is proper way to set worker labels, let me know. This works fine when pasting the script into  ""Process job DSL"" box inline so I am assuming there's a bug here.

def repoList = "${REPO_LIST}".trim().replaceAll('"', '').split(",")
println "Generating PR push jobs for the following repos:: $repoList"repoList.each {
  def cookbook = it
  pipelineJob("${cookbook}-PR-push") {
    label('swarm') // this is throwing an error
                   // why does this work without SCM?
    description("Chef push pipeline job")
    properties {
      githubProjectUrl("https://github.com/git_org/${cookbook}/")
    }
    scm {
      git {
        remote {
          github("git_org/${cookbook}", 'ssh')
          refspec('+refs/pull/*:refs/remotes/origin/pr/*')
          credentials('d6f6e9f1-43cb-4ea1-83da-e5581d3f9472')
        }
        branch('${ghprbActualCommit}')
        extensions {
          relativeTargetDirectory("${cookbook}")
        }
        configure { gitScm ->
          gitScm / 'extensions' << 'hudson.plugins.git.extensions.impl.UserExclusion' {
            excludedUsers('doxbot')
          }
        }
      }
    }
    triggers {
      githubPullRequest {
        admin('')
        orgWhitelist(['git_org'])
        triggerPhrase('jenkins push to \\S* \\S*')
        useGitHubHooks()
        onlyTriggerPhrase()
        extensions {
          commitStatus {
            context('Push cookbook pipeline')
            startedStatus()
            statusUrl()
          }
        }
      }
    }
    definition {
      cpsScm {
        lightweight(true)
        scriptPath('workflowPipeline.groovy')
        scm {
          git {
            branch('master')
            remote {
              github("git_org/jenkins-scripts", 'ssh')
              credentials('d6f6e9f1-43cb-4ea1-83da-e5581d3f9472')
            }
          }
        }
      }
    }
  }
}
 
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jonkelley@gmail.com (JIRA)

unread,
Jun 25, 2019, 1:18:02 PM6/25/19
to jenkinsc...@googlegroups.com
Jon Kelley updated an issue
Change By: Jon Kelley
I have defined a job pipeline DSL from SCM according to documentation:
{code:java}

node('master')
{
    withEnv([
        'JENKINS_CREDENTIAL_ID_GITHUB=540d97fc-bcfe-419b-a6a4-dcc1b2b0be0f',
        'GIT_BRANCH=development ' ,

        'GIT_REPO=g...@github.com:x/x.git',
        'GROOVY_SCRIPT_DIR=jenkinsfiles',
        'GROOVY_SCRIPT_FILENAME=dslCreatePipeline.groovy'
    ]){
        stage('Clean Workspace') {
            cleanWs()
        }
        stage('Clone sources') {
            git branch: "${env.GIT_BRANCH}", credentialsId: "${env.JENKINS_CREDENTIAL_ID_GITHUB}", url:  "${env.GIT_REPO}"
        }
        stage("ExecuteDslScripts: ${GROOVY_SCRIPT_FILENAME}") {
            def repos = "a,b,c,d"
            dir("${env.GROOVY_SCRIPT_DIR}") {
                sh "echo CWD is `pwd`"
                // https://github.com/jenkinsci/job-dsl-plugin/wiki/User-Power-Moves
                step([
                    $class: 'ExecuteDslScripts',
                    targets: "${env.GROOVY_SCRIPT_FILENAME}",
                    removedJobAction: 'IGNORE',
                    removedViewAction: 'IGNORE',
                    removedViewAction: 'IGNORE',
                    lookupStrategy: 'SEED_JOB',
                    additionalParameters: [REPO_LIST: "${repos}"]
                ])
            }
        }
    }
}
{code}

 

This executes my groovy script, which fails when building with the error:
ERROR: (dslCreatePushPipeline.groovy, line 9) No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.label() is applicable for argument types: (java.lang.String) values: [swarm]
 

Here is "dslCreatePipeline.groovy" for reference. If there is proper way to set worker labels, let me know. This works fine when pasting the script into  ""Process job DSL"" box inline so I am assuming there's a bug here.
{code:java}
{code}

jonkelley@gmail.com (JIRA)

unread,
Jun 25, 2019, 1:18:04 PM6/25/19
to jenkinsc...@googlegroups.com
                    additionalParameters: [REPO_LIST: "${repos}"] // repos PARAM was created manually

jonkelley@gmail.com (JIRA)

unread,
Jun 25, 2019, 1:19:04 PM6/25/19
to jenkinsc...@googlegroups.com
Jon Kelley updated an issue
I have defined a job pipeline DSL from SCM according to documentation:
{code:java}
node('master')
{
    withEnv([
        'JENKINS_CREDENTIAL_ID_GITHUB=540d97fc-bcfe-419b-a6a4-dcc1b2b0be0f',
        'GIT_BRANCH=development',
        'GIT_REPO=g...@github.com:x/x.git',
        'GROOVY_SCRIPT_DIR=jenkinsfiles',
        'GROOVY_SCRIPT_FILENAME=dslCreatePipeline.groovy'
    ]){
        stage('Clean Workspace') {
            cleanWs()
        }
        stage('Clone sources') {
            git branch: "${env.GIT_BRANCH}", credentialsId: "${env.JENKINS_CREDENTIAL_ID_GITHUB}", url:  "${env.GIT_REPO}"
        }
        stage("ExecuteDslScripts: ${GROOVY_SCRIPT_FILENAME}") {
            def repos = "a,b,c,d"
            dir("${env.GROOVY_SCRIPT_DIR}") {
                sh "echo CWD is `pwd`"
                // https://github.com/jenkinsci/job-dsl-plugin/wiki/User-Power-Moves #use-job-dsl-in-pipeline-scripts

jonkelley@gmail.com (JIRA)

unread,
Jun 25, 2019, 1:54:02 PM6/25/19
to jenkinsc...@googlegroups.com
Jon Kelley updated an issue
Job error:

*No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.label() is applicable for argument types*

 

jonkelley@gmail.com (JIRA)

unread,
Jun 26, 2019, 4:45:02 PM6/26/19
to jenkinsc...@googlegroups.com
Jon Kelley updated an issue
Job error:

*No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.label() is applicable for argument types*

 

I have defined a job pipeline DSL from SCM according to documentation:
{code:java}
node('master')
{
    withEnv([
        'JENKINS_CREDENTIAL_ID_GITHUB= 540d97fc-bcfe-419b-a6a4-dcc1b2b0be0f ',

jonkelley@gmail.com (JIRA)

unread,
Jun 26, 2019, 4:46:02 PM6/26/19
to jenkinsc...@googlegroups.com
Jon Kelley commented on Bug JENKINS-58192
 
Re: No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.label() is applicable for argument types
agent {label 'slave'} 

 

How is 
pipelineJob
suppose to be executed on an agent these days?

This issue appeared upgrading from 1.70 to 1.74.

jonkelley@gmail.com (JIRA)

unread,
Jun 26, 2019, 4:47:02 PM6/26/19
to jenkinsc...@googlegroups.com
Jon Kelley edited a comment on Bug JENKINS-58192
{code:java}
agent {label 'slave'} {code}
 

How is 

* pipelineJob
suppose to be executed on an agent these days? Does it only support master now?

This issue appeared upgrading from
Jenkins job DSL from 1.70 to 1.74.

jonkelley@gmail.com (JIRA)

unread,
Jun 26, 2019, 4:52:02 PM6/26/19
to jenkinsc...@googlegroups.com
Jon Kelley edited a comment on Bug JENKINS-58192
{code:java}
// This won't work either.

agent {label 'slave'} {code}
 

How is *pipelineJob* suppose to be executed on an agent these days? Does it only support master now?


This issue appeared upgrading from Jenkins job DSL from 1.70 to 1.74.

jonkelley@gmail.com (JIRA)

unread,
Jun 26, 2019, 4:53:01 PM6/26/19
to jenkinsc...@googlegroups.com
Jon Kelley edited a comment on Bug JENKINS-58192
{code:java}
// This won't work either.

agent {label 'slave'} {code}
 

How is *pipelineJob* suppose to be executed on an agent these days? Does it only support master now?

This issue appeared upgrading from Jenkins job DSL from 1.70 to 1.74.


We create hundreds of jobs using pipelineJob so it is a lot of manual effort to edit the produced jobs to an agent in the U.I.

mail@daniel-spilker.com (JIRA)

unread,
Jul 3, 2019, 4:34:02 AM7/3/19
to jenkinsc...@googlegroups.com

mail@daniel-spilker.com (JIRA)

unread,
Mar 11, 2020, 9:03:03 AM3/11/20
to jenkinsc...@googlegroups.com
Change By: Daniel Spilker
Status: Fixed but Unreleased Closed
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages