mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
Support cmclient_opts in transportRequestCreate
This commit is contained in:
parent
8c4c76dd05
commit
74b6ac0c8e
@ -13,17 +13,20 @@ Creates a Transport Request for a Change Document on the Solution Manager.
|
||||
| `changeDocumentId` | yes | | |
|
||||
| `credentialsId` | yes | | |
|
||||
| `endpoint` | yes | | |
|
||||
| `clientOpts` | no | | |
|
||||
|
||||
* `script` - The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the `this` parameter, as in `script: this`. This allows the function to access the [`commonPipelineEnvironment`](commonPipelineEnvironment.md) for retrieving, for example, configuration parameters.
|
||||
* `changeDocumentId` - The id of the change document to transport.
|
||||
* `credentialsId` - The credentials to connect to the Solution Manager.
|
||||
* `endpoint` - The address of the Solution Manager.
|
||||
* `clientOpts`- Options forwarded to JVM used by the CM client, like `JAVA_OPTS`
|
||||
|
||||
## Step configuration
|
||||
The following parameters can also be specified as step parameters using the global configuration file:
|
||||
|
||||
* `credentialsId`
|
||||
* `endpoint`
|
||||
* `clientOpts`
|
||||
|
||||
## Return value
|
||||
The id of the Transport Request that has been created.
|
||||
|
@ -78,12 +78,13 @@ public class ChangeManagement implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
String createTransportRequest(String changeId, String developmentSystemId, String endpoint, String username, String password) {
|
||||
String createTransportRequest(String changeId, String developmentSystemId, String endpoint, String username, String password, String clientOpts = '') {
|
||||
|
||||
try {
|
||||
String transportRequest = script.sh(returnStdout: true,
|
||||
script: getCMCommandLine(endpoint, username, password, 'create-transport', ['-cID', changeId,
|
||||
'-dID', developmentSystemId]))
|
||||
'-dID', developmentSystemId],
|
||||
clientOpts))
|
||||
return transportRequest.trim()
|
||||
} catch(AbortException e) {
|
||||
throw new ChangeManagementException("Cannot create a transport request for change id '$changeId'. $e.message.")
|
||||
|
@ -51,7 +51,8 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
[transportRequestCreate:
|
||||
[
|
||||
credentialsId: 'CM',
|
||||
endpoint: 'https://example.org/cm'
|
||||
endpoint: 'https://example.org/cm',
|
||||
clientOpts: '-DmyProp=myVal'
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -84,7 +85,8 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
String developmentSystemId,
|
||||
String cmEndpoint,
|
||||
String username,
|
||||
String password) {
|
||||
String password,
|
||||
String clientOpts) {
|
||||
|
||||
throw new ChangeManagementException('Exception message.')
|
||||
}
|
||||
@ -108,13 +110,15 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
String developmentSystemId,
|
||||
String cmEndpoint,
|
||||
String username,
|
||||
String password) {
|
||||
String password,
|
||||
String clientOpts) {
|
||||
|
||||
result.changeId = changeId
|
||||
result.developmentSystemId = developmentSystemId
|
||||
result.cmEndpoint = cmEndpoint
|
||||
result.username = username
|
||||
result.password = password
|
||||
result.clientOpts = clientOpts
|
||||
return '001'
|
||||
}
|
||||
}
|
||||
@ -126,7 +130,8 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
developmentSystemId: '001',
|
||||
cmEndpoint: 'https://example.org/cm',
|
||||
username: 'anonymous',
|
||||
password: '********'
|
||||
password: '********',
|
||||
clientOpts: '-DmyProp=myVal'
|
||||
]
|
||||
|
||||
assert jlr.log.contains("[INFO] Creating transport request for change document '001' and development system '001'.")
|
||||
|
@ -12,6 +12,7 @@ import hudson.AbortException
|
||||
|
||||
@Field Set parameterKeys = [
|
||||
'changeDocumentId',
|
||||
'clientOpts',
|
||||
'developmentSystemId',
|
||||
'credentialsId',
|
||||
'endpoint'
|
||||
@ -19,6 +20,7 @@ import hudson.AbortException
|
||||
|
||||
@Field Set stepConfigurationKeys = [
|
||||
'credentialsId',
|
||||
'clientOpts',
|
||||
'endpoint'
|
||||
]
|
||||
|
||||
@ -56,7 +58,7 @@ def call(parameters = [:]) {
|
||||
usernameVariable: 'username')]) {
|
||||
|
||||
try {
|
||||
transportRequestId = cm.createTransportRequest(changeDocumentId, developmentSystemId, endpoint, username, password)
|
||||
transportRequestId = cm.createTransportRequest(changeDocumentId, developmentSystemId, endpoint, username, password, configuration.clientOpts)
|
||||
} catch(ChangeManagementException ex) {
|
||||
throw new AbortException(ex.getMessage())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user