Browse Source

fix the Scripts not permitted to use method hudson.plugins.git.GitSCM getUserRemoteConfigs error

pull/1/head
Nicolas Massé 7 years ago
parent
commit
576ca7dd0e
  1. 12
      Jenkinsfile

12
Jenkinsfile

@ -1,20 +1,16 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
import groovy.json.JsonOutput import groovy.json.JsonOutput
def gitRepo = "" def gitRepo = params.GIT_REPO
def gitBranch = params.GIT_BRANCH != null && params.GIT_BRANCH != "" ? params.GIT_BRANCH : "master" def gitBranch = params.GIT_BRANCH != null && params.GIT_BRANCH != "" ? params.GIT_BRANCH : "master"
node('nodejs') { node('nodejs') {
// Get Source Code from SCM (Git) as configured in the Jenkins Project // Get Source Code from SCM (Git) as configured in the Jenkins Project
stage('Checkout Source') { stage('Checkout Source') {
// For Jenkinsfile from GIT // For Jenkinsfile from GIT
if (gitRepo == null || gitRepo == "") { checkout scm
checkout scm // for inline scripts
gitRepo = scm.getUserRemoteConfigs()[0].getUrl() //git url: gitRepo, branch: gitBranch
} else {
// for inline scripts
git url: gitRepo, branch: gitBranch
}
} }
def towerExtraVars = [ def towerExtraVars = [

Loading…
Cancel
Save