mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-04-17 12:06:28 +02:00
review fixes
This commit is contained in:
parent
5aa0a35934
commit
b65f0a2461
@ -3,9 +3,9 @@
|
||||
[](https://codeclimate.com/github/SAP/jenkins-library/test_coverage)
|
||||
|
||||
# Project Piper Library Repository
|
||||
Welcome to the Repository of the extended Library of Project Piper.
|
||||
Project "Piper" provides this "Shared Library" to extend the Jenkins Pipeline with SAP specific patterns.
|
||||
|
||||
# User Documentation
|
||||
# User Documentation
|
||||
If you want to view the User Documentation of Project Piper please follow this [GitHub Pages Link][pages-user-doc].
|
||||
|
||||
# Known Issues
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Additional
|
||||
## Transport
|
||||
stage('prepare') {
|
||||
checkout scm
|
||||
setupCommonPipelineEnvironment script:this
|
||||
checkChangeInDevelopment script: this
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Getting Started with Project "Piper"
|
||||
|
||||
Follow this guided tour to become familiar with the basics of using project "Piper".
|
||||
Follow this guided tour to become familiar with the basics of using project "Piper".
|
||||
|
||||
|
||||
## Prerequisites
|
||||
@ -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,128 +38,132 @@ 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() {
|
||||
stage('prepare') {
|
||||
checkout scm
|
||||
setupCommonPipelineEnvironment script:this
|
||||
}
|
||||
}
|
||||
node() {
|
||||
stage('prepare') {
|
||||
checkout scm
|
||||
setupCommonPipelineEnvironment script:this
|
||||
}
|
||||
}
|
||||
```
|
||||
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">
|
||||

|
||||
</p>
|
||||
|
||||
</p>
|
||||
|
||||
1. Provide a name for your new item (for example, *My First Pipeline*) and select **Pipeline**.
|
||||
<p align="center">
|
||||

|
||||
</p>
|
||||
|
||||
1. For **Definition** in the **Pipeline** options, choose **Pipeline script from SCM**.
|
||||
1. For **Definition** in the **Pipeline** options, choose **Pipeline script from SCM**.
|
||||
|
||||
1. For **SCM**, choose **Git**.
|
||||
|
||||
1. For **Repository URL** in the **Repositories** section, enter the URL of your Git repository, for example `https://github.com/<your-org>/cloud-cf-helloworld-nodejs`. **Note:** If your repository is protected, you must provide your credentials in the **Credentials** section.
|
||||
<p align="center">
|
||||

|
||||
</p>
|
||||
</p>
|
||||
|
||||
1. Choose **Save**.
|
||||
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.
|
||||
|
||||
|
||||
## 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
|
||||
}
|
||||
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].
|
||||
|
||||
2. Create an MTA descriptor with the name `mta.yaml`, which contains the following code:
|
||||
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].
|
||||
|
||||
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
|
||||
version: 1.0.0
|
||||
description: A Hello World sample application
|
||||
provider: SAP Sample generator
|
||||
modules:
|
||||
- name: piper.node.hello.world
|
||||
type: nodejs
|
||||
path: .
|
||||
_schema-version: 2.1.0
|
||||
ID: com.sap.piper.node.hello.world
|
||||
version: 1.0.0
|
||||
description: A Hello World sample application
|
||||
provider: SAP Sample generator
|
||||
modules:
|
||||
- name: piper.node.hello.world
|
||||
type: nodejs
|
||||
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:
|
||||
mtaBuild:
|
||||
buildTarget: 'CF'
|
||||
general:
|
||||
steps:
|
||||
mtaBuild:
|
||||
buildTarget: 'CF'
|
||||
```
|
||||
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
|
||||
|
||||
1. In your `Jenkinsfile`, add the following code snippet:
|
||||
```
|
||||
stage('deploy') {
|
||||
def mtarFilePath = commonPipelineEnvironment.getMtarFilePath()
|
||||
cloudFoundryDeploy( script: this, mtaPath: mtarFilePath)
|
||||
def mtarFilePath = commonPipelineEnvironment.getMtarFilePath()
|
||||
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'
|
||||
deployType: 'standard'
|
||||
cloudFoundry:
|
||||
org: '<your-organisation>'
|
||||
space: '<your-space>'
|
||||
credentialsId: 'CF_CREDENTIALSID'
|
||||
cloudFoundryDeploy:
|
||||
deployTool: 'mtaDeployPlugin'
|
||||
deployType: 'standard'
|
||||
cloudFoundry:
|
||||
org: '<your-organisation>'
|
||||
space: '<your-space>'
|
||||
credentialsId: 'CF_CREDENTIALSID'
|
||||
```
|
||||
The key `CF_CREDENTIALSID` refers to a user-password credential you must create in Jenkins: In Jenkins, choose **Credentials** from the main menu and add a **Username with Password** entry.
|
||||
<p align="center">
|
||||

|
||||
</p>
|
||||
</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
|
||||
## Complete the Guided Tour
|
||||
|
||||
Your application has been deployed into your space in the Cloud Foundry space on SAP Cloud Platform. Logon to SAP Cloud Platform and verify the status of your application.
|
||||
<p align="center">
|
||||

|
||||
</p>
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
You are now familiar with the basics of using project "Piper". Through the concept of pipeline as code, project "Piper" and Jenkins pipelines are extremely powerful. While Jenkins pipelines offer a full set of common programming features, project "Piper" adds SAP-specific flavors. Have a look at the increasing list of features you can implement through the project "Piper" [steps][resources-steps] and see the different [scenarios][resources-scenarios] to understand how to integrate SAP systems into your pipeline.
|
||||
|
||||
The configuration pattern supports simple pipelines that can be reused by multiple applications. To understand the principles of inheritance and customization, have a look at the the [configuration][resources-configuration] documentation.
|
||||
|
||||
|
||||
|
||||
[guidedtour-my-own-jenkins]: myownjenkins.md
|
||||
[guidedtour-sample.config]: samples/cloud-cf-helloworld-nodejs/.pipeline/config.yml
|
||||
@ -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
|
||||
|
||||
|
@ -19,4 +19,3 @@ Please note that Docker images can contain other software which may be licensed
|
||||
[piper-library-issues]: https://github.com/SAP/jenkins-library/issues
|
||||
[license]: LICENSE
|
||||
[piper-library-contribution]: .github/CONTRIBUTING.md
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
# Project "Piper" User Documentation
|
||||
|
||||
|
||||
An efficient software development process is vital for success in building
|
||||
business applications on SAP Cloud Platform or SAP on-premise platforms. SAP
|
||||
addresses this need for efficiency with project "Piper". The goal of project
|
||||
"Piper" is to substantially ease setting up continuous delivery processes for
|
||||
the most important SAP technologies by means of Jenkins pipelines.
|
||||
|
||||
# What you get
|
||||
## What you get
|
||||
|
||||
Project "Piper" consists of two parts:
|
||||
|
||||
@ -50,7 +49,6 @@ the API and are subjected to change without prior notice. Types and methods anno
|
||||
`@API` are considered to be API, used e.g. from other shared libraries. Changes to those
|
||||
methods/types needs to be announced, discussed and agreed.
|
||||
|
||||
|
||||
[github]: https://github.com
|
||||
[piper-library]: https://github.com/SAP/jenkins-library
|
||||
[devops-docker-images]: https://github.com/SAP/devops-docker-images
|
||||
|
@ -1,8 +1,8 @@
|
||||
#My own Jenkins
|
||||
# My own Jenkins
|
||||
|
||||
**Note:** This guide is not sufficient yet, to setup a Jenkins for project "Piper".
|
||||
**Note:** This guide is not sufficient yet, to setup a Jenkins for project "Piper".
|
||||
|
||||
# Requirements
|
||||
## Requirements
|
||||
|
||||
* Java Runtime Environment 8
|
||||
* Installation of Jenkins v 2.60.3 or higher running on Linux. We tested with debian-stretch.
|
||||
@ -10,7 +10,7 @@
|
||||
* A Jenkins user with administration privileges.
|
||||
* The Jenkins instance has access to [github.com][github].
|
||||
|
||||
# Download and Installation
|
||||
## Download and Installation
|
||||
|
||||
To setup the shared library, you need to perform the following steps:
|
||||
|
||||
|
@ -2,20 +2,17 @@
|
||||
|
||||
node() {
|
||||
|
||||
stage('prepare') {
|
||||
stage('prepare') {
|
||||
checkout scm
|
||||
setupCommonPipelineEnvironment script:this
|
||||
}
|
||||
|
||||
checkout scm
|
||||
stage('build') {
|
||||
mtaBuild script: this
|
||||
}
|
||||
|
||||
setupCommonPipelineEnvironment script:this
|
||||
}
|
||||
|
||||
stage('build') {
|
||||
mtaBuild script: this
|
||||
}
|
||||
|
||||
stage('deploy') {
|
||||
def mtarFilePath = commonPipelineEnvironment.getMtarFilePath()
|
||||
|
||||
cloudFoundryDeploy( script: this, mtaPath: mtarFilePath)
|
||||
}
|
||||
}
|
||||
stage('deploy') {
|
||||
def mtarFilePath = commonPipelineEnvironment.getMtarFilePath()
|
||||
cloudFoundryDeploy( script: this, mtaPath: mtarFilePath)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user