mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
Merge branch 'master' into pr/docuFixNullValues
This commit is contained in:
commit
4d9a4dbc6f
@ -74,8 +74,7 @@ To setup the shared library, you need to perform the following steps:
|
||||
1. Scroll down to section *Global Pipeline Libraries* and add a new Library by
|
||||
clicking the *Add* button.
|
||||
1. set *Library Name* to `piper-lib-os`
|
||||
1. set *Default Version* to the branch or tag you want to consume (e.g.
|
||||
`master` or `v0.1`)
|
||||
1. set *Default Version* to the branch or tag you want to consume (e.g. `master` or `v0.1`)
|
||||
1. set *Retrieval Method* to `Modern SCM`
|
||||
1. set *Source Code Management* to `Git`
|
||||
1. set *Project Repository* to `https://github.com/SAP/jenkins-library`
|
||||
|
@ -11,12 +11,10 @@ Build an application based on SAPUI5 or SAP Fiori with Jenkins and deploy the bu
|
||||
* You have installed Node.js including node and npm. See [Node.js](https://nodejs.org/en/download/).
|
||||
* You have installed the SAP Cloud Platform Neo Environment SDK. See [SAP Development Tools](https://tools.hana.ondemand.com/#cloud).
|
||||
|
||||
|
||||
### Project Prerequisites
|
||||
|
||||
This scenario requires additional files in your project and in the execution environment on your Jenkins instance.
|
||||
|
||||
|
||||
On the project level, provide and adjust the following template:
|
||||
|
||||
| File Name | Description | Position |
|
||||
@ -26,12 +24,10 @@ On the project level, provide and adjust the following template:
|
||||
| [`package.json`](https://github.com/SAP/jenkins-library/blob/master/documentation/docs/scenarios/ui5-sap-cp/files/package.json) | This file lists the required development dependencies for the build. | Add the content of the `package.json` file to your existing `package.json` file. |
|
||||
| [`Gruntfile.js`](https://github.com/SAP/jenkins-library/blob/master/documentation/docs/scenarios/ui5-sap-cp/files/Gruntfile.js) | This file controls the grunt build. By default the tasks `clean`, `build`, and `lint` are executed. | Place the `Gruntfile.js` in the root directory of your project. |
|
||||
|
||||
|
||||
## Context
|
||||
|
||||
This scenario combines various different steps to create a complete pipeline.
|
||||
|
||||
|
||||
In this scenario, we want to show how to build an application based on SAPUI5 or SAP Fiori by using the multi-target application (MTA) concept and how to deploy the build result into an SAP Cloud Platform account in the Neo environment. This document comprises the [mtaBuild](https://sap.github.io/jenkins-library/steps/mtaBuild/) and the [neoDeploy](https://sap.github.io/jenkins-library/steps/neoDeploy/) steps.
|
||||
|
||||
![This pipeline in Jenkins Blue Ocean](images/pipeline.jpg)
|
||||
@ -73,7 +69,6 @@ steps:
|
||||
| `buildTarget` | The target platform to which the mtar can be deployed. Possible values are: `CF`, `NEO`, `XSA` |
|
||||
| `mtaJarLocation` | The location of the multi-target application archive builder jar file, including file name and extension. |
|
||||
|
||||
|
||||
#### Configuration for the Deployment to SAP Cloud Platform
|
||||
|
||||
| Parameter | Description |
|
||||
@ -83,7 +78,6 @@ steps:
|
||||
| `host` | The SAP Cloud Platform host to deploy to. |
|
||||
| `neoHome` | The path to the `neo-java-web-sdk` tool that is used for the deployment. |
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
For the detailed description of the relevant parameters, see:
|
||||
|
@ -15,8 +15,8 @@ Very basic setup can be done like that (with user "admin" and password "adminPwd
|
||||
|
||||
For more advanced setup please reach out to the respective documentation:
|
||||
|
||||
- https://hub.docker.com/_/influxdb/ (and https://github.com/docker-library/docs/tree/master/influxdb)
|
||||
- https://hub.docker.com/r/grafana/grafana/ (and https://github.com/grafana/grafana-docker)
|
||||
- InfluxDB ([Docker Hub](https://hub.docker.com/_/influxdb/) [GitHub](https://github.com/docker-library/docs/tree/master/influxdb))
|
||||
- Grafana ([Docker Hub](https://hub.docker.com/r/grafana/grafana/) [GitHub](https://github.com/grafana/grafana-docker))
|
||||
|
||||
After you have started your InfluxDB docker you need to create a database:
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
# ${docGenStepName}
|
||||
|
||||
|
||||
## ${docGenDescription}
|
||||
|
||||
## ${docGenParameters}
|
||||
|
@ -18,7 +18,7 @@ seleniumExecuteTests (script: this) {
|
||||
|
||||
### Example test using WebdriverIO
|
||||
|
||||
Example based on http://webdriver.io/guide/getstarted/modes.html and http://webdriver.io/guide.html
|
||||
Example based on <http://webdriver.io/guide/getstarted/modes.html> and <http://webdriver.io/guide.html>
|
||||
|
||||
#### Configuration for Local Docker Environment
|
||||
|
||||
|
@ -8,11 +8,8 @@
|
||||
|
||||
## ${docGenParameters}
|
||||
|
||||
|
||||
## ${docGenConfiguration}
|
||||
|
||||
|
||||
|
||||
The step is configured using a customer configuration file provided as
|
||||
resource in an custom shared library.
|
||||
|
||||
|
8
pom.xml
8
pom.xml
@ -17,10 +17,10 @@
|
||||
<url>https://sap.github.io/jenkins-library/</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License 2.0</name>
|
||||
<comments>https://github.com/SAP/jenkins-library/blob/master/LICENSE</comments>
|
||||
</license>
|
||||
<license>
|
||||
<name>Apache License 2.0</name>
|
||||
<comments>https://github.com/SAP/jenkins-library/blob/master/LICENSE</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<repositories>
|
||||
|
@ -33,25 +33,27 @@ String getGitCommitId() {
|
||||
return sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
|
||||
}
|
||||
|
||||
String[] extractLogLines(String filter = '',
|
||||
String from = 'origin/master',
|
||||
String to = 'HEAD',
|
||||
String format = '%b') {
|
||||
String[] extractLogLines(
|
||||
String filter = '',
|
||||
String from = 'origin/master',
|
||||
String to = 'HEAD',
|
||||
String format = '%b'
|
||||
) {
|
||||
|
||||
// Checks below: there was an value provided from outside, but the value was null.
|
||||
// Throwing an exception is more transparent than making a fallback to the defaults
|
||||
// used in case the paramter is omitted in the signature.
|
||||
if(filter == null) throw new IllegalArgumentException('Parameter \'filter\' not provided.')
|
||||
if(! from?.trim()) throw new IllegalArgumentException('Parameter \'from\' not provided.')
|
||||
if(! to?.trim()) throw new IllegalArgumentException('Parameter \'to\' not provided.')
|
||||
if(! format?.trim()) throw new IllegalArgumentException('Parameter \'format\' not provided.')
|
||||
// Checks below: there was an value provided from outside, but the value was null.
|
||||
// Throwing an exception is more transparent than making a fallback to the defaults
|
||||
// used in case the paramter is omitted in the signature.
|
||||
if(filter == null) throw new IllegalArgumentException('Parameter \'filter\' not provided.')
|
||||
if(! from?.trim()) throw new IllegalArgumentException('Parameter \'from\' not provided.')
|
||||
if(! to?.trim()) throw new IllegalArgumentException('Parameter \'to\' not provided.')
|
||||
if(! format?.trim()) throw new IllegalArgumentException('Parameter \'format\' not provided.')
|
||||
|
||||
sh ( returnStdout: true,
|
||||
script: """#!/bin/bash
|
||||
git log --pretty=format:${format} ${from}..${to}
|
||||
"""
|
||||
)?.split('\n')
|
||||
?.findAll { line -> line ==~ /${filter}/ }
|
||||
script: """#!/bin/bash
|
||||
git log --pretty=format:${format} ${from}..${to}
|
||||
"""
|
||||
)?.split('\n')
|
||||
?.findAll { line -> line ==~ /${filter}/ }
|
||||
|
||||
}
|
||||
|
||||
|
@ -17,32 +17,32 @@ public class ChangeManagement implements Serializable {
|
||||
}
|
||||
|
||||
String getChangeDocumentId(
|
||||
String from = 'origin/master',
|
||||
String to = 'HEAD',
|
||||
String label = 'ChangeDocument\\s?:',
|
||||
String format = '%b'
|
||||
) {
|
||||
String from = 'origin/master',
|
||||
String to = 'HEAD',
|
||||
String label = 'ChangeDocument\\s?:',
|
||||
String format = '%b'
|
||||
) {
|
||||
|
||||
return getLabeledItem('ChangeDocumentId', from, to, label, format)
|
||||
}
|
||||
|
||||
String getTransportRequestId(
|
||||
String from = 'origin/master',
|
||||
String to = 'HEAD',
|
||||
String label = 'TransportRequest\\s?:',
|
||||
String format = '%b'
|
||||
) {
|
||||
String from = 'origin/master',
|
||||
String to = 'HEAD',
|
||||
String label = 'TransportRequest\\s?:',
|
||||
String format = '%b'
|
||||
) {
|
||||
|
||||
return getLabeledItem('TransportRequestId', from, to, label, format)
|
||||
}
|
||||
|
||||
private String getLabeledItem(
|
||||
String name,
|
||||
String from,
|
||||
String to,
|
||||
String label,
|
||||
String format
|
||||
) {
|
||||
String name,
|
||||
String from,
|
||||
String to,
|
||||
String label,
|
||||
String format
|
||||
) {
|
||||
|
||||
if( ! gitUtils.insideWorkTree() ) {
|
||||
throw new ChangeManagementException("Cannot retrieve ${name}. Not in a git work tree. ${name} is extracted from git commit messages.")
|
||||
|
@ -42,4 +42,3 @@ def call(Map parameters = [:], body) {
|
||||
|
||||
return duration
|
||||
}
|
||||
|
||||
|
@ -54,15 +54,19 @@ void call(Map parameters = [:]) {
|
||||
|
||||
deleteDir()
|
||||
|
||||
checkout([$class: 'GitSCM', branches: [[name: config.branch]],
|
||||
doGenerateSubmoduleConfigurations: false,
|
||||
extensions: [[$class: 'SparseCheckoutPaths',
|
||||
sparseCheckoutPaths: [[path: config.path]]
|
||||
]],
|
||||
submoduleCfg: [],
|
||||
userRemoteConfigs: [[credentialsId: config.credentialsId,
|
||||
url: config.repoUrl
|
||||
]]
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: [[name: config.branch]],
|
||||
doGenerateSubmoduleConfigurations: false,
|
||||
extensions: [[
|
||||
$class: 'SparseCheckoutPaths',
|
||||
sparseCheckoutPaths: [[path: config.path]]
|
||||
]],
|
||||
submoduleCfg: [],
|
||||
userRemoteConfigs: [[
|
||||
credentialsId: config.credentialsId,
|
||||
url: config.repoUrl
|
||||
]]
|
||||
])
|
||||
|
||||
}
|
||||
|
@ -184,30 +184,33 @@ void call(parameters = [:]) {
|
||||
try {
|
||||
if(backendType == BackendType.SOLMAN) {
|
||||
transportRequestId = cm.createTransportRequestSOLMAN(
|
||||
configuration.changeManagement.solman.docker,
|
||||
configuration.changeDocumentId,
|
||||
configuration.developmentSystemId,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.credentialsId,
|
||||
configuration.changeManagement.clientOpts)
|
||||
configuration.changeManagement.solman.docker,
|
||||
configuration.changeDocumentId,
|
||||
configuration.developmentSystemId,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.credentialsId,
|
||||
configuration.changeManagement.clientOpts
|
||||
)
|
||||
} else if(backendType == BackendType.CTS) {
|
||||
transportRequestId = cm.createTransportRequestCTS(
|
||||
configuration.changeManagement.cts.docker,
|
||||
configuration.transportType,
|
||||
configuration.targetSystem,
|
||||
configuration.description,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.credentialsId,
|
||||
configuration.changeManagement.clientOpts)
|
||||
configuration.changeManagement.cts.docker,
|
||||
configuration.transportType,
|
||||
configuration.targetSystem,
|
||||
configuration.description,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.credentialsId,
|
||||
configuration.changeManagement.clientOpts
|
||||
)
|
||||
} else if (backendType == BackendType.RFC) {
|
||||
transportRequestId = cm.createTransportRequestRFC(
|
||||
configuration.changeManagement.rfc.docker,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.rfc.developmentInstance,
|
||||
configuration.changeManagement.rfc.developmentClient,
|
||||
configuration.changeManagement.credentialsId,
|
||||
configuration.description,
|
||||
configuration.verbose)
|
||||
configuration.changeManagement.rfc.docker,
|
||||
configuration.changeManagement.endpoint,
|
||||
configuration.changeManagement.rfc.developmentInstance,
|
||||
configuration.changeManagement.rfc.developmentClient,
|
||||
configuration.changeManagement.credentialsId,
|
||||
configuration.description,
|
||||
configuration.verbose
|
||||
)
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid backend type: '${backendType}'.")
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ import static com.sap.piper.cm.StepHelpers.getBackendTypeAndLogInfoIfCMIntegrati
|
||||
'transportRequestId',
|
||||
/** @see transportRequestCreate */
|
||||
'verbose',
|
||||
])
|
||||
])
|
||||
|
||||
/** Releases a Transport Request. */
|
||||
@GenerateDocumentation
|
||||
|
Loading…
Reference in New Issue
Block a user