1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-30 05:59:39 +02:00

Merge branch 'master' into master

This commit is contained in:
Irina Kirilova 2019-03-21 12:54:15 +01:00 committed by GitHub
commit 020a5aaadd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 191 additions and 40 deletions

View File

@ -16,6 +16,18 @@ general:
from: 'origin/master' from: 'origin/master'
to: 'HEAD' to: 'HEAD'
format: '%b' format: '%b'
solman:
docker:
image: 'ppiper/cm-client'
options: []
envVars: {}
pullImage: true
cts:
docker:
image: 'ppiper/cm-client'
options: []
envVars: {}
pullImage: true
rfc: rfc:
docker: docker:
image: 'rfc' image: 'rfc'

View File

@ -63,8 +63,8 @@ public class ChangeManagement implements Serializable {
return items[0] return items[0]
} }
boolean isChangeInDevelopment(String changeId, String endpoint, String credentialsId, String clientOpts = '') { boolean isChangeInDevelopment(Map docker, String changeId, String endpoint, String credentialsId, String clientOpts = '') {
int rc = executeWithCredentials(BackendType.SOLMAN, [:], endpoint, credentialsId, 'is-change-in-development', ['-cID', "'${changeId}'", '--return-code'], int rc = executeWithCredentials(BackendType.SOLMAN, docker, endpoint, credentialsId, 'is-change-in-development', ['-cID', "'${changeId}'", '--return-code'],
false, false,
clientOpts) as int clientOpts) as int
@ -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 { 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}\""], ['-tt', transportType, '-ts', targetSystemId, '-d', "\"${description}\""],
true, true,
clientOpts) clientOpts)
@ -89,10 +89,10 @@ public class ChangeManagement implements Serializable {
} }
} }
String createTransportRequestSOLMAN(String changeId, String developmentSystemId, String endpoint, String credentialsId, String clientOpts = '') { String createTransportRequestSOLMAN(Map docker, String changeId, String developmentSystemId, String endpoint, String credentialsId, String clientOpts = '') {
try { try {
def transportRequest = executeWithCredentials(BackendType.SOLMAN, [:], endpoint, credentialsId, 'create-transport', ['-cID', changeId, '-dID', developmentSystemId], def transportRequest = executeWithCredentials(BackendType.SOLMAN, docker, endpoint, credentialsId, 'create-transport', ['-cID', changeId, '-dID', developmentSystemId],
true, true,
clientOpts) clientOpts)
return (transportRequest as String)?.trim() return (transportRequest as String)?.trim()
@ -138,6 +138,7 @@ public class ChangeManagement implements Serializable {
} }
void uploadFileToTransportRequestSOLMAN( void uploadFileToTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String applicationId, String applicationId,
@ -154,7 +155,7 @@ public class ChangeManagement implements Serializable {
int rc = executeWithCredentials( int rc = executeWithCredentials(
BackendType.SOLMAN, BackendType.SOLMAN,
[:], docker,
endpoint, endpoint,
credentialsId, credentialsId,
'upload-file-to-transport', 'upload-file-to-transport',
@ -169,6 +170,7 @@ public class ChangeManagement implements Serializable {
} }
void uploadFileToTransportRequestCTS( void uploadFileToTransportRequestCTS(
Map docker,
String transportRequestId, String transportRequestId,
String filePath, String filePath,
String endpoint, String endpoint,
@ -182,7 +184,7 @@ public class ChangeManagement implements Serializable {
int rc = executeWithCredentials( int rc = executeWithCredentials(
BackendType.CTS, BackendType.CTS,
[:], docker,
endpoint, endpoint,
credentialsId, credentialsId,
'upload-file-to-transport', 'upload-file-to-transport',
@ -251,6 +253,9 @@ public class ChangeManagement implements Serializable {
String clientOpts = '') { String clientOpts = '') {
def script = this.script def script = this.script
docker = docker ?: [:]
script.withCredentials([script.usernamePassword( script.withCredentials([script.usernamePassword(
credentialsId: credentialsId, credentialsId: credentialsId,
passwordVariable: 'password', passwordVariable: 'password',
@ -263,6 +268,8 @@ public class ChangeManagement implements Serializable {
else else
shArgs.put('returnStatus', true) shArgs.put('returnStatus', true)
Map dockerEnvVars = docker.envVars ?: [:]
def result = 1 def result = 1
switch(type) { switch(type) {
@ -281,19 +288,7 @@ public class ChangeManagement implements Serializable {
ABAP_DEVELOPMENT_PASSWORD: script.password, ABAP_DEVELOPMENT_PASSWORD: script.password,
]) ])
// user and password are masked by withCredentials dockerEnvVars += args
script.echo """[INFO] Executing command line: "${shArgs.script}"."""
script.dockerExecute(
script: script,
dockerImage: docker.image,
dockerOptions: docker.options,
dockerEnvVars: (docker.envVars?:[:]).plus(args),
dockerPullImage: docker.pullImage) {
result = script.sh(shArgs)
}
break break
@ -307,19 +302,29 @@ public class ChangeManagement implements Serializable {
command, args, command, args,
clientOpts) clientOpts)
// user and password are masked by withCredentials break
script.echo """[INFO] Executing command line: "${shArgs.script}".""" }
// user and password are masked by withCredentials
script.echo """[INFO] Executing command line: "${shArgs.script}"."""
script.dockerExecute(
script: script,
dockerImage: docker.image,
dockerOptions: docker.options,
dockerEnvVars: dockerEnvVars,
dockerPullImage: docker.pullImage) {
result = script.sh(shArgs) result = script.sh(shArgs)
break }
}
return result return result
} }
} }
void releaseTransportRequestSOLMAN( void releaseTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String endpoint, String endpoint,
@ -336,7 +341,7 @@ public class ChangeManagement implements Serializable {
int rc = executeWithCredentials( int rc = executeWithCredentials(
BackendType.SOLMAN, BackendType.SOLMAN,
[:], docker,
endpoint, endpoint,
credentialsId, credentialsId,
cmd, cmd,
@ -350,6 +355,7 @@ public class ChangeManagement implements Serializable {
} }
void releaseTransportRequestCTS( void releaseTransportRequestCTS(
Map docker,
String transportRequestId, String transportRequestId,
String endpoint, String endpoint,
String credentialsId, String credentialsId,
@ -363,7 +369,7 @@ public class ChangeManagement implements Serializable {
int rc = executeWithCredentials( int rc = executeWithCredentials(
BackendType.CTS, BackendType.CTS,
[:], docker,
endpoint, endpoint,
credentialsId, credentialsId,
cmd, cmd,

View File

@ -52,6 +52,12 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
failIfStatusIsNotInDevelopment: true) failIfStatusIsNotInDevelopment: true)
assert cmUtilReceivedParams == [ assert cmUtilReceivedParams == [
docker: [
image: 'ppiper/cm-client',
options:[],
envVars:[:],
pullImage:true,
],
changeId: '001', changeId: '001',
endpoint: 'https://example.org/cm', endpoint: 'https://example.org/cm',
credentialsId: 'CM', credentialsId: 'CM',
@ -184,7 +190,8 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
return changeDocumentId return changeDocumentId
} }
boolean isChangeInDevelopment(String changeId, String endpoint, String credentialsId, String cmclientOpts) { boolean isChangeInDevelopment(Map docker, String changeId, String endpoint, String credentialsId, String cmclientOpts) {
cmUtilReceivedParams.docker = docker
cmUtilReceivedParams.changeId = changeId cmUtilReceivedParams.changeId = changeId
cmUtilReceivedParams.endpoint = endpoint cmUtilReceivedParams.endpoint = endpoint
cmUtilReceivedParams.credentialsId = credentialsId cmUtilReceivedParams.credentialsId = credentialsId

View File

@ -94,6 +94,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
String createTransportRequestSOLMAN( String createTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String developmentSystemId, String developmentSystemId,
String cmEndpoint, String cmEndpoint,
@ -119,12 +120,14 @@ public class TransportRequestCreateTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
String createTransportRequestSOLMAN( String createTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String developmentSystemId, String developmentSystemId,
String cmEndpoint, String cmEndpoint,
String credentialId, String credentialId,
String clientOpts) { String clientOpts) {
result.docker = docker
result.changeId = changeId result.changeId = changeId
result.developmentSystemId = developmentSystemId result.developmentSystemId = developmentSystemId
result.cmEndpoint = cmEndpoint result.cmEndpoint = cmEndpoint
@ -137,7 +140,14 @@ public class TransportRequestCreateTest extends BasePiperTest {
stepRule.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm) stepRule.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001' assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001'
assert result == [changeId: '001', assert result == [
docker: [
image: 'ppiper/cm-client',
pullImage: true,
options: [],
envVars: [:],
],
changeId: '001',
developmentSystemId: '001', developmentSystemId: '001',
cmEndpoint: 'https://example.org/cm', cmEndpoint: 'https://example.org/cm',
credentialId: 'CM', credentialId: 'CM',
@ -156,12 +166,14 @@ public class TransportRequestCreateTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
String createTransportRequestCTS( String createTransportRequestCTS(
Map docker,
String transportType, String transportType,
String targetSystemId, String targetSystemId,
String description, String description,
String endpoint, String endpoint,
String credentialsId, String credentialsId,
String clientOpts) { String clientOpts) {
result.docker = docker
result.transportType = transportType result.transportType = transportType
result.targetSystemId = targetSystemId result.targetSystemId = targetSystemId
result.description = description result.description = description
@ -180,7 +192,14 @@ public class TransportRequestCreateTest extends BasePiperTest {
cmUtils: cm) cmUtils: cm)
assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001' assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001'
assert result == [transportType: 'W', assert result == [
docker: [
image: 'ppiper/cm-client',
pullImage: true,
envVars: [:],
options: [],
],
transportType: 'W',
targetSystemId: 'XYZ', targetSystemId: 'XYZ',
description: 'desc', description: 'desc',
endpoint: 'https://example.org/cm', endpoint: 'https://example.org/cm',

View File

@ -97,6 +97,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void releaseTransportRequestSOLMAN( void releaseTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String endpoint, String endpoint,
@ -126,6 +127,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void releaseTransportRequestCTS( void releaseTransportRequestCTS(
Map docker,
String transportRequestId, String transportRequestId,
String endpoint, String endpoint,
String credentialsId, String credentialsId,
@ -229,12 +231,14 @@ public class TransportRequestReleaseTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void releaseTransportRequestCTS( void releaseTransportRequestCTS(
Map docker,
String transportRequestId, String transportRequestId,
String endpoint, String endpoint,
String credentialsId, String credentialsId,
String clientOpts = '') { String clientOpts = '') {
receivedParameters = [ receivedParameters = [
docker: docker,
transportRequestId: transportRequestId, transportRequestId: transportRequestId,
endpoint: endpoint, endpoint: endpoint,
credentialsId: credentialsId, credentialsId: credentialsId,
@ -249,6 +253,12 @@ public class TransportRequestReleaseTest extends BasePiperTest {
cmUtils: cm) cmUtils: cm)
assert receivedParameters == [ assert receivedParameters == [
docker: [
image:'ppiper/cm-client',
options:[],
envVars:[:],
pullImage:true,
],
transportRequestId: '002', transportRequestId: '002',
endpoint: 'https://example.org/cts', endpoint: 'https://example.org/cts',
credentialsId: 'CM', credentialsId: 'CM',
@ -374,12 +384,14 @@ public class TransportRequestReleaseTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void releaseTransportRequestSOLMAN( void releaseTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String endpoint, String endpoint,
String credentialsId, String credentialsId,
String clientOpts) { String clientOpts) {
receivedParams.docker = docker
receivedParams.changeId = changeId receivedParams.changeId = changeId
receivedParams.transportRequestId = transportRequestId receivedParams.transportRequestId = transportRequestId
receivedParams.endpoint = endpoint receivedParams.endpoint = endpoint
@ -391,6 +403,12 @@ public class TransportRequestReleaseTest extends BasePiperTest {
stepRule.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '002', cmUtils: cm) stepRule.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '002', cmUtils: cm)
assert receivedParams == [ assert receivedParams == [
docker: [
image: 'ppiper/cm-client',
pullImage: true,
envVars: [:],
options: [],
],
changeId: '001', changeId: '001',
transportRequestId: '002', transportRequestId: '002',
endpoint: 'https://example.org/cm', endpoint: 'https://example.org/cm',

View File

@ -21,6 +21,7 @@ import util.JenkinsCredentialsRule
import util.JenkinsStepRule import util.JenkinsStepRule
import util.JenkinsLoggingRule import util.JenkinsLoggingRule
import util.JenkinsReadYamlRule import util.JenkinsReadYamlRule
import util.JenkinsDockerExecuteRule
import util.Rules import util.Rules
import hudson.AbortException import hudson.AbortException
@ -129,6 +130,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequestSOLMAN( void uploadFileToTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String applicationId, String applicationId,
@ -159,12 +161,14 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequestCTS( void uploadFileToTransportRequestCTS(
Map docker,
String transportRequestId, String transportRequestId,
String filePath, String filePath,
String endpoint, String endpoint,
String credentialsId, String credentialsId,
String cmclientOpts) { String cmclientOpts) {
cmUtilReceivedParams.docker = docker
cmUtilReceivedParams.transportRequestId = transportRequestId cmUtilReceivedParams.transportRequestId = transportRequestId
cmUtilReceivedParams.filePath = filePath cmUtilReceivedParams.filePath = filePath
cmUtilReceivedParams.endpoint = endpoint cmUtilReceivedParams.endpoint = endpoint
@ -181,12 +185,19 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
assert cmUtilReceivedParams == assert cmUtilReceivedParams ==
[ [
docker: [
image: 'ppiper/cm-client',
options:[],
envVars:[:],
pullImage:true
],
transportRequestId: '002', transportRequestId: '002',
filePath: '/path', filePath: '/path',
endpoint: 'https://example.org/cm', endpoint: 'https://example.org/cm',
credentialsId: 'CM', credentialsId: 'CM',
cmclientOpts: '' cmclientOpts: ''
] ]
} }
@Test @Test
@ -361,6 +372,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequestSOLMAN( void uploadFileToTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String applicationId, String applicationId,
@ -369,6 +381,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
String credentialsId, String credentialsId,
String cmclientOpts) { String cmclientOpts) {
cmUtilReceivedParams.docker = docker
cmUtilReceivedParams.changeId = changeId cmUtilReceivedParams.changeId = changeId
cmUtilReceivedParams.transportRequestId = transportRequestId cmUtilReceivedParams.transportRequestId = transportRequestId
cmUtilReceivedParams.applicationId = applicationId cmUtilReceivedParams.applicationId = applicationId
@ -388,6 +401,12 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
assert cmUtilReceivedParams == assert cmUtilReceivedParams ==
[ [
docker: [
image: 'ppiper/cm-client',
pullImage: true,
envVars: [:],
options: [],
],
changeId: '001', changeId: '001',
transportRequestId: '002', transportRequestId: '002',
applicationId: 'app', applicationId: 'app',
@ -407,6 +426,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequestSOLMAN( void uploadFileToTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String applicationId, String applicationId,
@ -437,6 +457,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequestSOLMAN( void uploadFileToTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String applicationId, String applicationId,
@ -467,6 +488,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequestSOLMAN( void uploadFileToTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String applicationId, String applicationId,
@ -496,6 +518,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
ChangeManagement cm = new ChangeManagement(nullScript) { ChangeManagement cm = new ChangeManagement(nullScript) {
void uploadFileToTransportRequestSOLMAN( void uploadFileToTransportRequestSOLMAN(
Map docker,
String changeId, String changeId,
String transportRequestId, String transportRequestId,
String applicationId, String applicationId,

View File

@ -96,7 +96,12 @@ public class ChangeManagementTest extends BasePiperTest {
public void testIsChangeInDevelopmentReturnsTrueWhenChangeIsInDevelopent() { public void testIsChangeInDevelopmentReturnsTrueWhenChangeIsInDevelopent() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, "cmclient.*is-change-in-development -cID '001'", 0) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, "cmclient.*is-change-in-development -cID '001'", 0)
boolean inDevelopment = new ChangeManagement(nullScript, null).isChangeInDevelopment('001', 'endpoint', 'me') boolean inDevelopment = new ChangeManagement(nullScript, null).isChangeInDevelopment(
[
image: 'ppiper/cm-client',
pullImage: true,
],
'001', 'endpoint', 'me')
assertThat(inDevelopment, is(equalTo(true))) assertThat(inDevelopment, is(equalTo(true)))
assertThat(script.shell[0], allOf(containsString("cmclient"), assertThat(script.shell[0], allOf(containsString("cmclient"),
@ -106,6 +111,9 @@ public class ChangeManagementTest extends BasePiperTest {
containsString('is-change-in-development'), containsString('is-change-in-development'),
containsString("-cID '001'"), containsString("-cID '001'"),
containsString("-t SOLMAN"))) containsString("-t SOLMAN")))
assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
assert dockerExecuteRule.getDockerParams().dockerPullImage == true
} }
@Test @Test
@ -114,7 +122,8 @@ public class ChangeManagementTest extends BasePiperTest {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, "cmclient.*is-change-in-development -cID '001'", 3) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, "cmclient.*is-change-in-development -cID '001'", 3)
boolean inDevelopment = new ChangeManagement(nullScript, null) boolean inDevelopment = new ChangeManagement(nullScript, null)
.isChangeInDevelopment('001', .isChangeInDevelopment([:],
'001',
'endpoint', 'endpoint',
'me') 'me')
@ -128,7 +137,7 @@ public class ChangeManagementTest extends BasePiperTest {
thrown.expectMessage('Cannot retrieve status for change document \'001\'. Does this change exist? Return code from cmclient: 1.') thrown.expectMessage('Cannot retrieve status for change document \'001\'. Does this change exist? Return code from cmclient: 1.')
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, "cmclient.*is-change-in-development -cID '001'", 1) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, "cmclient.*is-change-in-development -cID '001'", 1)
new ChangeManagement(nullScript, null).isChangeInDevelopment('001', 'endpoint', 'me') new ChangeManagement(nullScript, null).isChangeInDevelopment([:], '001', 'endpoint', 'me')
} }
@Test @Test
@ -163,12 +172,20 @@ public void testGetCommandLineWithCMClientOpts() {
public void testCreateTransportRequestSOLMANSucceeds() { public void testCreateTransportRequestSOLMANSucceeds() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, ".*cmclient.*create-transport -cID 001 -dID 002.*", '004') script.setReturnValue(JenkinsShellCallRule.Type.REGEX, ".*cmclient.*create-transport -cID 001 -dID 002.*", '004')
def transportRequestId = new ChangeManagement(nullScript).createTransportRequestSOLMAN( '001', '002', '003', 'me') def transportRequestId = new ChangeManagement(nullScript).createTransportRequestSOLMAN(
[
image: 'ppiper/cm-client',
pullImage: true,
],
'001', '002', '003', 'me')
// the check for the transportRequestID is sufficient. This checks implicit the command line since that value is // the check for the transportRequestID is sufficient. This checks implicit the command line since that value is
// returned only in case the shell call matches. // returned only in case the shell call matches.
assert transportRequestId == '004' assert transportRequestId == '004'
assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
assert dockerExecuteRule.getDockerParams().dockerPullImage == true
} }
@Test @Test
@ -228,6 +245,10 @@ public void testGetCommandLineWithCMClientOpts() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'cmclient.* -t CTS .*create-transport -tt W -ts XYZ -d "desc 123"$', '004') script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'cmclient.* -t CTS .*create-transport -tt W -ts XYZ -d "desc 123"$', '004')
def transportRequestId = new ChangeManagement(nullScript) def transportRequestId = new ChangeManagement(nullScript)
.createTransportRequestCTS( .createTransportRequestCTS(
[
image: 'ppiper/cmclient',
pullImage: true
],
'W', // transport type 'W', // transport type
'XYZ', // target system 'XYZ', // target system
'desc 123', // description 'desc 123', // description
@ -238,6 +259,9 @@ public void testGetCommandLineWithCMClientOpts() {
// returned only in case the shell call matches. // returned only in case the shell call matches.
assert transportRequestId == '004' assert transportRequestId == '004'
dockerExecuteRule.getDockerParams().dockerImage = 'ppiper/cmclient'
dockerExecuteRule.getDockerParams().dockerPullImage = true
} }
@Test @Test
@ -247,6 +271,10 @@ public void testGetCommandLineWithCMClientOpts() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'upload-file-to-transport.*-cID 001 -tID 002 XXX "/path"', 0) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'upload-file-to-transport.*-cID 001 -tID 002 XXX "/path"', 0)
new ChangeManagement(nullScript).uploadFileToTransportRequestSOLMAN( new ChangeManagement(nullScript).uploadFileToTransportRequestSOLMAN(
[
image: 'ppiper/cm-client',
imagePull: true,
],
'001', '001',
'002', '002',
'XXX', 'XXX',
@ -254,8 +282,12 @@ public void testGetCommandLineWithCMClientOpts() {
'https://example.org/cm', 'https://example.org/cm',
'me') 'me')
// no assert required here, since the regex registered above to the script rule is an implicit check for // no assert required here for the shell script, since the regex registered above
// the command line. // to the script rule is an implicit check for the command line.
dockerExecuteRule.getDockerParams().dockerImage = 'ppiper/cmclient'
dockerExecuteRule.getDockerParams().dockerPullImage = true
} }
@Test @Test
@ -265,13 +297,20 @@ public void testGetCommandLineWithCMClientOpts() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t CTS upload-file-to-transport -tID 002 "/path"', 0) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t CTS upload-file-to-transport -tID 002 "/path"', 0)
new ChangeManagement(nullScript).uploadFileToTransportRequestCTS( new ChangeManagement(nullScript).uploadFileToTransportRequestCTS(
[
image: 'ppiper/cmclient',
pullImage: true
],
'002', '002',
'/path', '/path',
'https://example.org/cm', 'https://example.org/cm',
'me') 'me')
// no assert required here, since the regex registered above to the script rule is an implicit check for assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cmclient'
// the command line. assert dockerExecuteRule.getDockerParams().dockerPullImage == true
// no assert for the shell command required here, since the regex registered
// above to the script rule is an implicit check for the command line.
} }
@Test @Test
@ -354,6 +393,7 @@ public void testGetCommandLineWithCMClientOpts() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX,, 'upload-file-to-transport', 1) script.setReturnValue(JenkinsShellCallRule.Type.REGEX,, 'upload-file-to-transport', 1)
new ChangeManagement(nullScript).uploadFileToTransportRequestSOLMAN( new ChangeManagement(nullScript).uploadFileToTransportRequestSOLMAN(
[:],
'001', '001',
'002', '002',
'XXX', 'XXX',
@ -369,6 +409,10 @@ public void testGetCommandLineWithCMClientOpts() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t SOLMAN release-transport.*-cID 001.*-tID 002', 0) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t SOLMAN release-transport.*-cID 001.*-tID 002', 0)
new ChangeManagement(nullScript).releaseTransportRequestSOLMAN( new ChangeManagement(nullScript).releaseTransportRequestSOLMAN(
[
image: 'ppiper/cm-client',
imagePull: true,
],
'001', '001',
'002', '002',
'https://example.org', 'https://example.org',
@ -377,6 +421,9 @@ public void testGetCommandLineWithCMClientOpts() {
// no assert required here, since the regex registered above to the script rule is an implicit check for // no assert required here, since the regex registered above to the script rule is an implicit check for
// the command line. // the command line.
dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
dockerExecuteRule.getDockerParams().pullImage == true
} }
@Test @Test
@ -386,6 +433,10 @@ public void testGetCommandLineWithCMClientOpts() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t CTS export-transport.*-tID 002', 0) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t CTS export-transport.*-tID 002', 0)
new ChangeManagement(nullScript).releaseTransportRequestCTS( new ChangeManagement(nullScript).releaseTransportRequestCTS(
[
image: 'ppiper/cm-client',
pullImage: true,
],
'002', '002',
'https://example.org', 'https://example.org',
'me', 'me',
@ -393,6 +444,9 @@ public void testGetCommandLineWithCMClientOpts() {
// no assert required here, since the regex registered above to the script rule is an implicit check for // no assert required here, since the regex registered above to the script rule is an implicit check for
// the command line. // the command line.
assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
assert dockerExecuteRule.getDockerParams().dockerPullImage == true
} }
@Test @Test
@ -429,6 +483,10 @@ public void testGetCommandLineWithCMClientOpts() {
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'release-transport.*-cID 001.*-tID 002', 1) script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'release-transport.*-cID 001.*-tID 002', 1)
new ChangeManagement(nullScript).releaseTransportRequestSOLMAN( new ChangeManagement(nullScript).releaseTransportRequestSOLMAN(
[
image: 'ppiper/cm-client',
imagePull: true,
],
'001', '001',
'002', '002',
'https://example.org', 'https://example.org',

View File

@ -115,7 +115,9 @@ void call(parameters = [:]) {
try { try {
isInDevelopment = cm.isChangeInDevelopment(configuration.changeDocumentId, isInDevelopment = cm.isChangeInDevelopment(
configuration.changeManagement.solman.docker,
configuration.changeDocumentId,
configuration.changeManagement.endpoint, configuration.changeManagement.endpoint,
configuration.changeManagement.credentialsId, configuration.changeManagement.credentialsId,
configuration.changeManagement.clientOpts) configuration.changeManagement.clientOpts)

View File

@ -97,6 +97,7 @@ void call(parameters = [:]) {
try { try {
if(backendType == BackendType.SOLMAN) { if(backendType == BackendType.SOLMAN) {
transportRequestId = cm.createTransportRequestSOLMAN( transportRequestId = cm.createTransportRequestSOLMAN(
configuration.changeManagement.solman.docker,
configuration.changeDocumentId, configuration.changeDocumentId,
configuration.developmentSystemId, configuration.developmentSystemId,
configuration.changeManagement.endpoint, configuration.changeManagement.endpoint,
@ -104,6 +105,7 @@ void call(parameters = [:]) {
configuration.changeManagement.clientOpts) configuration.changeManagement.clientOpts)
} else if(backendType == BackendType.CTS) { } else if(backendType == BackendType.CTS) {
transportRequestId = cm.createTransportRequestCTS( transportRequestId = cm.createTransportRequestCTS(
configuration.changeManagement.cts.docker,
configuration.transportType, configuration.transportType,
configuration.targetSystem, configuration.targetSystem,
configuration.description, configuration.description,

View File

@ -100,6 +100,7 @@ void call(parameters = [:]) {
case BackendType.SOLMAN: case BackendType.SOLMAN:
cm.releaseTransportRequestSOLMAN( cm.releaseTransportRequestSOLMAN(
configuration.changeManagement.solman.docker,
configuration.changeDocumentId, configuration.changeDocumentId,
configuration.transportRequestId, configuration.transportRequestId,
configuration.changeManagement.endpoint, configuration.changeManagement.endpoint,
@ -110,6 +111,7 @@ void call(parameters = [:]) {
case BackendType.CTS: case BackendType.CTS:
cm.releaseTransportRequestCTS( cm.releaseTransportRequestCTS(
configuration.changeManagement.cts.docker,
configuration.transportRequestId, configuration.transportRequestId,
configuration.changeManagement.endpoint, configuration.changeManagement.endpoint,
configuration.changeManagement.credentialsId, configuration.changeManagement.credentialsId,

View File

@ -129,6 +129,7 @@ void call(parameters = [:]) {
case BackendType.SOLMAN: case BackendType.SOLMAN:
cm.uploadFileToTransportRequestSOLMAN( cm.uploadFileToTransportRequestSOLMAN(
configuration.changeManagement.solman?.docker ?: [:],
configuration.changeDocumentId, configuration.changeDocumentId,
configuration.transportRequestId, configuration.transportRequestId,
configuration.applicationId, configuration.applicationId,
@ -139,6 +140,7 @@ void call(parameters = [:]) {
break break
case BackendType.CTS: case BackendType.CTS:
cm.uploadFileToTransportRequestCTS( cm.uploadFileToTransportRequestCTS(
configuration.changeManagement.cts?.docker ?: [:],
configuration.transportRequestId, configuration.transportRequestId,
configuration.filePath, configuration.filePath,
configuration.changeManagement.endpoint, configuration.changeManagement.endpoint,
@ -148,7 +150,7 @@ void call(parameters = [:]) {
case BackendType.RFC: case BackendType.RFC:
cm.uploadFileToTransportRequestRFC( cm.uploadFileToTransportRequestRFC(
configuration.changeManagement.rfc.docker ?: [], configuration.changeManagement.rfc.docker ?: [:],
configuration.transportRequestId, configuration.transportRequestId,
configuration.applicationName, configuration.applicationName,
configuration.applicationUrl, configuration.applicationUrl,