Convert bat to powershell; Remove debug
This commit is contained in:
parent
d2e5ef51ba
commit
efc2ce75ed
5 changed files with 33 additions and 30 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||||
|
|
||||||
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
|
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
|
||||||
echo "I am here 2"
|
|
||||||
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
|
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13,12 +12,7 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St
|
||||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
||||||
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
|
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
|
||||||
|
|
||||||
echo "I am here 1"
|
|
||||||
|
|
||||||
registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
|
registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
|
||||||
|
|
||||||
echo("I am here 4")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
|
|
||||||
|
|
@ -10,31 +10,41 @@ def comparefiles(importedjsonfile, currentjsonfile) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Jq and diffutils can be installed on windows with chocolatey
|
// Jq and diffutils can be installed on windows with chocolatey
|
||||||
bat """
|
powershell """
|
||||||
REM echo Checking utilities exist
|
# echo Checking utilities exist
|
||||||
REM set
|
# set
|
||||||
REM echo %PATH%
|
# echo %PATH%
|
||||||
where jq
|
try {
|
||||||
if errorlevel 1 EXIT /b 1
|
if (Get-Command jq) {}
|
||||||
where diff
|
}
|
||||||
if errorlevel 1 EXIT /b 1
|
catch {
|
||||||
|
echo "jq is unavailable"
|
||||||
|
exit $false
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (Get-Command diff) {}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
echo "diff is unavailable"
|
||||||
|
exit $false
|
||||||
|
}
|
||||||
|
|
||||||
REM echo Sorting json in files to compare
|
# echo Sorting json in files to compare
|
||||||
REM jq -S sorts json output
|
# jq -S sorts json output
|
||||||
jq -S . "${importedjsonfile}" > temp1.txt
|
jq -S . "${importedjsonfile}" > temp1.txt
|
||||||
if errorlevel 1 EXIT /b 1
|
if (\$lastexitcode -ge 1) { exit 1 }
|
||||||
jq -S . "${importedjsonfile}" > temp2.txt
|
jq -S . "${importedjsonfile}" > temp2.txt
|
||||||
if errorlevel 1 EXIT /b 1
|
if (\$lastexitcode -ge 1) { exit 1 }
|
||||||
|
|
||||||
REM echo Diffing sorted json files
|
# echo Diffing sorted json files
|
||||||
diff -c temp1.txt temp2.txt
|
diff -c temp1.txt temp2.txt
|
||||||
set el=%errorlevel%
|
\$el = \$lastexitcode
|
||||||
|
|
||||||
del temp1.txt
|
Remove-Item temp1.txt
|
||||||
del temp2.txt
|
Remove-Item temp2.txt
|
||||||
|
|
||||||
REM echo Diffing result: %el%
|
# echo Diffing result: \$el
|
||||||
if %el% GEQ 1 EXIT /b 1
|
if (\$el -ge 1) { exit 1 }
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -526,7 +526,6 @@ class MetaInfo extends GISJsonSerialised {
|
||||||
}
|
}
|
||||||
|
|
||||||
void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) {
|
void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) {
|
||||||
script.echo("I am here 3")
|
|
||||||
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
|
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
|
||||||
script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}")
|
script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}")
|
||||||
configurationinfo.add(ci)
|
configurationinfo.add(ci)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ def stamp(convertdetails) {
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bat """
|
powershell """
|
||||||
"${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
|
"${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
|
||||||
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger()
|
changecount = powershell(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
||||||
}
|
}
|
||||||
echo "Change count: ${changecount}"
|
echo "Change count: ${changecount}"
|
||||||
def int mvnp1 = maxversionnumber() + 1
|
def int mvnp1 = maxversionnumber() + 1
|
||||||
|
|
@ -39,21 +39,21 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
|
||||||
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gitrevision = bat(returnStdout: true, script: "@git rev-parse HEAD").trim()
|
gitrevision = powershell(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||||
}
|
}
|
||||||
echo "Revision: ${gitrevision}"
|
echo "Revision: ${gitrevision}"
|
||||||
if (isUnix()) {
|
if (isUnix()) {
|
||||||
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
|
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
remoteinfo = bat(returnStdout: true, script: "@git remote show origin").trim()
|
remoteinfo = powershell(returnStdout: true, script: "git remote show origin").trim()
|
||||||
}
|
}
|
||||||
echo "Remote info: ${remoteinfo}"
|
echo "Remote info: ${remoteinfo}"
|
||||||
if (isUnix()) {
|
if (isUnix()) {
|
||||||
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
remoteurl = bat(returnStdout: true, script: "@git config --get remote.origin.url").trim()
|
remoteurl = powershell(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
||||||
}
|
}
|
||||||
echo "Remote URL: ${remoteurl}"
|
echo "Remote URL: ${remoteurl}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue