Pipeline cpsSCM doesn't take url

Viewed 924

I am trying to create pipeline jobs with jenkins dsl. the pipeline job takes the cpsscm if I specify the git url only without branches or credentials. but when I change the brancha nd add credentials, it doesn;t work

pipelineJob("foo"){
           definition {
                cpsSCM {
                    git(GIT_URL,BRANCH)
                     }
                }
}

The above works. but the following doesn't work

 pipelineJob("foobar"){
       definition {
            cpsScm {
                scm{
                    git{
                      branch(BRANCH)
                        remote{
                            credentials('kjsks2304-sid34-234')
                            url(GIT_URL)
                        }
                    }

            }
            scriptPath("JenkinsFile")

            }
        }
    }
}

the credentials is the id in the credentials plugin in jenkins. The git repo I am using is a private bitbucket repository

1 Answers
Related