Merge commit '66082496ba'
This commit is contained in:
commit
bd1cae3b0f
2 changed files with 20 additions and 15 deletions
|
|
@ -32,11 +32,23 @@ class ProductInfo extends GISJsonSerialised {
|
|||
|
||||
void set(String productname, String subcomponentname, String jirakey) {
|
||||
// Make sure the fields can be used in git tags
|
||||
def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
def int pstatus = 0
|
||||
if (script.isUnix()) {
|
||||
pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
pstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true)
|
||||
}
|
||||
if (pstatus > 0) {
|
||||
script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name")
|
||||
}
|
||||
def int sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
def int sstatus = 0
|
||||
if (script.isUnix()) {
|
||||
sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true)
|
||||
}
|
||||
if (sstatus > 0) {
|
||||
script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,42 +10,35 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
|
|||
def String remoteinfo
|
||||
def String remoteurl
|
||||
dir( gitrootpath) {
|
||||
def int changecount
|
||||
def int changecount = 0
|
||||
if (isUnix()) {
|
||||
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
||||
}
|
||||
else {
|
||||
def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim()
|
||||
changecount = stdout.readLines()[1] as int
|
||||
}
|
||||
changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger()
|
||||
}
|
||||
echo "Change count: ${changecount}"
|
||||
adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1)
|
||||
echo "Adjusted change count: ${adjustedchangecount}"
|
||||
|
||||
if (isUnix()) {
|
||||
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||
}
|
||||
else {
|
||||
def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim()
|
||||
gitrevision = stdout.readLines()[1]
|
||||
gitrevision = bat(returnStdout: true, script: "@git rev-parse HEAD").trim()
|
||||
}
|
||||
echo "Revision: ${gitrevision}"
|
||||
|
||||
if (isUnix()) {
|
||||
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
|
||||
}
|
||||
else {
|
||||
def stdout = bat(returnStdout:true , script: "git remote show origin").trim()
|
||||
remoteinfo = stdout.readLines()[1..-1]
|
||||
remoteinfo = bat(returnStdout: true, script: "@git remote show origin").trim()
|
||||
}
|
||||
echo "Remote info: ${remoteinfo}"
|
||||
|
||||
if (isUnix()) {
|
||||
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
||||
}
|
||||
else {
|
||||
def stdout = bat(returnStdout:true , script: "git config --get remote.origin.url").trim()
|
||||
remoteurl = stdout.readLines()[1]
|
||||
remoteurl = bat(returnStdout: true, script: "@git config --get remote.origin.url").trim()
|
||||
}
|
||||
echo "Remote URL: ${remoteurl}"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue