mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
docker params as map for fileUpload
This commit is contained in:
parent
2aa9f5215a
commit
dc1dfd622c
@ -17,8 +17,11 @@ general:
|
||||
to: 'HEAD'
|
||||
format: '%b'
|
||||
rfc:
|
||||
dockerImage: 'rfc'
|
||||
dockerOptions: []
|
||||
docker:
|
||||
image: 'rfc'
|
||||
options: []
|
||||
envVars: {}
|
||||
imagePull: true
|
||||
githubApiUrl: 'https://api.github.com'
|
||||
githubServerUrl: 'https://github.com'
|
||||
gitSshKeyCredentialsId: '' #needed to allow sshagent to run with local ssh key
|
||||
|
@ -64,7 +64,7 @@ public class ChangeManagement implements Serializable {
|
||||
}
|
||||
|
||||
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'],
|
||||
int rc = executeWithCredentials(BackendType.SOLMAN, [:], endpoint, credentialsId, 'is-change-in-development', ['-cID', "'${changeId}'", '--return-code'],
|
||||
false,
|
||||
clientOpts) as int
|
||||
|
||||
@ -79,7 +79,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
String createTransportRequestCTS(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, [:], endpoint, credentialsId, 'create-transport',
|
||||
['-tt', transportType, '-ts', targetSystemId, '-d', "\"${description}\""],
|
||||
true,
|
||||
clientOpts)
|
||||
@ -92,7 +92,7 @@ public class ChangeManagement implements Serializable {
|
||||
String createTransportRequestSOLMAN(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, [:], endpoint, credentialsId, 'create-transport', ['-cID', changeId, '-dID', developmentSystemId],
|
||||
true,
|
||||
clientOpts)
|
||||
return (transportRequest as String)?.trim()
|
||||
@ -121,8 +121,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
def transportRequestId = executeWithCredentials(
|
||||
BackendType.RFC,
|
||||
dockerImage,
|
||||
dockerOptions,
|
||||
[image: dockerImage, options: dockerOptions],
|
||||
endpoint,
|
||||
credentialsId,
|
||||
command,
|
||||
@ -154,8 +153,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.SOLMAN,
|
||||
'',
|
||||
[],
|
||||
[:],
|
||||
endpoint,
|
||||
credentialsId,
|
||||
'upload-file-to-transport',
|
||||
@ -183,8 +181,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.CTS,
|
||||
'',
|
||||
[],
|
||||
[:],
|
||||
endpoint,
|
||||
credentialsId,
|
||||
'upload-file-to-transport',
|
||||
@ -199,8 +196,7 @@ public class ChangeManagement implements Serializable {
|
||||
}
|
||||
|
||||
void uploadFileToTransportRequestRFC(
|
||||
String dockerImage,
|
||||
List dockerOptions,
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String applicationName,
|
||||
String filePath,
|
||||
@ -222,8 +218,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.RFC,
|
||||
dockerImage,
|
||||
dockerOptions,
|
||||
docker,
|
||||
endpoint,
|
||||
credentialsId,
|
||||
"cts uploadToABAP:${transportRequestId}",
|
||||
@ -238,8 +233,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
def executeWithCredentials(
|
||||
BackendType type,
|
||||
String dockerImage,
|
||||
List dockerOptions,
|
||||
Map docker,
|
||||
String endpoint,
|
||||
String credentialsId,
|
||||
String command,
|
||||
@ -283,8 +277,10 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
script.dockerExecute(
|
||||
script: script,
|
||||
dockerImage: dockerImage,
|
||||
dockerEnvVars: args ) {
|
||||
dockerImage: docker.image,
|
||||
dockerOptions: docker.options,
|
||||
dockerEnvVars: (docker.envVars?:[:]).plus(args),
|
||||
dockerPullImage: docker.pullImage) {
|
||||
|
||||
result = script.sh(shArgs)
|
||||
|
||||
@ -331,8 +327,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.SOLMAN,
|
||||
'',
|
||||
[],
|
||||
[:],
|
||||
endpoint,
|
||||
credentialsId,
|
||||
cmd,
|
||||
@ -358,8 +353,7 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.CTS,
|
||||
'',
|
||||
[],
|
||||
[:],
|
||||
endpoint,
|
||||
credentialsId,
|
||||
cmd,
|
||||
@ -388,8 +382,8 @@ public class ChangeManagement implements Serializable {
|
||||
|
||||
int rc = executeWithCredentials(
|
||||
BackendType.RFC,
|
||||
dockerImage,
|
||||
dockerOptions,
|
||||
[image: dockerImage,
|
||||
options: dockerOptions],
|
||||
endpoint,
|
||||
credentialsId,
|
||||
cmd,
|
||||
|
@ -155,7 +155,10 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
credentialsId: 'CM',
|
||||
type: 'RFC',
|
||||
endpoint: 'https://example.org/rfc',
|
||||
rfc: [dockerImage: 'rfc']
|
||||
rfc: [
|
||||
dockerImage: 'rfc',
|
||||
dockerOptions: [],
|
||||
]
|
||||
]
|
||||
|
||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
||||
|
@ -225,8 +225,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
def cm = new ChangeManagement(nullScript) {
|
||||
|
||||
void uploadFileToTransportRequestRFC(
|
||||
String dockerImage,
|
||||
List dockerOptions,
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
String applicationURL,
|
||||
@ -238,8 +237,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
String abapPackage) {
|
||||
|
||||
cmUtilsReceivedParams = [
|
||||
dockerImage: dockerImage,
|
||||
dockerOptions: dockerOptions,
|
||||
docker: docker,
|
||||
transportRequestId: transportRequestId,
|
||||
applicationName: applicationId,
|
||||
applicationURL: applicationURL,
|
||||
@ -269,8 +267,12 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
assert cmUtilsReceivedParams ==
|
||||
[
|
||||
dockerImage: 'rfc',
|
||||
dockerOptions: [],
|
||||
docker: [
|
||||
image: 'rfc',
|
||||
options: [],
|
||||
envVars: [:],
|
||||
imagePull: true
|
||||
],
|
||||
transportRequestId: '123456',
|
||||
applicationName: '42',
|
||||
applicationURL: 'http://example.org/blobstore/xyz.zip',
|
||||
@ -292,8 +294,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
def cm = new ChangeManagement(nullScript) {
|
||||
|
||||
void uploadFileToTransportRequestRFC(
|
||||
String dockerImage,
|
||||
List dockerOptions,
|
||||
Map docker,
|
||||
String transportRequestId,
|
||||
String applicationId,
|
||||
String applicationURL,
|
||||
@ -313,6 +314,12 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
changeManagement: [
|
||||
type: 'RFC',
|
||||
rfc: [
|
||||
docker: [
|
||||
image: 'rfc',
|
||||
options: [],
|
||||
envVars: [:],
|
||||
imagePull: false,
|
||||
],
|
||||
developmentClient: '002',
|
||||
developmentInstance: '001',
|
||||
]
|
||||
|
@ -277,8 +277,7 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
public void testUploadFileToTransportSucceedsRFC() {
|
||||
|
||||
new ChangeManagement(nullScript).uploadFileToTransportRequestRFC(
|
||||
'rfc',
|
||||
[],
|
||||
[image:'rfc', options: [], pullImage: true],
|
||||
'002', //transportRequestId
|
||||
'001', // applicationId
|
||||
'https://example.org/mypath/deployArtifact.zip',
|
||||
@ -290,7 +289,9 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
'XYZ' // abapPackage
|
||||
)
|
||||
|
||||
|
||||
assert dockerExecuteRule.dockerParams.dockerImage == 'rfc'
|
||||
assert dockerExecuteRule.dockerParams.dockerPullImage == true
|
||||
|
||||
assert dockerExecuteRule.dockerParams.dockerEnvVars ==
|
||||
[
|
||||
@ -317,8 +318,7 @@ public void testGetCommandLineWithCMClientOpts() {
|
||||
script.setReturnValue('cts uploadToABAP:002', 1)
|
||||
|
||||
new ChangeManagement(nullScript).uploadFileToTransportRequestRFC(
|
||||
'rfc',
|
||||
[],
|
||||
[:],
|
||||
'002', //transportRequestId
|
||||
'001', // applicationId
|
||||
'https://example.org/mypath/deployArtifact.zip',
|
||||
|
@ -68,6 +68,10 @@ void call(parameters = [:]) {
|
||||
.withMandatoryProperty('applicationUrl', null, { backendType == BackendType.RFC })
|
||||
.withMandatoryProperty('changeManagement/rfc/developmentInstance', null, { backendType == BackendType.RFC })
|
||||
.withMandatoryProperty('changeManagement/rfc/developmentClient', null, { backendType == BackendType.RFC })
|
||||
.withMandatoryProperty('changeManagement/rfc/docker/image', null, {backendType == BackendType.RFC})
|
||||
.withMandatoryProperty('changeManagement/rfc/docker/options', null, {backendType == BackendType.RFC})
|
||||
.withMandatoryProperty('changeManagement/rfc/docker/envVars', null, {backendType == BackendType.RFC})
|
||||
.withMandatoryProperty('changeManagement/rfc/docker/imagePull', null, {backendType == BackendType.RFC})
|
||||
.withMandatoryProperty('applicationDescription', null, { backendType == BackendType.RFC })
|
||||
.withMandatoryProperty('abapPackage', null, { backendType == BackendType.RFC })
|
||||
.withMandatoryProperty('applicationId', null, {backendType == BackendType.SOLMAN})
|
||||
@ -137,8 +141,7 @@ void call(parameters = [:]) {
|
||||
case BackendType.RFC:
|
||||
|
||||
cm.uploadFileToTransportRequestRFC(
|
||||
configuration.changeManagement.rfc.dockerImage,
|
||||
configuration.changeManagement.rfc.dockerOptions ?: [],
|
||||
configuration.changeManagement.rfc.docker ?: [],
|
||||
configuration.transportRequestId,
|
||||
configuration.applicationName,
|
||||
configuration.applicationUrl,
|
||||
|
Loading…
Reference in New Issue
Block a user