Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkout a tag in Jenkins pipeline

Tried using

checkout scm: [$class: 'GitSCM', 
  userRemoteConfigs: [[url: '${repoURL}']], 
  branches: [[name: 'refs/tags/${tag-version}']]],poll: false

This fails with an Authentication error. Is there any way other than using

withCredentials

to checkout tag in a Jenkinsfile

like image 663
rashidcmb Avatar asked Sep 15 '17 14:09

rashidcmb


1 Answers

After spending, hours got here

Correct way to use GitSCM in declarative pipeline is

checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: repoURL, credentialsId: credential]], branches: [[name: tag-version]]],poll: false

Not like I found in most places in web

checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: repoURL], [credentialsId: credential]], branches: [[name: tag-version]]],poll: false

like image 94
rashidcmb Avatar answered Sep 22 '22 20:09

rashidcmb