forked from SAP-archive/openui5-masterdetail-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
72 lines (61 loc) · 2.75 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!groovy
import com.sap.piper.Utils
/**
* Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
@Library('piper-library-os') _
node() {
//Global variables:
APP_PATH = 'src'
SRC = "${WORKSPACE}/${APP_PATH}"
CONFIG_FILE = "${SRC}/.pipeline/config.properties"
stage("Clone sources and setup environment"){
deleteDir()
dir(APP_PATH) {
checkout scm
setupCommonPipelineEnvironment script: this, configFile: CONFIG_FILE
}
MTA_JAR_LOCATION = commonPipelineEnvironment.getConfigProperty('MTA_HOME')
NEO_HOME = commonPipelineEnvironment.getConfigProperty('NEO_HOME')
DEPLOY_HOST = commonPipelineEnvironment.getConfigProperty('DEPLOY_HOST')
CI_DEPLOY_ACCOUNT = commonPipelineEnvironment.getConfigProperty('CI_DEPLOY_ACCOUNT')
neoCredentialsId = commonPipelineEnvironment.getConfigProperty('neoCredentialsId')
proxy = commonPipelineEnvironment.getConfigProperty('proxy') ?: ''
httpsProxy = commonPipelineEnvironment.getConfigProperty('httpsProxy') ?: ''
}
stage("Validate configuration"){
echo '[INFO] Validating configuration.'
if (!MTA_JAR_LOCATION) error "The property 'MTA_HOME' is not configured. Please configure the property at '$CONFIG_FILE'."
if (!NEO_HOME) error "The property 'NEO_HOME' is not configured. Please configure the property at '$CONFIG_FILE'."
if (!DEPLOY_HOST) error "The property 'DEPLOY_HOST' is not configured. Please configure the property at '$CONFIG_FILE'."
if (!CI_DEPLOY_ACCOUNT) error "The property 'CI_DEPLOY_ACCOUNT' is not configured. Please configure the property at '$CONFIG_FILE'."
if (!neoCredentialsId) error "The property 'neoCredentialsId' is not configured. Please configure the property at '$CONFIG_FILE'."
echo '[INFO] The validation was successful.'
}
stage("Validate installations"){
echo '[INFO] Validating installation requirements.'
toolValidate tool: 'java', home: JAVA_HOME
toolValidate tool: 'mta', home: MTA_JAR_LOCATION
toolValidate tool: 'neo', home: NEO_HOME
echo '[INFO] The validation was successful.'
}
stage("Build Fiori App"){
dir(SRC){
withEnv(["http_proxy=${proxy}", "https_proxy=${httpsProxy}"]) {
MTAR_FILE_PATH = mtaBuild mtaJarLocation: MTA_JAR_LOCATION, buildTarget: 'NEO'
}
}
}
stage("Deploy Fiori App"){
dir(SRC){
withEnv(["http_proxy=${proxy}", "https_proxy=${httpsProxy}"]) {
neoDeploy script: this, neoHome: NEO_HOME, archivePath: MTAR_FILE_PATH
}
}
}
}