mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
Merge branch 'master' into master
This commit is contained in:
commit
020a5aaadd
@ -16,6 +16,18 @@ general:
|
||||
from: 'origin/master'
|
||||
to: 'HEAD'
|
||||
format: '%b'
|
||||
solman:
|
||||
docker:
|
||||
image: 'ppiper/cm-client'
|
||||
options: []
|
||||
envVars: {}
|
||||
pullImage: true
|
||||
cts:
|
||||
docker:
|
||||
image: 'ppiper/cm-client'
|
||||
options: []
|
||||
envVars: {}
|
||||
pullImage: true
|
||||
rfc:
|
||||
docker:
|
||||
image: 'rfc'
|
||||
|
@ -63,8 +63,8 @@ public class ChangeManagement implements Serializable {
|
||||
return items[0]
|
||||
}
|
||||
|
||||
boolean isChangeInDevelopment(String changeId, String endpoint, String credentialsId, String clientOpts = '') {
|
||||
int rc = executeWithCredentials(BackendType.SOLMAN, [:], endpoint, credentialsId, 'is-change-in-development', ['-cID', "'${changeId}'", '--return-code'],
|
||||
boolean isChangeInDevelopment(Map docker, String changeId, String endpoint, String credentialsId, String clientOpts = '') {
|
||||
int rc = executeWithCredentials(BackendType.SOLMAN, docker, endpoint, credentialsId, 'is-change-in-development', ['-cID', "'${changeId}'", '--return-code'],
|
||||
false,
|
||||
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 {
|
||||
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)
|
||||
@ -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 {
|
||||
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,
|
||||
clientOpts)
|
||||
return (transportRequest as String)?.trim()
|
||||
@ -138,6 +138,7 @@ public class ChangeManagement implements Serializable {
|
||||
}
|
||||
|
||||
void uploadFileToTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
@ -154,7 +155,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.SOLMAN,
|
||||
[:],
|
||||
docker,
|
||||
endpoint,
|
||||
credentialsId,
|
||||
'upload-file-to-transport',
|
||||
@ -169,6 +170,7 @@ public class ChangeManagement implements Serializable {
|
||||
}
|
||||
|
||||
void uploadFileToTransportRequestCTS(
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String filePath,
|
||||
String endpoint,
|
||||
@ -182,7 +184,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.CTS,
|
||||
[:],
|
||||
docker,
|
||||
endpoint,
|
||||
credentialsId,
|
||||
'upload-file-to-transport',
|
||||
@ -251,6 +253,9 @@ public class ChangeManagement implements Serializable {
|
||||
String clientOpts = '') {
|
||||
|
||||
def script = this.script
|
||||
|
||||
docker = docker ?: [:]
|
||||
|
||||
script.withCredentials([script.usernamePassword(
|
||||
credentialsId: credentialsId,
|
||||
passwordVariable: 'password',
|
||||
@ -263,6 +268,8 @@ public class ChangeManagement implements Serializable {
|
||||
else
|
||||
shArgs.put('returnStatus', true)
|
||||
|
||||
Map dockerEnvVars = docker.envVars ?: [:]
|
||||
|
||||
def result = 1
|
||||
|
||||
switch(type) {
|
||||
@ -281,19 +288,7 @@ public class ChangeManagement implements Serializable {
|
||||
ABAP_DEVELOPMENT_PASSWORD: script.password,
|
||||
])
|
||||
|
||||
// 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: (docker.envVars?:[:]).plus(args),
|
||||
dockerPullImage: docker.pullImage) {
|
||||
|
||||
result = script.sh(shArgs)
|
||||
|
||||
}
|
||||
dockerEnvVars += args
|
||||
|
||||
break
|
||||
|
||||
@ -307,19 +302,29 @@ public class ChangeManagement implements Serializable {
|
||||
command, args,
|
||||
clientOpts)
|
||||
|
||||
// user and password are masked by withCredentials
|
||||
script.echo """[INFO] Executing command line: "${shArgs.script}"."""
|
||||
break
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
void releaseTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String endpoint,
|
||||
@ -336,7 +341,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.SOLMAN,
|
||||
[:],
|
||||
docker,
|
||||
endpoint,
|
||||
credentialsId,
|
||||
cmd,
|
||||
@ -350,6 +355,7 @@ public class ChangeManagement implements Serializable {
|
||||
}
|
||||
|
||||
void releaseTransportRequestCTS(
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String endpoint,
|
||||
String credentialsId,
|
||||
@ -363,7 +369,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.CTS,
|
||||
[:],
|
||||
docker,
|
||||
endpoint,
|
||||
credentialsId,
|
||||
cmd,
|
||||
|
@ -52,6 +52,12 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
|
||||
failIfStatusIsNotInDevelopment: true)
|
||||
|
||||
assert cmUtilReceivedParams == [
|
||||
docker: [
|
||||
image: 'ppiper/cm-client',
|
||||
options:[],
|
||||
envVars:[:],
|
||||
pullImage:true,
|
||||
],
|
||||
changeId: '001',
|
||||
endpoint: 'https://example.org/cm',
|
||||
credentialsId: 'CM',
|
||||
@ -184,7 +190,8 @@ class CheckChangeInDevelopmentTest extends BasePiperTest {
|
||||
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.endpoint = endpoint
|
||||
cmUtilReceivedParams.credentialsId = credentialsId
|
||||
|
@ -94,6 +94,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
|
||||
String createTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String developmentSystemId,
|
||||
String cmEndpoint,
|
||||
@ -119,12 +120,14 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
|
||||
String createTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String developmentSystemId,
|
||||
String cmEndpoint,
|
||||
String credentialId,
|
||||
String clientOpts) {
|
||||
|
||||
result.docker = docker
|
||||
result.changeId = changeId
|
||||
result.developmentSystemId = developmentSystemId
|
||||
result.cmEndpoint = cmEndpoint
|
||||
@ -137,7 +140,14 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
stepRule.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
|
||||
|
||||
assert nullScript.commonPipelineEnvironment.getTransportRequestId() == '001'
|
||||
assert result == [changeId: '001',
|
||||
assert result == [
|
||||
docker: [
|
||||
image: 'ppiper/cm-client',
|
||||
pullImage: true,
|
||||
options: [],
|
||||
envVars: [:],
|
||||
],
|
||||
changeId: '001',
|
||||
developmentSystemId: '001',
|
||||
cmEndpoint: 'https://example.org/cm',
|
||||
credentialId: 'CM',
|
||||
@ -156,12 +166,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 +192,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',
|
||||
|
@ -97,6 +97,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
|
||||
void releaseTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String endpoint,
|
||||
@ -126,6 +127,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
|
||||
void releaseTransportRequestCTS(
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String endpoint,
|
||||
String credentialsId,
|
||||
@ -229,12 +231,14 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void releaseTransportRequestCTS(
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String endpoint,
|
||||
String credentialsId,
|
||||
String clientOpts = '') {
|
||||
|
||||
receivedParameters = [
|
||||
docker: docker,
|
||||
transportRequestId: transportRequestId,
|
||||
endpoint: endpoint,
|
||||
credentialsId: credentialsId,
|
||||
@ -249,6 +253,12 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
cmUtils: cm)
|
||||
|
||||
assert receivedParameters == [
|
||||
docker: [
|
||||
image:'ppiper/cm-client',
|
||||
options:[],
|
||||
envVars:[:],
|
||||
pullImage:true,
|
||||
],
|
||||
transportRequestId: '002',
|
||||
endpoint: 'https://example.org/cts',
|
||||
credentialsId: 'CM',
|
||||
@ -374,12 +384,14 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void releaseTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String endpoint,
|
||||
String credentialsId,
|
||||
String clientOpts) {
|
||||
|
||||
receivedParams.docker = docker
|
||||
receivedParams.changeId = changeId
|
||||
receivedParams.transportRequestId = transportRequestId
|
||||
receivedParams.endpoint = endpoint
|
||||
@ -391,6 +403,12 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
stepRule.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '002', cmUtils: cm)
|
||||
|
||||
assert receivedParams == [
|
||||
docker: [
|
||||
image: 'ppiper/cm-client',
|
||||
pullImage: true,
|
||||
envVars: [:],
|
||||
options: [],
|
||||
],
|
||||
changeId: '001',
|
||||
transportRequestId: '002',
|
||||
endpoint: 'https://example.org/cm',
|
||||
|
@ -21,6 +21,7 @@ import util.JenkinsCredentialsRule
|
||||
import util.JenkinsStepRule
|
||||
import util.JenkinsLoggingRule
|
||||
import util.JenkinsReadYamlRule
|
||||
import util.JenkinsDockerExecuteRule
|
||||
import util.Rules
|
||||
|
||||
import hudson.AbortException
|
||||
@ -129,6 +130,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void uploadFileToTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
@ -159,12 +161,14 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void uploadFileToTransportRequestCTS(
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String filePath,
|
||||
String endpoint,
|
||||
String credentialsId,
|
||||
String cmclientOpts) {
|
||||
|
||||
cmUtilReceivedParams.docker = docker
|
||||
cmUtilReceivedParams.transportRequestId = transportRequestId
|
||||
cmUtilReceivedParams.filePath = filePath
|
||||
cmUtilReceivedParams.endpoint = endpoint
|
||||
@ -181,12 +185,19 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
assert cmUtilReceivedParams ==
|
||||
[
|
||||
docker: [
|
||||
image: 'ppiper/cm-client',
|
||||
options:[],
|
||||
envVars:[:],
|
||||
pullImage:true
|
||||
],
|
||||
transportRequestId: '002',
|
||||
filePath: '/path',
|
||||
endpoint: 'https://example.org/cm',
|
||||
credentialsId: 'CM',
|
||||
cmclientOpts: ''
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -361,6 +372,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void uploadFileToTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
@ -369,6 +381,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
String credentialsId,
|
||||
String cmclientOpts) {
|
||||
|
||||
cmUtilReceivedParams.docker = docker
|
||||
cmUtilReceivedParams.changeId = changeId
|
||||
cmUtilReceivedParams.transportRequestId = transportRequestId
|
||||
cmUtilReceivedParams.applicationId = applicationId
|
||||
@ -388,6 +401,12 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
assert cmUtilReceivedParams ==
|
||||
[
|
||||
docker: [
|
||||
image: 'ppiper/cm-client',
|
||||
pullImage: true,
|
||||
envVars: [:],
|
||||
options: [],
|
||||
],
|
||||
changeId: '001',
|
||||
transportRequestId: '002',
|
||||
applicationId: 'app',
|
||||
@ -407,6 +426,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void uploadFileToTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
@ -437,6 +457,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void uploadFileToTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
@ -467,6 +488,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void uploadFileToTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
@ -496,6 +518,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
void uploadFileToTransportRequestSOLMAN(
|
||||
Map docker,
|
||||
String changeId,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
|
@ -96,7 +96,12 @@ public class ChangeManagementTest extends BasePiperTest {
|
||||
public void testIsChangeInDevelopmentReturnsTrueWhenChangeIsInDevelopent() {
|
||||
|
||||
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(script.shell[0], allOf(containsString("cmclient"),
|
||||
@ -106,6 +111,9 @@ public class ChangeManagementTest extends BasePiperTest {
|
||||
containsString('is-change-in-development'),
|
||||
containsString("-cID '001'"),
|
||||
containsString("-t SOLMAN")))
|
||||
|
||||
assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
|
||||
assert dockerExecuteRule.getDockerParams().dockerPullImage == true
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -114,7 +122,8 @@ public class ChangeManagementTest extends BasePiperTest {
|
||||
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, "cmclient.*is-change-in-development -cID '001'", 3)
|
||||
|
||||
boolean inDevelopment = new ChangeManagement(nullScript, null)
|
||||
.isChangeInDevelopment('001',
|
||||
.isChangeInDevelopment([:],
|
||||
'001',
|
||||
'endpoint',
|
||||
'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.')
|
||||
|
||||
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
|
||||
@ -163,12 +172,20 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
public void testCreateTransportRequestSOLMANSucceeds() {
|
||||
|
||||
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
|
||||
// returned only in case the shell call matches.
|
||||
assert transportRequestId == '004'
|
||||
|
||||
assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
|
||||
assert dockerExecuteRule.getDockerParams().dockerPullImage == true
|
||||
|
||||
}
|
||||
|
||||
@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')
|
||||
def transportRequestId = new ChangeManagement(nullScript)
|
||||
.createTransportRequestCTS(
|
||||
[
|
||||
image: 'ppiper/cmclient',
|
||||
pullImage: true
|
||||
],
|
||||
'W', // transport type
|
||||
'XYZ', // target system
|
||||
'desc 123', // description
|
||||
@ -238,6 +259,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
|
||||
@ -247,6 +271,10 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'upload-file-to-transport.*-cID 001 -tID 002 XXX "/path"', 0)
|
||||
|
||||
new ChangeManagement(nullScript).uploadFileToTransportRequestSOLMAN(
|
||||
[
|
||||
image: 'ppiper/cm-client',
|
||||
imagePull: true,
|
||||
],
|
||||
'001',
|
||||
'002',
|
||||
'XXX',
|
||||
@ -254,8 +282,12 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
'https://example.org/cm',
|
||||
'me')
|
||||
|
||||
// no assert required here, since the regex registered above to the script rule is an implicit check for
|
||||
// the command line.
|
||||
// no assert required here for the shell script, since the regex registered above
|
||||
// to the script rule is an implicit check for the command line.
|
||||
|
||||
dockerExecuteRule.getDockerParams().dockerImage = 'ppiper/cmclient'
|
||||
dockerExecuteRule.getDockerParams().dockerPullImage = true
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -265,13 +297,20 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t CTS upload-file-to-transport -tID 002 "/path"', 0)
|
||||
|
||||
new ChangeManagement(nullScript).uploadFileToTransportRequestCTS(
|
||||
[
|
||||
image: 'ppiper/cmclient',
|
||||
pullImage: true
|
||||
],
|
||||
'002',
|
||||
'/path',
|
||||
'https://example.org/cm',
|
||||
'me')
|
||||
|
||||
// no assert required here, since the regex registered above to the script rule is an implicit check for
|
||||
// the command line.
|
||||
assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cmclient'
|
||||
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
|
||||
@ -354,6 +393,7 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
script.setReturnValue(JenkinsShellCallRule.Type.REGEX,, 'upload-file-to-transport', 1)
|
||||
|
||||
new ChangeManagement(nullScript).uploadFileToTransportRequestSOLMAN(
|
||||
[:],
|
||||
'001',
|
||||
'002',
|
||||
'XXX',
|
||||
@ -369,6 +409,10 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t SOLMAN release-transport.*-cID 001.*-tID 002', 0)
|
||||
|
||||
new ChangeManagement(nullScript).releaseTransportRequestSOLMAN(
|
||||
[
|
||||
image: 'ppiper/cm-client',
|
||||
imagePull: true,
|
||||
],
|
||||
'001',
|
||||
'002',
|
||||
'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
|
||||
// the command line.
|
||||
|
||||
dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
|
||||
dockerExecuteRule.getDockerParams().pullImage == true
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -386,6 +433,10 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, '-t CTS export-transport.*-tID 002', 0)
|
||||
|
||||
new ChangeManagement(nullScript).releaseTransportRequestCTS(
|
||||
[
|
||||
image: 'ppiper/cm-client',
|
||||
pullImage: true,
|
||||
],
|
||||
'002',
|
||||
'https://example.org',
|
||||
'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
|
||||
// the command line.
|
||||
|
||||
assert dockerExecuteRule.getDockerParams().dockerImage == 'ppiper/cm-client'
|
||||
assert dockerExecuteRule.getDockerParams().dockerPullImage == true
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -429,6 +483,10 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
script.setReturnValue(JenkinsShellCallRule.Type.REGEX, 'release-transport.*-cID 001.*-tID 002', 1)
|
||||
|
||||
new ChangeManagement(nullScript).releaseTransportRequestSOLMAN(
|
||||
[
|
||||
image: 'ppiper/cm-client',
|
||||
imagePull: true,
|
||||
],
|
||||
'001',
|
||||
'002',
|
||||
'https://example.org',
|
||||
|
@ -115,7 +115,9 @@ void call(parameters = [:]) {
|
||||
|
||||
try {
|
||||
|
||||
isInDevelopment = cm.isChangeInDevelopment(configuration.changeDocumentId,
|
||||
isInDevelopment = cm.isChangeInDevelopment(
|
||||
configuration.changeManagement.solman.docker,
|
||||
configuration.changeDocumentId,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.credentialsId,
|
||||
configuration.changeManagement.clientOpts)
|
||||
|
@ -97,6 +97,7 @@ void call(parameters = [:]) {
|
||||
try {
|
||||
if(backendType == BackendType.SOLMAN) {
|
||||
transportRequestId = cm.createTransportRequestSOLMAN(
|
||||
configuration.changeManagement.solman.docker,
|
||||
configuration.changeDocumentId,
|
||||
configuration.developmentSystemId,
|
||||
configuration.changeManagement.endpoint,
|
||||
@ -104,6 +105,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,
|
||||
|
@ -100,6 +100,7 @@ void call(parameters = [:]) {
|
||||
case BackendType.SOLMAN:
|
||||
|
||||
cm.releaseTransportRequestSOLMAN(
|
||||
configuration.changeManagement.solman.docker,
|
||||
configuration.changeDocumentId,
|
||||
configuration.transportRequestId,
|
||||
configuration.changeManagement.endpoint,
|
||||
@ -110,6 +111,7 @@ void call(parameters = [:]) {
|
||||
case BackendType.CTS:
|
||||
|
||||
cm.releaseTransportRequestCTS(
|
||||
configuration.changeManagement.cts.docker,
|
||||
configuration.transportRequestId,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.credentialsId,
|
||||
|
@ -129,6 +129,7 @@ void call(parameters = [:]) {
|
||||
|
||||
case BackendType.SOLMAN:
|
||||
cm.uploadFileToTransportRequestSOLMAN(
|
||||
configuration.changeManagement.solman?.docker ?: [:],
|
||||
configuration.changeDocumentId,
|
||||
configuration.transportRequestId,
|
||||
configuration.applicationId,
|
||||
@ -139,6 +140,7 @@ void call(parameters = [:]) {
|
||||
break
|
||||
case BackendType.CTS:
|
||||
cm.uploadFileToTransportRequestCTS(
|
||||
configuration.changeManagement.cts?.docker ?: [:],
|
||||
configuration.transportRequestId,
|
||||
configuration.filePath,
|
||||
configuration.changeManagement.endpoint,
|
||||
@ -148,7 +150,7 @@ void call(parameters = [:]) {
|
||||
case BackendType.RFC:
|
||||
|
||||
cm.uploadFileToTransportRequestRFC(
|
||||
configuration.changeManagement.rfc.docker ?: [],
|
||||
configuration.changeManagement.rfc.docker ?: [:],
|
||||
configuration.transportRequestId,
|
||||
configuration.applicationName,
|
||||
configuration.applicationUrl,
|
||||
|
Loading…
Reference in New Issue
Block a user