diff --git a/src/com/cloudogu/ces/cesbuildlib/Docker.groovy b/src/com/cloudogu/ces/cesbuildlib/Docker.groovy index 9937d91..aeacce2 100644 --- a/src/com/cloudogu/ces/cesbuildlib/Docker.groovy +++ b/src/com/cloudogu/ces/cesbuildlib/Docker.groovy @@ -401,7 +401,7 @@ class Docker implements Serializable { def userName = sh.returnStdOut('whoami') String jenkinsUserFromEtcPasswd = sh.returnStdOut "cat /etc/passwd | grep $userName" - if (jenkinsUserFromEtcPasswd.isEmpty()) { + if (jenkinsUserFromEtcPasswd == null || jenkinsUserFromEtcPasswd.isEmpty()) { script.error 'Unable to parse user jenkins from /etc/passwd.' } return jenkinsUserFromEtcPasswd diff --git a/src/com/cloudogu/ces/cesbuildlib/Sh.groovy b/src/com/cloudogu/ces/cesbuildlib/Sh.groovy index d9521c3..14f2e98 100644 --- a/src/com/cloudogu/ces/cesbuildlib/Sh.groovy +++ b/src/com/cloudogu/ces/cesbuildlib/Sh.groovy @@ -18,6 +18,6 @@ class Sh implements Serializable { // Trim to remove trailing line breaks, which result in unwanted behavior in Jenkinsfiles: // E.g. when using output in other sh() calls leading to executing the sh command after the line breaks, // possibly discarding additional arguments - .trim() + ?.trim() } }