neoDeploy: assert deployable exists before starting deployment.

Up to now the presence of the deployable (source) was checked late
by the NeoCommandLineHelper. The code doing this is surrounded by
the try/catch which finally also puts the log written by the neo
toolset into the job log in case an exception occured.

The check for the deployable returns with the same type of
exception like a failed neo command. Hence we cannot distiguish (ok,
would be possible to parse the exception message, but that is ugly).
When the exception is triggered by the missing deployable we try to
cat the neo log into the job log. But at this point the neo log has
not been provided - neo has not been called at all in this case.
Hence `cat logs/neo/*` in turn fails.

In order to avoid such a failure we check now for the presence of the
deployable earlier before launching the neo toolset.

Since the deployable is used in any deploy mode case no further check
for the deploy mode is required prior to the check for the deployable.
This commit is contained in:
Marcus Holl
2019-04-02 13:53:31 +02:00
parent 24563db155
commit dea2dbcbaa
+4
View File
@@ -1,5 +1,6 @@
import com.sap.piper.ConfigurationHelper
import com.sap.piper.Utils
import com.sap.piper.StepAssertions
import com.sap.piper.tools.neo.DeployMode
import com.sap.piper.tools.neo.NeoCommandHelper
import com.sap.piper.tools.neo.WarAction
@@ -88,6 +89,9 @@ void call(parameters = [:]) {
dockerEnvVars: configuration.dockerEnvVars,
dockerOptions: configuration.dockerOptions
) {
StepAssertions.assertFileExists(this, configuration.source)
NeoCommandHelper neoCommandHelper = new NeoCommandHelper(
this,
deployMode,