From 620e0c7d4a4417a5b7cd7ce79502ff34daa702f4 Mon Sep 17 00:00:00 2001 From: Marcus Holl Date: Thu, 28 Feb 2019 09:59:46 +0100 Subject: [PATCH] docker for transportRequestCreate CTS --- src/com/sap/piper/cm/ChangeManagement.groovy | 4 ++-- test/groovy/TransportRequestCreateTest.groovy | 11 ++++++++++- .../com/sap/piper/cm/ChangeManagementTest.groovy | 7 +++++++ vars/transportRequestCreate.groovy | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/com/sap/piper/cm/ChangeManagement.groovy b/src/com/sap/piper/cm/ChangeManagement.groovy index 6a4878b8a..51d2e451a 100644 --- a/src/com/sap/piper/cm/ChangeManagement.groovy +++ b/src/com/sap/piper/cm/ChangeManagement.groovy @@ -77,9 +77,9 @@ public class ChangeManagement implements Serializable { } } - String createTransportRequestCTS(String transportType, String targetSystemId, String description, String endpoint, String credentialsId, String clientOpts = '') { + String createTransportRequestCTS(Map docker, String transportType, String targetSystemId, String description, String endpoint, String credentialsId, String clientOpts = '') { try { - def transportRequest = executeWithCredentials(BackendType.CTS, [:], endpoint, credentialsId, 'create-transport', + def transportRequest = executeWithCredentials(BackendType.CTS, docker, endpoint, credentialsId, 'create-transport', ['-tt', transportType, '-ts', targetSystemId, '-d', "\"${description}\""], true, clientOpts) diff --git a/test/groovy/TransportRequestCreateTest.groovy b/test/groovy/TransportRequestCreateTest.groovy index fad0ed08a..958b78d10 100644 --- a/test/groovy/TransportRequestCreateTest.groovy +++ b/test/groovy/TransportRequestCreateTest.groovy @@ -156,12 +156,14 @@ public class TransportRequestCreateTest extends BasePiperTest { ChangeManagement cm = new ChangeManagement(nullScript) { String createTransportRequestCTS( + Map docker, String transportType, String targetSystemId, String description, String endpoint, String credentialsId, String clientOpts) { + result.docker = docker result.transportType = transportType result.targetSystemId = targetSystemId result.description = description @@ -180,7 +182,14 @@ public class TransportRequestCreateTest extends BasePiperTest { cmUtils: cm) assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001' - assert result == [transportType: 'W', + assert result == [ + docker: [ + image: 'ppiper/cm-client', + pullImage: true, + envVars: [:], + options: [], + ], + transportType: 'W', targetSystemId: 'XYZ', description: 'desc', endpoint: 'https://example.org/cm', diff --git a/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy b/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy index 2007ccc1c..811671c77 100644 --- a/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy +++ b/test/groovy/com/sap/piper/cm/ChangeManagementTest.groovy @@ -228,6 +228,10 @@ public void testGetCommandLineWithCMClientOpts() { script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'cmclient.* -t CTS .*create-transport -tt W -ts XYZ -d "desc 123"$', '004') def transportRequestId = new ChangeManagement(nullScript) .createTransportRequestCTS( + [ + image: 'ppiper/cmclient', + pullImage: true + ], 'W', // transport type 'XYZ', // target system 'desc 123', // description @@ -238,6 +242,9 @@ public void testGetCommandLineWithCMClientOpts() { // returned only in case the shell call matches. assert transportRequestId == '004' + dockerExecuteRule.getDockerParams().dockerImage = 'ppiper/cmclient' + dockerExecuteRule.getDockerParams().dockerPullImage = true + } @Test diff --git a/vars/transportRequestCreate.groovy b/vars/transportRequestCreate.groovy index 04dd373f8..33a0a7a6e 100644 --- a/vars/transportRequestCreate.groovy +++ b/vars/transportRequestCreate.groovy @@ -104,6 +104,7 @@ void call(parameters = [:]) { configuration.changeManagement.clientOpts) } else if(backendType == BackendType.CTS) { transportRequestId = cm.createTransportRequestCTS( + configuration.changeManagement.cts.docker, configuration.transportType, configuration.targetSystem, configuration.description,