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

isChangeInDevelopment documentation (#3140)

* checkChangeInDevelopment to GO
- add groovy step isChangeInDevelopment
- direct to new Groovy
- direct to GO
This commit is contained in:
Roland Stengel 2021-10-18 15:16:22 +02:00 committed by GitHub
parent 10b3598ca4
commit a0f9c3669f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 115 additions and 10 deletions

View File

@ -54,7 +54,7 @@ func (p *isChangeInDevelopmentCommonPipelineEnvironment) persist(path, resourceN
}
}
// IsChangeInDevelopmentCommand Checks if a certain change is in status 'in development'
// IsChangeInDevelopmentCommand This step checks if a certain change is in status 'in development'
func IsChangeInDevelopmentCommand() *cobra.Command {
const STEP_NAME = "isChangeInDevelopment"
@ -66,8 +66,8 @@ func IsChangeInDevelopmentCommand() *cobra.Command {
var createIsChangeInDevelopmentCmd = &cobra.Command{
Use: STEP_NAME,
Short: "Checks if a certain change is in status 'in development'",
Long: `"Checks if a certain change is in status 'in development'"`,
Short: "This step checks if a certain change is in status 'in development'",
Long: `This step checks if a certain change is in status 'in development'`,
PreRunE: func(cmd *cobra.Command, _ []string) error {
startTime = time.Now()
log.SetStepName(STEP_NAME)
@ -161,7 +161,7 @@ func isChangeInDevelopmentMetadata() config.StepData {
Metadata: config.StepMetadata{
Name: "isChangeInDevelopment",
Aliases: []config.Alias{},
Description: "Checks if a certain change is in status 'in development'",
Description: "This step checks if a certain change is in status 'in development'",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -2,9 +2,34 @@
## ${docGenDescription}
## Prerequisites
## Migration Guide
* No prerequisites
**Note:** This step has been deprecated. Use the new step [isChangeInDevelopment](isChangeInDevelopment.md) instead.
Adjust your parameters to the naming convention of the new step.
Adjust the unsupported parameters as indicated in the table below:
| Unsupported Parameter | New Parameter |
| ------------- | ------------- |
| changeManagement/type | This parameter has been removed. `SOLMAN` is the only backend type supported. |
| changeManagement/`<type>`/docker/envVars | `dockerEnvVars` |
| changeManagement/`<type>`/docker/image | `dockerImage` |
| changeManagement/`<type>`/docker/options | `dockerOptions` |
| changeManagement/`<type>`/docker/pullImage | `dockerPullImage` |
| changeManagement/git/format | This parameter has been removed. Make sure that the IDS of your change document and transport request are part of the Git commit message body. |
Your config.yml file should look as follows:
```yaml
general:
# new naming convention
steps:
isChangeInDevelopment:
dockerImage: 'ppiper/cm-client'
```
**Note:** The new step does not comprise the retrieval of the change document ID from the Git repository anymore. Use the step [transportRequestDocIDFromGit](transportRequestDocIDFromGit.md) instead.
## ${docGenParameters}

View File

@ -0,0 +1,79 @@
# ${docGenStepName}
## ${docGenDescription}
## Prerequisites
* You have an SAP Solution Manager user to which you have assigned the roles required for uploading. See [SAP Solution Manager Administration](https://help.sap.com/viewer/c413647f87a54db59d18cb074ce3dafd/7.2.12/en-US/11505ddff03c4d74976dae648743e10e.html).
* You have created a change document.
* You have installed the Change Management Client with the needed certificates. See [Change Management Client](transportRequestUploadSOLMAN.md#Change-Management-Client).
## Specifying the Change Document
The target of the status check is a change document identified by an identifier (ID).
Specify the ID by [step parameter](transportRequestUploadSOLMAN#By-Step-Parameter) or [common pipeline environment](transportRequestUploadSOLMAN#Common-Pipeline-Environment).
## Return Value
The step `isChangeInDevelopment` returns a boolean value by setting the custom key
`custom.isChangeInDevelopment` of the common pipeline environment:
- `true` if the change document is in status `in development`.
- `false` if the change document is _**not**_ in status `in development`. In this case, `AbortException` terminates the execution of the pipeline job.
```groovy
// pipeline script
isChangeInDevelopment( script: this )
...
```
You can omit this exception by setting the configuration parameter `failIfStatusIsNotInDevelopment` to `false`:
```groovy
// pipeline script
isChangeInDevelopment( script: this, failIfStatusIsNotInDevelopment: false )
if(commonPipelineEnvironment.getValue( 'isChangeInDevelopment' ) {
...
}
```
## ${docGenParameters}
## ${docGenConfiguration}
## ${docJenkinsPluginDependencies}
## Examples
```yaml
# config.yaml
general:
changeManagement:
credentialsId: 'SOLMAN_CRED_ID'
endpoint: 'https://example.org/cm/solman/endpoint'
steps:
isChangeInDevelopment:
dockerImage: 'ppiper/cm-client'
transportRequestUploadSOLMAN:
dockerImage: 'ppiper/cm-client'
applicationId: 'APPID',
filePath: '/path/file.ext',
```
```groovy
// pipeline script
...
stage('Upload') {
transportRequestDocIDFromGit( script: this )
isChangeInDevelopment( script: this )
transportRequestReqIDFromGit( script: this )
transportRequestUploadSOLMAN( script: this )
}
```

View File

@ -7,7 +7,7 @@
* You have an SAP Solution Manager user account and the roles required for uploading. See [SAP Solution Manager Administration](https://help.sap.com/viewer/c413647f87a54db59d18cb074ce3dafd/7.2.12/en-US/11505ddff03c4d74976dae648743e10e.html).
* You have a change document to which your transport request is coupled.
* You have a transport request, which is the target container of the upload.
* You have installed the Change Management Client with the needed certificates. See [Change Management Client](#Change Management Client).
* You have installed the Change Management Client with the needed certificates. See [Change Management Client](#Change-Management-Client).
## Change Management Client

View File

@ -67,7 +67,6 @@ nav:
- artifactPrepareVersion: steps/artifactPrepareVersion.md
- batsExecuteTests: steps/batsExecuteTests.md
- buildExecute: steps/buildExecute.md
- checkChangeInDevelopment: steps/checkChangeInDevelopment.md
- checkmarxExecuteScan: steps/checkmarxExecuteScan.md
- checksPublishResults: steps/checksPublishResults.md
- cfManifestSubstituteVariables: steps/cfManifestSubstituteVariables.md
@ -112,6 +111,7 @@ nav:
- integrationArtifactUnDeploy: steps/integrationArtifactUnDeploy.md
- integrationArtifactUpdateConfiguration: steps/integrationArtifactUpdateConfiguration.md
- integrationArtifactUpload: steps/integrationArtifactUpload.md
- isChangeInDevelopment: steps/isChangeInDevelopment.md
- jenkinsMaterializeLog: steps/jenkinsMaterializeLog.md
- kanikoExecute: steps/kanikoExecute.md
- karmaExecuteTests: steps/karmaExecuteTests.md
@ -161,6 +161,7 @@ nav:
- xsDeploy: steps/xsDeploy.md
- 'Library Steps (deprecated)':
- artifactSetVersion: steps/artifactSetVersion.md
- checkChangeInDevelopment: steps/checkChangeInDevelopment.md
- npmExecute: steps/npmExecute.md
- transportRequestUploadFile: steps/transportRequestUploadFile.md
- 'Command line tool': cli/index.md

View File

@ -1,8 +1,8 @@
metadata:
name: isChangeInDevelopment
description: "Checks if a certain change is in status 'in development'"
description: This step checks if a certain change is in status 'in development'
longDescription: |
"Checks if a certain change is in status 'in development'"
This step checks if a certain change is in status 'in development'
spec:
inputs: