Kivi
Kivi

Reputation: 535

Creating Git Tag to a repository

I am checking out 3 repos and out of which 1 repo is from Github and other 2 are from bitbucket.

While creation of Tags, I want to create it only for the one which was checked out from Github, and not for Bitbucket repos.

I have checkout the first repo in base path, second and third repo are checked out inside a directory and I have copied it outside of it and hence no replacement of contents happened.

But while creating Tag, it is creating it for the First checked out repo, whereas I need to create it for the second repo. Kindly provide your inputs to resolve the issue. Thanks in advance !

checkout([ $class: 'GitSCM', branches: [[name: "master"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: '']], submoduleCfg: [], userRemoteConfigs: [[ credentialsId: 'mycredentials', url: First_REPO_URL ]] ])

checkout([ $class: 'GitSCM', branches: [[name: "mybranchname"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'Repo2'], [$class: 'GitLFSPull']], submoduleCfg: [], userRemoteConfigs: [[ credentialsId: 'mycredentials', url: Second_REPO_URL ]] ])

checkout([ $class: 'GitSCM', branches: [[name: "mybranchname"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'Repo3']], submoduleCfg: [], userRemoteConfigs: [[ credentialsId: 'mycredentials', url: Third_REPO_URL ]] ])

cp -r ${WORKSPACE}/Repo2/* ${WORKSPACE}/
cp -r ${WORKSPACE}/Repo3/* ${WORKSPACE}/

def now = new Date()
def formattedDate = now.format('yyyyMMddHHmmss', TimeZone.getTimeZone('IST'))
echo "Current Time: ${formattedDate}"
withCredentials([usernamePassword(credentialsId: 'mycredentials', usernameVariable: 'Git_USER', passwordVariable: 'Git_PASS')]) {
echo "TAG_NAME : ${formattedDate}"
sh """
    git tag ${formattedDate}
    git push origin --tags 
"""

Upvotes: 0

Views: 39

Answers (0)

Related Questions