From ad3e0f86d1951156dcd63c9669371035145ff41c Mon Sep 17 00:00:00 2001 From: Marcus Holl Date: Tue, 5 Mar 2019 10:29:23 +0100 Subject: [PATCH] Verbose flag for transportRequestCreate --- resources/default_pipeline_environment.yml | 1 + src/com/sap/piper/cm/ChangeManagement.groovy | 4 +++- test/groovy/TransportRequestCreateTest.groovy | 13 +++++++++---- .../com/sap/piper/cm/ChangeManagementTest.groovy | 7 +++++-- vars/transportRequestCreate.groovy | 5 ++++- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/resources/default_pipeline_environment.yml b/resources/default_pipeline_environment.yml index 8e0713cb9..f4d0974e3 100644 --- a/resources/default_pipeline_environment.yml +++ b/resources/default_pipeline_environment.yml @@ -362,6 +362,7 @@ steps: failIfStatusIsNotInDevelopment: true transportRequestCreate: developmentSystemId: null + verbose: false transportRequestUploadFile: acceptUnixStyleLineEndings: true codePage: 'UTF-8' diff --git a/src/com/sap/piper/cm/ChangeManagement.groovy b/src/com/sap/piper/cm/ChangeManagement.groovy index 331568f7b..75d64f458 100644 --- a/src/com/sap/piper/cm/ChangeManagement.groovy +++ b/src/com/sap/piper/cm/ChangeManagement.groovy @@ -107,13 +107,15 @@ public class ChangeManagement implements Serializable { String developmentClient, String developmentInstance, String credentialsId, - String description) { + String description, + boolean verbose) { def command = 'cts createTransportRequest' def args = [ TRANSPORT_DESCRIPTION: description, ABAP_DEVELOPMENT_INSTANCE: developmentInstance, ABAP_DEVELOPMENT_CLIENT: developmentClient, + VERBOSE: verbose, ] try { diff --git a/test/groovy/TransportRequestCreateTest.groovy b/test/groovy/TransportRequestCreateTest.groovy index 0c511f00c..ce6841507 100644 --- a/test/groovy/TransportRequestCreateTest.groovy +++ b/test/groovy/TransportRequestCreateTest.groovy @@ -205,7 +205,8 @@ public class TransportRequestCreateTest extends BasePiperTest { String developmentClient, String developmentInstance, String credentialsId, - String description) { + String description, + boolean verbose) { result.docker = docker result.endpoint = endpoint @@ -213,6 +214,7 @@ public class TransportRequestCreateTest extends BasePiperTest { result.developmentInstance= developmentInstance result.credentialsId = credentialsId result.description = description + result.verbose = verbose return '001' } @@ -230,7 +232,8 @@ public class TransportRequestCreateTest extends BasePiperTest { ], developmentSystemId: '001', description: '', - cmUtils: cm) + cmUtils: cm, + verbose: true) assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001' assert result == [ @@ -244,7 +247,8 @@ public class TransportRequestCreateTest extends BasePiperTest { developmentClient: '01', developmentInstance: '001', credentialsId: 'CM', - description: '' + description: '', + verbose: true ] assert loggingRule.log.contains("[INFO] Creating transport request.") @@ -265,7 +269,8 @@ public class TransportRequestCreateTest extends BasePiperTest { String developmentClient, String developmentInstance, String credentialsId, - String description) { + String description, + boolean verbose) { throw new ChangeManagementException('upload failed') } diff --git a/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy b/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy index 3cdc483f5..b1d05fe63 100644 --- a/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy +++ b/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy @@ -182,7 +182,8 @@ public void testGetCommandLineWithCMClientOpts() { '01', // client '001', // instance 'me', // credentialsId - 'Lorem ipsum' // description + 'Lorem ipsum', // description + true // verbose ) assert dockerExecuteRule.dockerParams.dockerImage == 'rfc' @@ -194,6 +195,7 @@ public void testGetCommandLineWithCMClientOpts() { ABAP_DEVELOPMENT_SERVER: 'https://example.org/rfc', ABAP_DEVELOPMENT_USER: 'user', ABAP_DEVELOPMENT_PASSWORD: 'password', + VERBOSE: true ] assert transportRequestId == 'XYZK9000004' @@ -215,7 +217,8 @@ public void testGetCommandLineWithCMClientOpts() { '01', // client '001', // instance 'me', // credentialsId - 'Lorem ipsum' // description + 'Lorem ipsum', // description + true, //verbose ) } diff --git a/vars/transportRequestCreate.groovy b/vars/transportRequestCreate.groovy index f05fec864..04dd373f8 100644 --- a/vars/transportRequestCreate.groovy +++ b/vars/transportRequestCreate.groovy @@ -23,6 +23,7 @@ import hudson.AbortException 'developmentSystemId', // SOLMAN 'targetSystem', // CTS 'transportType', // CTS + 'verbose', // RFC ] @Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS.plus(['changeDocumentId']) @@ -63,6 +64,7 @@ void call(parameters = [:]) { .withMandatoryProperty('description', null, { backendType == BackendType.CTS}) .withMandatoryProperty('changeManagement/rfc/developmentInstance', null, {backendType == BackendType.RFC}) .withMandatoryProperty('changeManagement/rfc/developmentClient', null, {backendType == BackendType.RFC}) + .withMandatoryProperty('verbose', null, {backendType == BackendType.RFC}) def changeDocumentId = null @@ -115,7 +117,8 @@ void call(parameters = [:]) { configuration.changeManagement.rfc.developmentInstance, configuration.changeManagement.rfc.developmentClient, configuration.changeManagement.credentialsId, - configuration.description) + configuration.description, + configuration.verbose) } else { throw new IllegalArgumentException("Invalid backend type: '${backendType}'.") }