This commit is contained in:
Dan Hawkins 2019-05-08 18:32:51 +01:00
commit ca6cd91a20
2 changed files with 35 additions and 8 deletions

View file

@ -4,7 +4,7 @@ vc = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
// Prove the existence of the release repo - otherwise there is a large wait to cycle the build to correct the meta data
def registerrepo(meta, String releaserepo, String repoRootSuffix = "") {
if (releaserepo?.trim()) {
vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo", repoRootSuffix)
vc.checkRepoExists(releaserepo)
}
meta.releaseinfo.set(releaserepo)
}

View file

@ -114,6 +114,29 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo
])
}
def checkRepoExists(String gitURL) {
def int result = 0
if (isUnix()) {
result = sh( script: """
git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY
""",
returnStatus: true
)
} else {
result = bat( script: """
@git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY
""",
returnStatus: true
)
}
echo "git ls-remote return result: ${result}"
if (result > 0) {
error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building")
} else {
echo "The release repo: ${gitURL} exists"
}
}
String getSHAFromVersion(String versionFolder) {
dir (versionFolder) {
srcRevision = readFile("gitrevision.txt").trim()
@ -147,13 +170,17 @@ boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) {
def stripgithistory(String rootfolder) {
echo "Stripping git history out of ${rootfolder}"
dir(rootfolder) {
sh """#!/bin/bash
pwd
find . -type d -name ".git" | xargs -iXX rm -rf XX
find . -name ".gitignore" | xargs -iXX rm -rf XX
find . -name ".gitmodules" | xargs -iXX rm -rf XX
find . -iname ".gitattributes" | xargs -iXX rm -rf XX
"""
if (isUnix()) {
sh """#!/bin/bash
pwd
find . -type d -name ".git" | xargs -iXX rm -rf XX
find . -name ".gitignore" | xargs -iXX rm -rf XX
find . -name ".gitmodules" | xargs -iXX rm -rf XX
find . -iname ".gitattributes" | xargs -iXX rm -rf XX
"""
} else {
echo "Not supporting git stripping in Windows at the moment"
}
}
}