mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
Merge pull request #175 from alejandraferreirovidal/changeParameters
change credentialsId and endpoint
This commit is contained in:
commit
cc9332ae79
@ -11,19 +11,19 @@ Creates a Transport Request for a Change Document on the Solution Manager.
|
||||
| -----------------|-----------|--------------------------------------------------------|--------------------|
|
||||
| `script` | yes | | |
|
||||
| `changeDocumentId` | yes | | |
|
||||
| `cmCredentialsId` | yes | | |
|
||||
| `cmEndpoint` | yes | | |
|
||||
| `credentialsId` | yes | | |
|
||||
| `endpoint` | yes | | |
|
||||
|
||||
* `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.
|
||||
* `cmCredentialsId` - The credentials to connect to the Solution Manager.
|
||||
* `cmEndpoint` - The address of the Solution Manager.
|
||||
* `credentialsId` - The credentials to connect to the Solution Manager.
|
||||
* `endpoint` - The address of the Solution Manager.
|
||||
|
||||
## Step configuration
|
||||
The following parameters can also be specified as step parameters using the global configuration file:
|
||||
|
||||
* `cmCredentialsId`
|
||||
* `cmEndpoint`
|
||||
* `credentialsId`
|
||||
* `endpoint`
|
||||
|
||||
## Return value
|
||||
The id of the Transport Request that has been created.
|
||||
|
@ -12,20 +12,20 @@ Releases a Transport Request for a Change Document on the Solution Manager.
|
||||
| `script` | yes | | |
|
||||
| `changeDocumentId` | yes | | |
|
||||
| `transportRequestId`| yes | | |
|
||||
| `cmCredentialsId` | yes | | |
|
||||
| `cmEndpoint` | yes | | |
|
||||
| `credentialsId` | yes | | |
|
||||
| `endpoint` | yes | | |
|
||||
|
||||
* `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 related to the transport request to release.
|
||||
* `transportRequestId` - The id of the transport request to release.
|
||||
* `cmCredentialsId` - The credentials to connect to the Solution Manager.
|
||||
* `cmEndpoint` - The address of the Solution Manager.
|
||||
* `credentialsId` - The credentials to connect to the Solution Manager.
|
||||
* `endpoint` - The address of the Solution Manager.
|
||||
|
||||
## Step configuration
|
||||
The following parameters can also be specified as step parameters using the global configuration file:
|
||||
|
||||
* `cmCredentialsId`
|
||||
* `cmEndpoint`
|
||||
* `credentialsId`
|
||||
* `endpoint`
|
||||
|
||||
## Return value
|
||||
None.
|
||||
|
@ -14,22 +14,22 @@ Uploads a file to a Transport Request for a Change Document on the Solution Mana
|
||||
| `transportRequestId`| yes | | |
|
||||
| `applicationId` | yes | | |
|
||||
| `filePath` | yes | | |
|
||||
| `cmCredentialsId` | yes | | |
|
||||
| `cmEndpoint` | yes | | |
|
||||
| `credentialsId` | yes | | |
|
||||
| `endpoint` | yes | | |
|
||||
|
||||
* `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 related to the transport request to release.
|
||||
* `transportRequestId` - The id of the transport request to release.
|
||||
* `applicationId` - The id of the application.
|
||||
* `filePath` - The path of the file to upload.
|
||||
* `cmCredentialsId` - The credentials to connect to the Solution Manager.
|
||||
* `cmEndpoint` - The address of the Solution Manager.
|
||||
* `credentialsId` - The credentials to connect to the Solution Manager.
|
||||
* `endpoint` - The address of the Solution Manager.
|
||||
|
||||
## Step configuration
|
||||
The following parameters can also be specified as step parameters using the global configuration file:
|
||||
|
||||
* `cmCredentialsId`
|
||||
* `cmEndpoint`
|
||||
* `credentialsId`
|
||||
* `endpoint`
|
||||
|
||||
## Return value
|
||||
None.
|
||||
|
@ -47,8 +47,8 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:
|
||||
[transportRequestCreate:
|
||||
[
|
||||
cmCredentialsId: 'CM',
|
||||
cmEndpoint: 'https://example.org/cm'
|
||||
credentialsId: 'CM',
|
||||
endpoint: 'https://example.org/cm'
|
||||
]
|
||||
]
|
||||
]
|
||||
|
@ -47,8 +47,8 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:
|
||||
[transportRequestRelease:
|
||||
[
|
||||
cmCredentialsId: 'CM',
|
||||
cmEndpoint: 'https://example.org/cm'
|
||||
credentialsId: 'CM',
|
||||
endpoint: 'https://example.org/cm'
|
||||
]
|
||||
]
|
||||
]
|
||||
|
@ -47,8 +47,8 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:
|
||||
[transportRequestUploadFile:
|
||||
[
|
||||
cmCredentialsId: 'CM',
|
||||
cmEndpoint: 'https://example.org/cm'
|
||||
credentialsId: 'CM',
|
||||
endpoint: 'https://example.org/cm'
|
||||
]
|
||||
]
|
||||
]
|
||||
|
@ -13,13 +13,13 @@ import hudson.AbortException
|
||||
@Field Set parameterKeys = [
|
||||
'changeDocumentId',
|
||||
'developmentSystemId',
|
||||
'cmCredentialsId',
|
||||
'cmEndpoint'
|
||||
'credentialsId',
|
||||
'endpoint'
|
||||
]
|
||||
|
||||
@Field Set stepConfigurationKeys = [
|
||||
'cmCredentialsId',
|
||||
'cmEndpoint'
|
||||
'credentialsId',
|
||||
'endpoint'
|
||||
]
|
||||
|
||||
def call(parameters = [:]) {
|
||||
@ -40,23 +40,23 @@ def call(parameters = [:]) {
|
||||
def developmentSystemId = configuration.developmentSystemId
|
||||
if(!developmentSystemId) throw new AbortException('Development system id not provided (parameter: \'developmentSystemId\').')
|
||||
|
||||
def cmCredentialsId = configuration.cmCredentialsId
|
||||
if(!cmCredentialsId) throw new AbortException('Credentials id not provided (parameter: \'cmCredentialsId\').')
|
||||
def credentialsId = configuration.credentialsId
|
||||
if(!credentialsId) throw new AbortException('Credentials id not provided (parameter: \'credentialsId\').')
|
||||
|
||||
def cmEndpoint = configuration.cmEndpoint
|
||||
if(!cmEndpoint) throw new AbortException('Solution Manager endpoint not provided (parameter: \'cmEndpoint\').')
|
||||
def endpoint = configuration.endpoint
|
||||
if(!endpoint) throw new AbortException('Solution Manager endpoint not provided (parameter: \'endpoint\').')
|
||||
|
||||
def transportRequestId
|
||||
|
||||
echo "[INFO] Creating transport request for change document '$changeDocumentId' and development system '$developmentSystemId'."
|
||||
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: cmCredentialsId,
|
||||
credentialsId: credentialsId,
|
||||
passwordVariable: 'password',
|
||||
usernameVariable: 'username')]) {
|
||||
|
||||
try {
|
||||
transportRequestId = cm.createTransportRequest(changeDocumentId, developmentSystemId, cmEndpoint, username, password)
|
||||
transportRequestId = cm.createTransportRequest(changeDocumentId, developmentSystemId, endpoint, username, password)
|
||||
} catch(ChangeManagementException ex) {
|
||||
throw new AbortException(ex.getMessage())
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ import hudson.AbortException
|
||||
@Field Set parameterKeys = [
|
||||
'changeDocumentId',
|
||||
'transportRequestId',
|
||||
'cmCredentialsId',
|
||||
'cmEndpoint'
|
||||
'credentialsId',
|
||||
'endpoint'
|
||||
]
|
||||
|
||||
@Field Set stepConfigurationKeys = [
|
||||
'cmCredentialsId',
|
||||
'cmEndpoint'
|
||||
'credentialsId',
|
||||
'endpoint'
|
||||
]
|
||||
|
||||
def call(parameters = [:]) {
|
||||
@ -40,21 +40,21 @@ def call(parameters = [:]) {
|
||||
def transportRequestId = configuration.transportRequestId
|
||||
if(!transportRequestId) throw new AbortException("Transport Request id not provided (parameter: 'transportRequestId').")
|
||||
|
||||
def cmCredentialsId = configuration.cmCredentialsId
|
||||
if(!cmCredentialsId) throw new AbortException("Credentials id not provided (parameter: 'cmCredentialsId').")
|
||||
def credentialsId = configuration.credentialsId
|
||||
if(!credentialsId) throw new AbortException("Credentials id not provided (parameter: 'credentialsId').")
|
||||
|
||||
def cmEndpoint = configuration.cmEndpoint
|
||||
if(!cmEndpoint) throw new AbortException("Solution Manager endpoint not provided (parameter: 'cmEndpoint').")
|
||||
def endpoint = configuration.endpoint
|
||||
if(!endpoint) throw new AbortException("Solution Manager endpoint not provided (parameter: 'endpoint').")
|
||||
|
||||
echo "[INFO] Closing transport request '$transportRequestId' for change document '$changeDocumentId'."
|
||||
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: cmCredentialsId,
|
||||
credentialsId: credentialsId,
|
||||
passwordVariable: 'password',
|
||||
usernameVariable: 'username')]) {
|
||||
|
||||
try {
|
||||
cm.releaseTransportRequest(changeDocumentId, transportRequestId, cmEndpoint, username, password)
|
||||
cm.releaseTransportRequest(changeDocumentId, transportRequestId, endpoint, username, password)
|
||||
} catch(ChangeManagementException ex) {
|
||||
throw new AbortException(ex.getMessage())
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ import hudson.AbortException
|
||||
'transportRequestId',
|
||||
'applicationId',
|
||||
'filePath',
|
||||
'cmCredentialsId',
|
||||
'cmEndpoint'
|
||||
'credentialsId',
|
||||
'endpoint'
|
||||
]
|
||||
|
||||
@Field Set generalConfigurationKeys = [
|
||||
'cmCredentialsId',
|
||||
'cmEndpoint'
|
||||
'credentialsId',
|
||||
'endpoint'
|
||||
]
|
||||
|
||||
def call(parameters = [:]) {
|
||||
@ -48,21 +48,21 @@ def call(parameters = [:]) {
|
||||
def filePath = configuration.filePath
|
||||
if(!filePath) throw new AbortException("File path not provided (parameter: 'filePath').")
|
||||
|
||||
def cmCredentialsId = configuration.cmCredentialsId
|
||||
if(!cmCredentialsId) throw new AbortException("Credentials id not provided (parameter: 'cmCredentialsId').")
|
||||
def credentialsId = configuration.credentialsId
|
||||
if(!credentialsId) throw new AbortException("Credentials id not provided (parameter: 'credentialsId').")
|
||||
|
||||
def cmEndpoint = configuration.cmEndpoint
|
||||
if(!cmEndpoint) throw new AbortException("Solution Manager endpoint not provided (parameter: 'cmEndpoint').")
|
||||
def endpoint = configuration.endpoint
|
||||
if(!endpoint) throw new AbortException("Solution Manager endpoint not provided (parameter: 'endpoint').")
|
||||
|
||||
echo "[INFO] Uploading file '$filePath' to transport request '$transportRequestId' of change document '$changeDocumentId'."
|
||||
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: cmCredentialsId,
|
||||
credentialsId: credentialsId,
|
||||
passwordVariable: 'password',
|
||||
usernameVariable: 'username')]) {
|
||||
|
||||
try {
|
||||
cm.uploadFileToTransportRequest(changeDocumentId, transportRequestId, applicationId, filePath, cmEndpoint, username, password)
|
||||
cm.uploadFileToTransportRequest(changeDocumentId, transportRequestId, applicationId, filePath, endpoint, username, password)
|
||||
} catch(ChangeManagementException ex) {
|
||||
throw new AbortException(ex.getMessage())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user