mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
Merge pull request #140 from alejandraferreirovidal/refactorValidateToolMethod
refactor validateTool on ToolValidateDescriptor
This commit is contained in:
commit
788e64c81f
@ -1,5 +1,6 @@
|
||||
package com.sap.piper.tools
|
||||
|
||||
import com.sap.piper.VersionUtils
|
||||
import com.sap.piper.EnvironmentUtils
|
||||
import com.sap.piper.FileUtils
|
||||
import com.sap.piper.Version
|
||||
@ -94,21 +95,7 @@ class ToolDescriptor implements Serializable {
|
||||
def verifyVersion(script, configuration) {
|
||||
|
||||
def executable = getToolExecutable(script, configuration, false)
|
||||
|
||||
script.echo "Verifying $name version $version or compatible version."
|
||||
|
||||
def toolVersion
|
||||
try {
|
||||
toolVersion = script.sh returnStdout: true, script: """#!/bin/bash
|
||||
$executable $versionOption"""
|
||||
} catch(AbortException e) {
|
||||
throw new AbortException("The verification of $name failed. Please check '$executable'. $e.message.")
|
||||
}
|
||||
def installedVersion = new Version(toolVersion)
|
||||
if (!installedVersion.isCompatibleVersion(new Version(version))) {
|
||||
throw new AbortException("The installed version of $name is ${installedVersion.toString()}. Please install version $version or a compatible version.")
|
||||
}
|
||||
script.echo "Verification success. $name version ${installedVersion.toString()} is installed."
|
||||
VersionUtils.verifyVersion(script, name, executable, version, versionOption)
|
||||
}
|
||||
|
||||
def getMessage() {
|
||||
|
Loading…
Reference in New Issue
Block a user