2

I'm trying to setup a Jenkins server with Groovy script:

def repository = 'git@somerepo'
import hudson.tasks.Shell;

job = Jenkins.instance.createProject(FreeStyleProject, 'TestJob')
job.setDescription("Some description")
job.displayName = 'SomeTestJob(TESTING groovy)'

job.scm = new hudson.plugins.git.GitSCM(repository)
job.save()

Now I need to set a repo branch - How do I do this?

Pierre.Vriens
  • 7,225
  • 14
  • 39
  • 84
Alter_so
  • 31
  • 4

1 Answers1

1
def repository = 'git@somerepo' 
import hudson.tasks.Shell
job = Jenkins.instance.createProject(FreeStyleProject, 'TestJob')
job.setDescription("Some description") 
job.displayName = 'SomeTestJob(TESTING groovy)' 
job.scm = new hudson.plugins.git.GitSCM(repository) 
job.scm.branches = [new BranchSpec('*/master')]
job.save()

Thanks a lot Michael Durrant for giving that link !

Alter_so
  • 31
  • 4