-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
123 lines (109 loc) · 3.95 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!groovy
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright IBM Corporation 2018, 2019
*/
node('zowe-jenkins-agent') {
def lib = library("jenkins-library").org.zowe.jenkins_shared_library
def pipeline = lib.pipelines.nodejs.NodeJSPipeline.new(this)
pipeline.admins.add("jackjia", "jcain")
// FIXME: allow release from zosmf_convert branch
pipeline.branches.addMap([
[
name : 'zosmf_convert',
isProtected : true,
buildHistory : 20,
allowRelease : true,
allowFormalRelease : true,
releaseTag : 'snapshot',
npmTag : 'latest',
]
])
pipeline.setup(
packageName: 'org.zowe.explorer-uss',
nodeJsVersion: 'v10.18.1',
github: [
email : lib.Constants.DEFAULT_GITHUB_ROBOT_EMAIL,
usernamePasswordCredential : lib.Constants.DEFAULT_GITHUB_ROBOT_CREDENTIAL,
],
artifactory: [
url : lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL,
usernamePasswordCredential : lib.Constants.DEFAULT_LFJ_ARTIFACTORY_ROBOT_CREDENTIAL,
],
pax: [
sshHost : lib.Constants.DEFAULT_PAX_PACKAGING_SSH_HOST,
sshPort : lib.Constants.DEFAULT_PAX_PACKAGING_SSH_PORT,
sshCredential : lib.Constants.DEFAULT_PAX_PACKAGING_SSH_CREDENTIAL,
remoteWorkspace : lib.Constants.DEFAULT_PAX_PACKAGING_REMOTE_WORKSPACE,
],
installRegistries: [
[
email : lib.Constants.DEFAULT_LFJ_NPM_PRIVATE_REGISTRY_EMAIL,
usernamePasswordCredential : lib.Constants.DEFAULT_LFJ_NPM_PRIVATE_REGISTRY_CREDENTIAL,
registry : lib.Constants.DEFAULT_LFJ_NPM_PRIVATE_REGISTRY_INSTALL,
]
],
publishRegistry: [
email : lib.Constants.DEFAULT_LFJ_NPM_PRIVATE_REGISTRY_EMAIL,
usernamePasswordCredential : lib.Constants.DEFAULT_LFJ_NPM_PRIVATE_REGISTRY_CREDENTIAL,
],
// FIXME: ideally this should set to false (using default by remove this line)
ignoreAuditFailure : true
)
// we have a custom build command
pipeline.build(
operation: {
ansiColor('xterm') {
pipeline.nvmShell "npm run prod"
}
}
)
pipeline.test(
name : 'Unit',
junit : "target/report.xml",
cobertura : [
coberturaReportFile : "coverage/cobertura-coverage.xml",
// if coverage check failed, the pipeline will be marked as UNSTABLE, which
// will block publish/release. So we overwrite default and set to false here.
// FIXME: ideally this should set to true (using default by remove this line)
autoUpdateStability : false,
fileCoverageTargets : '100, 0, 0',
classCoverageTargets : '85, 0, 0',
methodCoverageTargets : '80, 0, 0',
lineCoverageTargets : '80, 0, 0',
conditionalCoverageTargets: '70, 0, 0',
],
htmlReports : [
[dir: "coverage/lcov-report", files: "index.html", name: "Report: Code Coverage"],
],
)
// we need sonar scan
pipeline.sonarScan(
scannerTool : lib.Constants.DEFAULT_LFJ_SONARCLOUD_SCANNER_TOOL,
scannerServer : lib.Constants.DEFAULT_LFJ_SONARCLOUD_SERVER,
allowBranchScan : lib.Constants.DEFAULT_LFJ_SONARCLOUD_ALLOW_BRANCH,
failBuild : false
)
// we have pax packaging step
pipeline.packaging(
name: 'explorer-uss',
paxOptions: '-o saveext'
)
// define we need publish stage
pipeline.publish(
operation: {
echo "Default npm publish will be skipped."
},
artifacts: [
'.pax/explorer-uss.pax'
]
)
// define we need release stage
pipeline.release()
pipeline.end()
}