Search code examples
jenkinsgroovyjenkins-pipelinejenkins-job-dsl

jobDSL does not understand the type of parameters


While creating a Jenkins server, I use jobDSL to create jobs via pipeline.

Basically my created job ressembles this:

pipeline{
   parameters{
      string(name: "SAMPLE_PARAMETER")
   }
   stages{
      stage("Does not matter here"){
         //Does some work
      }
   }
}

When jobDSL tries to create a job out of this, I get an error saying that javaposse.jobdsl.dsl.helpers.BuildParametersContext.stringParam() can only work with (java.lang.string), (java.lang.string, java.lang.string) or (java.lang.string, java.lang.string, java.lang.string) and not with java.util.ArrayList

Can I force the type of "SAMPLE_PARAMETER", and if so how?

If this is not possible, how can I work around this?


Solution

  • As suggested by Matt Schuchard in the comment he posted, I was missing the agent section, adding

    agent any

    fixed my issue. I have no clue how it's related but it fixed it