mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-02-05 13:25:19 +02:00
Create groovy step for abapEnvironmentCreateSystem (#2303)
* Create groovy step * add to pipeline * add includeAddon * Adapt docu * Adapt groovy test * adapt stage addonBuild * add comma * Add to docu * Upper case spelling * Update docu * adapt docu
This commit is contained in:
parent
115cfb5bae
commit
712c568087
@ -44,7 +44,7 @@ func AbapEnvironmentCreateSystemCommand() *cobra.Command {
|
||||
var createAbapEnvironmentCreateSystemCmd = &cobra.Command{
|
||||
Use: STEP_NAME,
|
||||
Short: "Creates a SAP Cloud Platform ABAP Environment system (aka Steampunk system)",
|
||||
Long: `creates a SAP Cloud Platform ABAP Environment system (aka Steampunk system)`,
|
||||
Long: `This step creates a SAP Cloud Platform ABAP Environment system (aka Steampunk system) via the cloud foundry command line interface (cf CLI). This can be done by providing a service manifest as a configuration file (parameter ` + "`" + `serviceManifest` + "`" + `) or by passing the configuration values directly via the other parameters of this step.`,
|
||||
PreRunE: func(cmd *cobra.Command, _ []string) error {
|
||||
startTime = time.Now()
|
||||
log.SetStepName(STEP_NAME)
|
||||
|
@ -32,26 +32,9 @@ The annotation `@Library('piper-lib-os')` is a reference to the Jenkins Configur
|
||||
|
||||
An Overview of the releases of the Piper Library can be found [here](https://github.com/SAP/jenkins-library/releases).
|
||||
|
||||
## 3. Manifest for Service Creation
|
||||
## 3. Configuration for the Communication
|
||||
|
||||
Create a file `manifest.yml`. The pipeline will create a SAP Cloud Platform ABAP Environment System in the beginning (and delete it in the end). This file describes the ABAP instance, which will be created:
|
||||
|
||||
```yaml
|
||||
---
|
||||
create-services:
|
||||
- name: "abapEnvironmentPipeline"
|
||||
broker: "abap"
|
||||
plan: "standard"
|
||||
parameters: "{ \"admin_email\" : \"user@example.com\", \"description\" : \"System for ABAP Pipeline\", \"is_development_allowed\" : true, \"sapsystemname\" : \"H02\", \"size_of_persistence\" : 4, \"size_of_runtime\" : 1 }"
|
||||
```
|
||||
|
||||
The example values are a suggestion. Please change them accordingly and don't forget to enter your own email address. Please be aware that creating a SAP Cloud ABAP Environment instance may incur costs.
|
||||
|
||||
Please have a look at the [step documentation](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateService/) for more details.
|
||||
|
||||
## 4. Configuration for the Communication
|
||||
|
||||
The communication to the ABAP system is done using a Communication Arrangement. The Communication Arrangement is created during the pipeline via the command `cf create-service-key`. The configuration for the command needs to be stored in a JSON file. Create the file `sap_com_0510.json` in the repository with the following content:
|
||||
The communication to the ABAP system is done using a Communication Arrangement. The Communication Arrangement is created during the pipeline stage `Prepare System` after the system creation via the command `cf create-service-key`. The configuration for the command needs to be stored in a JSON file. Create the file `sap_com_0510.json` in the repository with the following content:
|
||||
|
||||
```json
|
||||
{
|
||||
@ -62,7 +45,7 @@ The communication to the ABAP system is done using a Communication Arrangement.
|
||||
|
||||
Please have a look at the [step documentation](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/) for more details.
|
||||
|
||||
## 5. Configuration for Cloning the repositories
|
||||
## 4. Configuration for Cloning the repositories
|
||||
|
||||
If you have specified the `Clone Repositories` Stage you can make use of a dedicated configuration file containing the repositories to be pulled and the branches to be switched on. The `repositories` flag makes use of such a configuration file and helps executing a Pull, Clone and Checkout of the Branches of the Repositores. Create the file `repositories.yml` with the following structure containing your repositories including the branches for this Stage.
|
||||
|
||||
@ -76,7 +59,7 @@ repositories:
|
||||
|
||||
You can later use the `repositories.yml` file for the `repositories` parameter in the `Clone Repositories` stage used in chapter [7. Technical Pipeline Configuration](#7-technical-pipeline-configuration).
|
||||
|
||||
## 6. Configuration for ATC
|
||||
## 5. Configuration for ATC
|
||||
|
||||
Create a file `atcConfig.yml` to store the configuration for the ATC run. In this file, you can specify which Packages or Software Components shall be checked. Please have a look at the step documentation for more details. Here is an example of the configuration:
|
||||
|
||||
@ -88,7 +71,7 @@ atcobjects:
|
||||
|
||||
Please have a look at the [step documentation](https://sap.github.io/jenkins-library/steps/abapEnvironmentRunATCCheck/) for more details.
|
||||
|
||||
## 7. Technical Pipeline Configuration
|
||||
## 6. Technical Pipeline Configuration
|
||||
|
||||
Create a file `.pipeline/config.yml` where you store the configuration for the pipeline, e.g. apiEndpoints and credentialIds. The steps make use of the Credentials Store of the Jenkins Server. Here is an example of the configuration file:
|
||||
|
||||
@ -102,7 +85,14 @@ general:
|
||||
cfServiceKeyName: 'jenkins_sap_com_0510'
|
||||
stages:
|
||||
Prepare System:
|
||||
cfServiceManifest: 'manifest.yml'
|
||||
cfService: 'abap'
|
||||
cfServicePlan: 'standard'
|
||||
abapSystemAdminEmail: 'user@example.com'
|
||||
abapSystemDescription: 'ABAP Environment Q System'
|
||||
abapSystemIsDevelopmentAllowed: false
|
||||
abapSystemID: 'H02'
|
||||
abapSystemSizeOfPersistence: 4
|
||||
abapSystemSizeOfRuntime: 1
|
||||
cfServiceKeyConfig: 'sap_com_0510.json'
|
||||
Clone Repositories:
|
||||
strategy: 'Pull'
|
||||
@ -114,18 +104,28 @@ steps:
|
||||
cfDeleteServiceKeys: true
|
||||
```
|
||||
|
||||
If one of the stages of the pipeline is not configured in this yml file, the stage will not be executed during the pipeline run. If the stage `Prepare System` is configured, the system will be deprovisioned in the cleanup routine - although it is necessary to configure the step `cloudFoundryDeleteService` as above. Also, if the `Prepare System` stage is configured, you can specify the strategy for the `strategy` step parameter that should be performed on the Software Components and the Branches that you have configured in the `respositories.yml` file in step [5. Configuration for Cloning the repositories](#5-configuration-for-cloning-the-repositories). Per default the strategy will be set to `Pull` if not specified. The following strategies are supported and can be used on the Software Components and Branches:
|
||||
Some stages may only be executed if a certain condition is met. For example: the stage `Prepare System` will only be executed if it is configured in the stages section. Also, the created system will be deprovisioned in the cleanup routine - although it is necessary to configure the step `cloudFoundryDeleteService` as above.
|
||||
|
||||
### Prepare system
|
||||
|
||||
The example values for the `Prepare System` stage are a suggestion. Please change them accordingly and don't forget to enter your own email address. Please be aware that creating a SAP Cloud ABAP Environment instance may incur costs.
|
||||
|
||||
Please have a look at the [step documentation](https://sap.github.io/jenkins-library/steps/abapEnvironmentCreateSystem/) for more details.
|
||||
|
||||
### Clone Repositories
|
||||
|
||||
If the `Clone Repositories` stage is configured, you can specify the `strategy` that should be performed on the Software Components and the Branches that you have configured in the `respositories.yml` file in step [4. Configuration for Cloning the repositories](#4-configuration-for-cloning-the-repositories). Per default the strategy will be set to `Pull` if not specified. The following strategies are supported and can be used on the Software Components and Branches:
|
||||
|
||||
* `Pull`: If you have specified Pull as the strategy the [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/) step will be used
|
||||
* `Clone`: If you have specified the Clone strategy the [abapEnvironmentCloneGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentCloneGitRepo/) step will be used
|
||||
* `CheckoutPull`: This strategy performs a Checkout of Branches with the [abapEnvironmentCheckoutBranch](https://sap.github.io/jenkins-library/steps/abapEnvironmentCheckoutBranch/) step followed by a Pull of the Software Component with the [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/) step
|
||||
* `addonBuild`: This will perform a Pull of the Software Component with the [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/) step, a Checkout of Branches with the [abapEnvironmentCheckoutBranch](https://sap.github.io/jenkins-library/steps/abapEnvironmentCheckoutBranch/) step followed by a Pull of the Software Component again with the [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/) step
|
||||
* `AddonBuild`: This will perform a Pull of the Software Component with the [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/) step, a Checkout of Branches with the [abapEnvironmentCheckoutBranch](https://sap.github.io/jenkins-library/steps/abapEnvironmentCheckoutBranch/) step followed by a Pull of the Software Component again with the [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/) step
|
||||
|
||||
Note that you can use the `repositories.yml` file with the `repositories` parameter consistently for all strategies. Also, please make sure the parameters align with the values defined in the other configuration files, e.g. the service name in the `manifest.yml` needs to be the same as the value in `general.cfServiceInstance`.
|
||||
Note that you can use the `repositories.yml` file with the `repositories` parameter consistently for all strategies.
|
||||
|
||||
The values for `cfApiEndpoint`,`cfOrg` and `cfSpace` can be found in the respective overview pages in the SAP Cloud Platform Cockpit. The Cloud Foundry credentials, saved in the Jenkins credentials store with the ID `cfCredentialsId`, must refer to a user with the required authorizations ("Space Developer") for the Cloud Foundry Organization and Space.
|
||||
|
||||
## 8. Create a Jenkins Pipeline
|
||||
## 7. Create a Jenkins Pipeline
|
||||
|
||||
On your Jenkins server click on `New Item` to create a new pipeline. Provide a name and select the type `Pipeline`.
|
||||
On the creation screen for the pipeline, scroll to the section `Pipeline` and select `Pipeline script from SCM`. Provide the URL (and credentials - if required) of the repository, in which you configured the pipeline. Make sure the `Script Path` points to your Jenkinsfile - if you created the Jenkinsfile according to the documentation above, the default value should be correct.
|
||||
@ -163,6 +163,9 @@ return this
|
||||
|
||||
While `tools: [checkStyle(pattern: '**/**/ATCResults.xml')]` will display the ATC findings using the checkstyle format, `qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]` will set the build result to UNSTABLE in case the ATC results contain at least one warning or error.
|
||||
|
||||
!!! caution "Local Jenkins"
|
||||
If you are using a local Jenkins you may have to [adapt the Jenkins URL](https://stackoverflow.com/a/39543223) in the configuration if the CheckStyl Plugin shows this error: "Can't create fingerprints for some files".
|
||||
|
||||
### Stage Names
|
||||
|
||||
The stage name for the extension is usually the displayed name, e.g. `ATC.groovy` or `Prepare System.groovy`. One exception is the generated `Post` stage. While the displayed name is "Declarative: Post Actions", you can extend this stage using `Post.groovy`.
|
||||
|
@ -14,7 +14,7 @@ The following stages and steps are part of the pipeline:
|
||||
|--------------------------|-------|
|
||||
| Init | - |
|
||||
| Initial Checks | [abapAddonAssemblyKitCheckPV](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitCheckPV/), [abapAddonAssemblyKitCheckCVs](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitCheckCVs/)|
|
||||
| Prepare System | [cloudFoundryCreateService](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateService/), [cloudFoundryCreateServiceKey](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/)|
|
||||
| Prepare System | [abapEnvironmentCreateSystem](https://sap.github.io/jenkins-library/steps/abapEnvironmentCreateSystem/), [cloudFoundryCreateServiceKey](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/)|
|
||||
| Clone Repositories | [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/)|
|
||||
| ATC | [abapEnvironmentRunATCCheck](https://sap.github.io/jenkins-library/steps/abapEnvironmentRunATCCheck/)|
|
||||
| Build | [cloudFoundryCreateServiceKey](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/), [abapAddonAssemblyKitReserveNextPackages](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitReserveNextPackages/), [abapEnvironmentAssemblePackages](https://sap.github.io/jenkins-library/steps/abapEnvironmentAssemblePackages/), [abapAddonAssemblyKitRegisterPackages](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitRegisterPackages/), [abapAddonAssemblyKitReleasePackages](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitReleasePackages/), [abapAddonAssemblyKitCreateTargetVector](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitCreateTargetVector/), [abapAddonAssemblyKitPublishTargetVector](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitPublishTargetVector/)|
|
||||
@ -35,7 +35,7 @@ This stage is executed, if the "Build" stage is configured. It contains checks t
|
||||
|
||||
## Prepare System
|
||||
|
||||
In this stage, the ABAP Environment system is created. This is done with the cloudFoundryCreateService step.
|
||||
In this stage, the ABAP Environment system is created. This is done with the abapEnvironmentCreateSystem step.
|
||||
|
||||
!!! caution "Limitation"
|
||||
As some parts of the system configuration is done after the Cloud Foundry instance was created, the following workaround is currently necessary:
|
||||
|
@ -199,7 +199,7 @@ If the pipelines receives the error from a backend system, please open a [suppor
|
||||
| Stage | Steps | Support Component |
|
||||
|--------------------------|-------|-------------------|
|
||||
| Initial Checks | [abapAddonAssemblyKitCheckPV](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitCheckPV/), [abapAddonAssemblyKitCheckCVs](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitCheckCVs/)| BC-UPG-OCS |
|
||||
| Prepare System | [cloudFoundryCreateService](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateService/), [cloudFoundryCreateServiceKey](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/)| BC-CP-ABA |
|
||||
| Prepare System | [abapEnvironmentCreateSystem](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateService/), [cloudFoundryCreateServiceKey](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/)| BC-CP-ABA |
|
||||
| Clone Repositories | [abapEnvironmentPullGitRepo](https://sap.github.io/jenkins-library/steps/abapEnvironmentPullGitRepo/)| BC-CP-ABA-SC |
|
||||
| ATC | [abapEnvironmentRunATCCheck](https://sap.github.io/jenkins-library/steps/abapEnvironmentRunATCCheck/)| BC-DWB-TOO-ATF |
|
||||
| Build | [cloudFoundryCreateServiceKey](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/)| BC-CP-ABA |
|
||||
|
70
documentation/docs/steps/abapEnvironmentCreateSystem.md
Normal file
70
documentation/docs/steps/abapEnvironmentCreateSystem.md
Normal file
@ -0,0 +1,70 @@
|
||||
# ${docGenStepName}
|
||||
|
||||
## ${docGenDescription}
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- On SAP Cloud Platform, Cloud Foundry needs to be enabled on subaccount level. This can be done on the Subaccount Overview page. The subaccount is then mapped to a “Cloud Foundry Organization”, for which you must provide a suitable name during the creation. Have a look at the [documentation](https://help.sap.com/viewer/a96b1df8525f41f79484717368e30626/Cloud/en-US/dc18bac42270468d84b6c030a668e003.html) for more details.
|
||||
- A (technical) user is required to access the SAP Cloud Platform via the cf CLI. The user needs to be a [member of the global account](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/4a0491330a164f5a873fa630c7f45f06.html) and has to have the [Space Developer](https://help.sap.com/viewer/a96b1df8525f41f79484717368e30626/Cloud/en-US/967fc4e2b1314cf7afc7d7043b53e566.html) role. The user and password need to be stored in the Jenkins Credentials Store.
|
||||
- Please make sure, that there are enough entitlements in the subaccount for the [Service Plan](https://help.sap.com/viewer/a96b1df8525f41f79484717368e30626/Cloud/en-US/c40cb18aeaa343389036fdcdd03c41d0.html), which you want to use for this step.
|
||||
|
||||
## ${docGenParameters}
|
||||
|
||||
## ${docGenConfiguration}
|
||||
|
||||
## ${docJenkinsPluginDependencies}
|
||||
|
||||
## Example: Configuration in the config.yml
|
||||
|
||||
The recommended way to configure your pipeline is via the config.yml file. In this case, calling the step in the Jenkinsfile is reduced to one line:
|
||||
|
||||
```groovy
|
||||
abapEnvironmentCreateSystem script: this
|
||||
```
|
||||
|
||||
The configuration values for the system can be passed through the `config.yml` file:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
abapEnvironmentCreateSystem:
|
||||
cfCredentialsId: 'cfCredentialsId'
|
||||
cfApiEndpoint: 'https://test.server.com'
|
||||
cfOrg: 'cfOrg'
|
||||
cfSpace: 'cfSpace'
|
||||
cfServiceInstance: 'H02_Q_system'
|
||||
cfService: 'abap'
|
||||
cfServicePlan: 'standard'
|
||||
abapSystemAdminEmail: 'user@example.com'
|
||||
abapSystemDescription: 'ABAP Environment Q System'
|
||||
abapSystemIsDevelopmentAllowed: true
|
||||
abapSystemID: 'H02'
|
||||
abapSystemSizeOfPersistence: 4
|
||||
abapSystemSizeOfRuntime: 1
|
||||
```
|
||||
|
||||
|
||||
## Example: Configuration in the Jenkinsfile
|
||||
|
||||
The step, including all parameters, can also be called directly from the Jenkinsfile. In the following example, a configuration file is used.
|
||||
|
||||
```groovy
|
||||
abapEnvironmentCloneGitRepo (
|
||||
script: this,
|
||||
cfCredentialsId: 'cfCredentialsId',
|
||||
cfApiEndpoint: 'https://test.server.com',
|
||||
cfOrg: 'cfOrg',
|
||||
cfSpace: 'cfSpace',
|
||||
cfServiceManifest: 'manifest.yml'
|
||||
)
|
||||
```
|
||||
|
||||
The file `manifest.yml` would look like this:
|
||||
|
||||
```yaml
|
||||
---
|
||||
create-services:
|
||||
- name: "H02_Q_system"
|
||||
broker: "abap"
|
||||
plan: "standard"
|
||||
parameters: "{ \"admin_email\" : \"user@example.com\", \"description\" : \"ABAP Environment Q System\", \"is_development_allowed\" : true, \"sapsystemname\" : \"H02\", \"size_of_persistence\" : 4, \"size_of_runtime\" : 1 }"
|
||||
```
|
@ -60,6 +60,7 @@ nav:
|
||||
- abapEnvironmentAssemblePackages: steps/abapEnvironmentAssemblePackages.md
|
||||
- abapEnvironmentCheckoutBranch: steps/abapEnvironmentCheckoutBranch.md
|
||||
- abapEnvironmentCloneGitRepo: steps/abapEnvironmentCloneGitRepo.md
|
||||
- abapEnvironmentCreateSystem: steps/abapEnvironmentCreateSystem.md
|
||||
- abapEnvironmentPullGitRepo: steps/abapEnvironmentPullGitRepo.md
|
||||
- abapEnvironmentRunATCCheck: steps/abapEnvironmentRunATCCheck.md
|
||||
- artifactPrepareVersion: steps/artifactPrepareVersion.md
|
||||
|
@ -2,7 +2,7 @@ metadata:
|
||||
name: abapEnvironmentCreateSystem
|
||||
description: Creates a SAP Cloud Platform ABAP Environment system (aka Steampunk system)
|
||||
longDescription: |
|
||||
creates a SAP Cloud Platform ABAP Environment system (aka Steampunk system)
|
||||
This step creates a SAP Cloud Platform ABAP Environment system (aka Steampunk system) via the cloud foundry command line interface (cf CLI). This can be done by providing a service manifest as a configuration file (parameter `serviceManifest`) or by passing the configuration values directly via the other parameters of this step.
|
||||
|
||||
spec:
|
||||
inputs:
|
||||
|
@ -119,6 +119,7 @@ public class CommonStepsTest extends BasePiperTest{
|
||||
'abapEnvironmentPullGitRepo', //implementing new golang pattern without fields
|
||||
'abapEnvironmentPipeline', // special step (infrastructure)
|
||||
'abapEnvironmentRunATCCheck', //implementing new golang pattern without fields
|
||||
'abapEnvironmentCreateSystem', //implementing new golang pattern without fields
|
||||
'artifactPrepareVersion',
|
||||
'cloudFoundryCreateService', //implementing new golang pattern without fields
|
||||
'cloudFoundryCreateServiceKey', //implementing new golang pattern without fields
|
||||
|
@ -36,7 +36,7 @@ class abapEnvironmentPipelineStageIntegrationTestsTest extends BasePiperTest {
|
||||
stepsCalled.add('input')
|
||||
return null
|
||||
})
|
||||
helper.registerAllowedMethod('cloudFoundryCreateService', [Map.class], {m -> stepsCalled.add('cloudFoundryCreateService')})
|
||||
helper.registerAllowedMethod('abapEnvironmentCreateSystem', [Map.class], {m -> stepsCalled.add('abapEnvironmentCreateSystem')})
|
||||
helper.registerAllowedMethod('cloudFoundryDeleteService', [Map.class], {m -> stepsCalled.add('cloudFoundryDeleteService')})
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class abapEnvironmentPipelineStageIntegrationTestsTest extends BasePiperTest {
|
||||
jsr.step.abapEnvironmentPipelineStageIntegrationTests(script: nullScript, confirmDeletion: true)
|
||||
|
||||
assertThat(stepsCalled, hasItems('input'))
|
||||
assertThat(stepsCalled, hasItems('cloudFoundryCreateService'))
|
||||
assertThat(stepsCalled, hasItems('abapEnvironmentCreateSystem'))
|
||||
assertThat(stepsCalled, hasItems('cloudFoundryDeleteService'))
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ class abapEnvironmentPipelineStageIntegrationTestsTest extends BasePiperTest {
|
||||
|
||||
|
||||
assertThat(stepsCalled, not(hasItem('input')))
|
||||
assertThat(stepsCalled, hasItems('cloudFoundryCreateService'))
|
||||
assertThat(stepsCalled, hasItems('abapEnvironmentCreateSystem'))
|
||||
assertThat(stepsCalled, hasItems('cloudFoundryDeleteService'))
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class AbapEnvironmentPipelineStagePrepareSystemTest extends BasePiperTest {
|
||||
stepsCalled.add('input')
|
||||
return null
|
||||
})
|
||||
helper.registerAllowedMethod('cloudFoundryCreateService', [Map.class], {m -> stepsCalled.add('cloudFoundryCreateService')})
|
||||
helper.registerAllowedMethod('abapEnvironmentCreateSystem', [Map.class], {m -> stepsCalled.add('abapEnvironmentCreateSystem')})
|
||||
helper.registerAllowedMethod('cloudFoundryCreateServiceKey', [Map.class], {m -> stepsCalled.add('cloudFoundryCreateServiceKey')})
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ class AbapEnvironmentPipelineStagePrepareSystemTest extends BasePiperTest {
|
||||
]
|
||||
jsr.step.abapEnvironmentPipelineStagePrepareSystem(script: nullScript)
|
||||
|
||||
assertThat(stepsCalled, hasItem('cloudFoundryCreateService'))
|
||||
assertThat(stepsCalled, hasItem('abapEnvironmentCreateSystem'))
|
||||
assertThat(stepsCalled, hasItem('cloudFoundryCreateServiceKey'))
|
||||
}
|
||||
}
|
||||
|
11
vars/abapEnvironmentCreateSystem.groovy
Normal file
11
vars/abapEnvironmentCreateSystem.groovy
Normal file
@ -0,0 +1,11 @@
|
||||
import groovy.transform.Field
|
||||
|
||||
@Field String STEP_NAME = getClass().getName()
|
||||
@Field String METADATA_FILE = 'metadata/abapEnvironmentCreateSystem.yaml'
|
||||
|
||||
void call(Map parameters = [:]) {
|
||||
List credentials = [
|
||||
[type: 'usernamePassword', id: 'cfCredentialsId', env: ['PIPER_username', 'PIPER_password']]
|
||||
]
|
||||
piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, credentials, false, false, true)
|
||||
}
|
@ -46,7 +46,7 @@ void call(Map parameters = [:]) {
|
||||
abapEnvironmentPullGitRepo script: parameters.script
|
||||
break
|
||||
case 'AddonBuild':
|
||||
abapEnvironmentPullGitRepo script: parameters.script
|
||||
abapEnvironmentPullGitRepo(script: parameters.script, ignoreCommit: true)
|
||||
abapEnvironmentCheckoutBranch script: parameters.script
|
||||
abapEnvironmentPullGitRepo script: parameters.script
|
||||
break
|
||||
|
@ -8,7 +8,7 @@ import static com.sap.piper.Prerequisites.checkScript
|
||||
@Field Set GENERAL_CONFIG_KEYS = []
|
||||
@Field STAGE_STEP_KEYS = [
|
||||
/** Creates a SAP Cloud Platform ABAP Environment instance via the cloud foundry command line interface */
|
||||
'cloudFoundryCreateService',
|
||||
'abapEnvironmentCreateSystem',
|
||||
/** If set to true, a confirmation is required to delete the system */
|
||||
'confirmDeletion'
|
||||
]
|
||||
@ -31,7 +31,7 @@ void call(Map parameters = [:]) {
|
||||
|
||||
piperStageWrapper (script: script, stageName: stageName, stashContent: [], stageLocking: false) {
|
||||
try {
|
||||
cloudFoundryCreateService script: parameters.script
|
||||
abapEnvironmentCreateSystem(script: parameters.script, includeAddon: true)
|
||||
} catch (Exception e) {
|
||||
script.currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import static com.sap.piper.Prerequisites.checkScript
|
||||
@Field Set GENERAL_CONFIG_KEYS = []
|
||||
@Field STAGE_STEP_KEYS = [
|
||||
/** Creates a SAP Cloud Platform ABAP Environment instance via the cloud foundry command line interface */
|
||||
'cloudFoundryCreateService',
|
||||
'abapEnvironmentCreateSystem',
|
||||
/** Creates Communication Arrangements for ABAP Environment instance via the cloud foundry command line interface */
|
||||
'cloudFoundryCreateServiceKey'
|
||||
]
|
||||
@ -21,7 +21,7 @@ void call(Map parameters = [:]) {
|
||||
def stageName = parameters.stageName?:env.STAGE_NAME
|
||||
|
||||
piperStageWrapper (script: script, stageName: stageName, stashContent: [], stageLocking: false) {
|
||||
cloudFoundryCreateService script: parameters.script
|
||||
abapEnvironmentCreateSystem script: parameters.script
|
||||
input message: "Steampunk system ready? Please make sure that you received the confirmation email before proceeding!"
|
||||
cloudFoundryCreateServiceKey script: parameters.script
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user