mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
fix code climate issues
This commit is contained in:
parent
d7d36c9445
commit
a24c89ce12
@ -39,7 +39,7 @@ def resolvePlugin(call) {
|
||||
|
||||
for(def pd in pDescs) {
|
||||
if(pd.getSymbol() == call)
|
||||
return pd.real.plugin?.shortName
|
||||
return pd.real.plugin?.shortName
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -7,15 +7,15 @@ def stepPluginMapping = [:]
|
||||
println "[INFO] Resolving plugins ..."
|
||||
|
||||
for(def step in stepCallMapping) {
|
||||
def resolvedPlugins = [:]
|
||||
for(def call in step.value) {
|
||||
def resolvedPlugin = resolvePlugin(call)
|
||||
if (! resolvedPlugin) resolvedPlugin = 'UNIDENTIFIED'
|
||||
if(resolvedPlugins[resolvedPlugin] == null)
|
||||
resolvedPlugins[resolvedPlugin] = (Set)[]
|
||||
resolvedPlugins[resolvedPlugin] << call
|
||||
stepPluginMapping.put(step.key,resolvedPlugins)
|
||||
}
|
||||
def resolvedPlugins = [:]
|
||||
for(def call in step.value) {
|
||||
def resolvedPlugin = resolvePlugin(call)
|
||||
if (! resolvedPlugin) resolvedPlugin = 'UNIDENTIFIED'
|
||||
if(resolvedPlugins[resolvedPlugin] == null)
|
||||
resolvedPlugins[resolvedPlugin] = (Set)[]
|
||||
resolvedPlugins[resolvedPlugin] << call
|
||||
stepPluginMapping.put(step.key,resolvedPlugins)
|
||||
}
|
||||
}
|
||||
|
||||
def result = System.getenv()['result']
|
||||
@ -35,8 +35,7 @@ def resolvePlugin(call) {
|
||||
|
||||
for(def pd in pDescs) {
|
||||
if(pd.getSymbol() == call)
|
||||
return pd.real.plugin?.shortName
|
||||
return pd.real.plugin?.shortName
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -5,26 +5,26 @@ groovy steps.groovy
|
||||
|
||||
|
||||
[ -d jenkins_home ] && rm -rf jenkins_home
|
||||
cp -r jenkins_home_init jenkins_home
|
||||
cp -r jenkins_home_init jenkins_home
|
||||
|
||||
CALLS="`pwd`/jenkins_home/piper/calls.json"
|
||||
CALLS="$(pwd)/jenkins_home/piper/calls.json"
|
||||
|
||||
mkdir -p `dirname ${CALLS}`
|
||||
mkdir -p $(dirname "${CALLS}")
|
||||
|
||||
mv target/performedCalls.json ${CALLS}
|
||||
mv target/performedCalls.json "${CALLS}"
|
||||
|
||||
[ -f ${CALLS} ] || { echo "File \"${CALLS}\" does not exist." ; exit 1; }
|
||||
[ -f "${CALLS}" ] || { echo "File \"${CALLS}\" does not exist." ; exit 1; }
|
||||
|
||||
cID=$(docker run -d -v `pwd`/jenkins_home:/var/jenkins_home --env calls=/var/jenkins_home/piper/calls.json --env result=/var/jenkins_home/piper/result.json ppiper/jenkins-master);
|
||||
echo "ContainerId: ${cID}";
|
||||
cID="$(docker run -d -v `pwd`/jenkins_home:/var/jenkins_home --env calls=/var/jenkins_home/piper/calls.json --env result=/var/jenkins_home/piper/result.json ppiper/jenkins-master)"
|
||||
echo "ContainerId: ${cID}"
|
||||
while true
|
||||
do
|
||||
[ -f jenkins_home/piper/result.json ] && { docker rm -f ${cID}; break; } # normal ...
|
||||
[ -f jenkins_home/piper/FAILURE ] && { docker rm -f ${cID}; break; } # executing of our init script failed
|
||||
docker ps --no-trunc |grep -q ${cID} || break # docker container does not run anymore
|
||||
[ -f jenkins_home/piper/result.json ] && { docker rm -f "${cID}"; break; } # normal ...
|
||||
[ -f jenkins_home/piper/FAILURE ] && { docker rm -f "${cID}"; break; } # executing of our init script failed
|
||||
docker ps --no-trunc |grep -q "${cID}"|| break # docker container does not run anymore
|
||||
echo "[INFO] waiting for results"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
RESULT="`pwd`/jenkins_home/piper/result.json"
|
||||
[ -f ${RESULT} ] && cat jenkins_home/piper/result.json
|
||||
RESULT="$(pwd)/jenkins_home/piper/result.json"
|
||||
[ -f "${RESULT}" ] && cat jenkins_home/piper/result.json
|
||||
|
10
steps.groovy
10
steps.groovy
@ -18,7 +18,7 @@ _calls = null
|
||||
// Remove selfs
|
||||
calls.each { c ->
|
||||
c.value.remove(c.key)
|
||||
}
|
||||
}
|
||||
|
||||
int counter=0
|
||||
|
||||
@ -42,7 +42,11 @@ while(counter < 1600) {
|
||||
|
||||
for (def calledStep in calledSteps) {
|
||||
|
||||
if (calledStep in Map) {
|
||||
if(calledStep in Map) {
|
||||
// After some time not working on this I have acually forgotten
|
||||
// what needs to be done here ... In order not to forget that
|
||||
// here is maybe something missing we emit a log message.
|
||||
System.err << "[DEBUG] This is not handled yet.(${calledStep})\n"
|
||||
} else {
|
||||
if(calledStep in piperSteps) {
|
||||
toBeReplaced = calledStep
|
||||
@ -50,7 +54,7 @@ while(counter < 1600) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(toBeReplaced) {
|
||||
def replacement = [:]
|
||||
replacement[toBeReplaced] = calls[toBeReplaced] as Set
|
||||
|
Loading…
Reference in New Issue
Block a user