diff --git a/Jenkinsfile b/Jenkinsfile index 730a3cf..02c6b55 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,8 +30,10 @@ pipeline { stage ('Initialize variables') { steps { script { - def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() || null - + def hasTags = sh(script: "git tag -l | wc -l", returnStdout: true).trim().toInteger() > 0 + if (hasTags) { + def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() + } if (!lastVersion) { lastVersion = "0.0.0" }