|
|
|
|
@@ -29,7 +29,7 @@ When the files are downloaded into the current directory, launch the Jenkins ser
|
|
|
|
|
./cx-server start
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
For more information on the Jenkins lifecycle management and how to customize your Jenkins, have a look at the [Operations Guide for Cx Server](https://github.com/SAP/devops-docker-images/blob/master/docs/operations/cx-server-operations-guide.md).
|
|
|
|
|
For more information on the Jenkins lifecycle management and how to customize your Jenkins, have a look at the [Operations Guide for Cx Server][devops-docker-images-cxs-guide].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Create Your First Pipeline
|
|
|
|
|
@@ -38,9 +38,9 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|
|
|
|
|
|
1. Fork the [cloud-cf-helloworld-nodejs][cloud-cf-helloworld-nodejs] repository into your GitHub organization.
|
|
|
|
|
|
|
|
|
|
1. Select the `1_REST_persist_in_Memory` branch of your [cloud-cf-helloworld-nodejs] fork and in it, create a new file with the name `Jenkinsfile`.
|
|
|
|
|
1. Select the `1_REST_persist_in_Memory` branch of your [cloud-cf-helloworld-nodejs] fork.
|
|
|
|
|
|
|
|
|
|
1. To synchronize the repository, enter the following code lines into your `Jenkinsfile`:
|
|
|
|
|
1. Create a new file with the name `Jenkinsfile` in the root level of your repository and enter the following code:
|
|
|
|
|
```
|
|
|
|
|
@Library('piper-lib-os') _
|
|
|
|
|
node() {
|
|
|
|
|
@@ -50,7 +50,9 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
For more information about Jenkinsfiles and pipelines, see [Using a Jenkinsfile][jenkins-io-jenkinsfile].
|
|
|
|
|
The "prepare" step synchronizes the repository and initializes the project specific settings. For more information about Jenkinsfiles and pipelines, see [Using a Jenkinsfile][jenkins-io-jenkinsfile].
|
|
|
|
|
|
|
|
|
|
1. Save your changes to your remote repository.
|
|
|
|
|
|
|
|
|
|
1. To set up a Jenkins job for your repository, open the Jenkins UI under `http://<jenkins-server-address>:<http-port>` and choose **New Item**. Per default, the `cx-server` starts Jenkins on HTTP port `80`. For more information, see the [Jenkins User Documentation][jenkins-io-documentation].
|
|
|
|
|
<p align="center">
|
|
|
|
|
@@ -71,6 +73,8 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|

|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
1. For **Branch Specifier** in the **Branches to build** section, enter the branch name `*/1_REST_persist_in_Memory`.
|
|
|
|
|
|
|
|
|
|
1. Choose **Save**.
|
|
|
|
|
|
|
|
|
|
1. To run your pipeline, choose **Build Now** in the job UI.
|
|
|
|
|
@@ -78,15 +82,15 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|
|
|
|
|
|
## Add a Build Step
|
|
|
|
|
|
|
|
|
|
1. In your `Jenkinsfile`, add the following code snippet:
|
|
|
|
|
1. In your `Jenkinsfile`, add the following code snippet after `stage("prepare") { ... }`:
|
|
|
|
|
```
|
|
|
|
|
stage('build') {
|
|
|
|
|
mtaBuild script: this
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
**Result:** The `mtaBuild` step calls a build tool to build a multi-target application (MTA). The tool consumes an MTA descriptor that contains the metadata of all entities which comprise an application or are used by one during deployment or runtime, and the dependencies between them. For more information about MTAs, see [sap.com][sap].
|
|
|
|
|
The `mtaBuild` step calls a build tool to build a multi-target application (MTA). The tool consumes an MTA descriptor that contains the metadata of all entities which comprise an application or are used by one during deployment or runtime, and the dependencies between them. For more information about MTAs, see [sap.com][sap].
|
|
|
|
|
|
|
|
|
|
2. Create an MTA descriptor with the name `mta.yaml`, which contains the following code:
|
|
|
|
|
1. Create the MTA descriptor file with the name `mta.yaml` in the root level of the repository. Insert the following code:
|
|
|
|
|
```
|
|
|
|
|
_schema-version: 2.1.0
|
|
|
|
|
ID: com.sap.piper.node.hello.world
|
|
|
|
|
@@ -99,7 +103,7 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|
path: .
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3. To configure the step to build an MTA for the Cloud Foundry environment, in your repository, open or create the `.pipeline/config.yml` and add the following content:
|
|
|
|
|
1. Configure the step to build an MTA for the Cloud Foundry environment. Create the configuration file `.pipeline/config.yml` relative to the root level of the repository and insert the following content:
|
|
|
|
|
```
|
|
|
|
|
general:
|
|
|
|
|
steps:
|
|
|
|
|
@@ -108,9 +112,9 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|
```
|
|
|
|
|
For additional information about the configuration, have a look at the [Common Configuration Guide][resources-configuration] and the [MTA build step documentation][resources-step-mtabuild].
|
|
|
|
|
|
|
|
|
|
4. Commit your changes.
|
|
|
|
|
1. Save your changes to your remote repository.
|
|
|
|
|
|
|
|
|
|
5. To run your pipeline, choose **Build Now** in the job UI.
|
|
|
|
|
1. To run your pipeline, choose **Build Now** in the job UI.
|
|
|
|
|
|
|
|
|
|
## Add a Deploy Step
|
|
|
|
|
|
|
|
|
|
@@ -121,9 +125,9 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|
cloudFoundryDeploy( script: this, mtaPath: mtarFilePath)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
**Result:** The `cloudFoundryDeploy` step calls the Cloud Foundry command line client to deploy into SAP Cloud Platform.
|
|
|
|
|
The `cloudFoundryDeploy` step calls the Cloud Foundry command line client to deploy into SAP Cloud Platform.
|
|
|
|
|
|
|
|
|
|
2. To configure the step to deploy into the Cloud Foundry environment, in your repository, open or create the `.pipeline/config.yml` and add the following content:
|
|
|
|
|
1. To configure the step to deploy into the Cloud Foundry environment, in your repository, open or create the `.pipeline/config.yml` and add the following content:
|
|
|
|
|
```
|
|
|
|
|
cloudFoundryDeploy:
|
|
|
|
|
deployTool: 'mtaDeployPlugin'
|
|
|
|
|
@@ -139,9 +143,9 @@ For the beginning, we recommend using an SAP sample application. The repository
|
|
|
|
|
</p>
|
|
|
|
|
For more information about the configuration, see the [Common Configuration Guide][resources-configuration] and [cloudFoundryDeploy][resources-step-cloudFoundryDeploy].
|
|
|
|
|
|
|
|
|
|
3. Commit your changes.
|
|
|
|
|
1. Save your changes to your remote repository.
|
|
|
|
|
|
|
|
|
|
4. To run your pipeline, choose **Build Now** in the job UI.
|
|
|
|
|
1. To run your pipeline, choose **Build Now** in the job UI.
|
|
|
|
|
|
|
|
|
|
## Complete the Guided Tour
|
|
|
|
|
|
|
|
|
|
@@ -152,7 +156,7 @@ Your application has been deployed into your space in the Cloud Foundry space on
|
|
|
|
|
|
|
|
|
|
To view the URL of your application, choose the application name. Open the **Route** and add `/users` to the URL. **Result:** The application returns data.
|
|
|
|
|
|
|
|
|
|
If your pipeline fails, compare it to the final [Jenkinsfile][guidedtour-sample.jenkins], the [config.yml][guidedtour-sample.config], and the [mta.yaml][guidedtour-sample.mta].
|
|
|
|
|
If your pipeline fails, compare it to the final [Jenkinsfile][guidedtour-sample.jenkins], the [config.yml][guidedtour-sample.config], and the [mta.yaml][guidedtour-sample.mta]. Yaml files are sensitive regarding indentation.
|
|
|
|
|
|
|
|
|
|
## What's Next
|
|
|
|
|
|
|
|
|
|
@@ -175,9 +179,10 @@ The configuration pattern supports simple pipelines that can be reused by multip
|
|
|
|
|
[SAP Cloud Platform Trial]: [https://account.hanatrial.ondemand.com]
|
|
|
|
|
[devops-docker-images]: https://github.com/SAP/devops-docker-images
|
|
|
|
|
[devops-docker-images-issues]: https://github.com/SAP/devops-docker-images/issues
|
|
|
|
|
[devops-docker-images-cxs-guide]: https://github.com/SAP/devops-docker-images/blob/master/docs/operations/cx-server-operations-guide.md
|
|
|
|
|
|
|
|
|
|
[cloud-cf-helloworld-nodejs]: https://github.com/SAP/cloud-cf-helloworld-nodejs
|
|
|
|
|
[sap]: https://www.sap.com
|
|
|
|
|
[github]: https://github.com
|
|
|
|
|
[jenkins-io-documentation]: https://jenkins.io/doc/
|
|
|
|
|
[jenkins-io-jenkinsfile]: https://jenkins.io/doc/book/pipeline/jenkinsfile
|
|
|
|
|
|
|
|
|
|
|