LoginSignup
1
0

More than 5 years have passed since last update.

Jenkinsfile で リリース後、リリースタグを作成したい時

Last updated at Posted at 2019-02-05

Jenkinsfile で Tag を Push する

stage 'push tag'

def date = new Date()
def dateFormat = new SimpleDateFormat("yyyyMMddHHmm")
def yyyyMMddHHmm = dateFormat.format(date)

// Jenkinsで「認証情報の追加(GIT_CRDT_ID)」をしておいてください。
withCredentials([[$class: 'UsernamePasswordMultiBinding'
         ,credentialsId: 'GIT_CRDT_ID'
         ,usernameVariable: 'GIT_USER'
         ,passwordVariable: 'GIT_PASS']]) {
  sh "git tag -a ${yyyyMMddHHmm} -m jenkins"
  sh "git push https://${GIT_USER}:${GIT_PASS}@${GIT_URL}.git --tags"
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0