我正在签出 3 个存储库,其中 1 个存储库来自 Github,另外 2 个来自 bitbucket。创建标签时,我只想为从 Github 签出的标签创建标签,并且...
我正在检查 3 个 repo,其中 1 个 repo 来自 Github,另外 2 个来自 bitbucket。
在创建标签时,我只想为从 Github 签出的标签创建标签,而不是为 Bitbucket 存储库创建标签。
我已经在基本路径中签出了第一个存储库,在目录内签出了第二个和第三个存储库,并且我已将其复制到目录之外,因此没有发生内容替换。
但在创建标签时,它正在为第一个签出的仓库创建标签,而我需要为第二个仓库创建标签。请提供您的意见以解决问题。提前致谢!
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
"""