-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCD
46 lines (39 loc) · 1.67 KB
/
CD
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
/* Before using this example, check if the below release tag(v0.3.0) is the latest.
* You can find the latest release tag at https://git.soma.salesforce.com/dci/sfci-pipeline-sharedlib/releases
*/
@Library('sfci-pipeline-sharedlib@master') _
/* Specify the build image you want to use.
* Not specifying a build image will use the default build image specified here:
* https://git.soma.salesforce.com/dci/sfci-pipeline-sharedlib/blob/master/vars/executePipeline.groovy#L4
* (If you are fine with the default image, ignore this line)
*/
def envDef = [ buildImage: 'ops0-artifactrepo1-0-prd.data.sfdc.net/dx-runtime/centos-sfci-cc-runtime' ]
// define any release branches here
env.RELEASE_BRANCHES = ['master']
executePipeline(envDef) {
stage('Init') {
buildInit()
}
stage('Test') {
sh "node --version"
sh "npm --version"
sh "npm install && npm test"
}
stage('Publish') {
sh 'hostname -I'
npmInit()
final String registry = 'nexus.soma.salesforce.com/nexus/content/repositories/npmjs-internal/'
withCredentials([usernamePassword(
credentialsId: 'sfci-nexus',
usernameVariable: 'NEXUS_USERNAME',
passwordVariable: 'NEXUS_PASSWORD'
)]) {
// Get the auth token and configure npm (securely)
String authToken = sh([script: "echo -n ${NEXUS_USERNAME}:${NEXUS_PASSWORD} | base64", returnStdout: true]).trim()
wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: authToken, var: 'SECRET']]]) {
sh "npm config set //${registry}:_authToken ${authToken}"
}
}
sh "npm publish"
}
}