title: How to configure dynamic parameters in declarative pipeline (Jenkinsfile)?
body: <p>Using the declarative pipeline syntax, I want to be able to define parameters based on an array of repos, so that when starting the build, the user can check/uncheck the repos that should not be included when the job runs.</p>
  <pre><code>final String[] repos = [
    'one',
    'two',
    'three',
  ]
  
  pipeline {
    parameters {
      booleanParam(name: ...) // static param
  
      // now include a booleanParam for each item in the `repos` array
      // like this but it's not allowed
      script {
        repos.each {
          booleanParam(name: it, defaultValue: true, description: &quot;Include the ${it} repo in the release?&quot;)
        }
      }
    }
  
    // later on, I'll loop through each repo and do stuff only if its value in `params` is `true`
  }
  </code></pre>
  <p>Of course, you can't have a <code>script</code> within the <code>parameters</code> block, so this won't work. How can I achieve this?</p>