title: How to set default credentials in Jenkins using Groovy script?
body: <p>I am trying to write my first 'Groovy script' in Jenkins and using SVN</p>
  
  <p>My requirement is to create a 'free style job' from another 'Jenkins job' using groovy</p>
  
  <p>Using the following code, I am able to create a 'free style job' via 'groovy'</p>
  
  <pre><code>import jenkins.model.Jenkins;
  import hudson.model.FreeStyleProject;
  import hudson.tasks.Shell;
  import hudson.triggers.*;
  
  
  def feature_branch = build.buildVariableResolver.resolve("FEATURE_BRANCH")
  
  job = Jenkins.instance.createProject(FreeStyleProject, feature_branch)
  
  job.buildersList.add(new Shell('echo hello world'))
  job.scm = new hudson.scm.SubversionSCM("http://base/branches/mybranche")
  
  job.save()
  </code></pre>
  
  <p>Though the job is created by default 'SCM Credentials' to set to 'None' in the 'newly created job'</p>
  
  <p>1) How can I set the 'default credentials' using groovy from 'Global credentials' ?
  2) How can I add a 'build parameter' via groovy?  Again not much information available on google</p>