-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
67 lines (60 loc) · 1.62 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
@Library('visenze-lib')_
GIT_REPO = "visenze/visearch-sdk-javascript"
def getVersion() {
def version = sh(script: "npm run get-version --silent", returnStdout: true).trim()
return version
}
pipeline {
agent {
label "${params.AGENT_LABEL ?: 'build-amd64'}"
}
environment {
SEARCH_PLACEMENT_ID = 2967
SEARCH_IM_URL = "https://cdn.visenze.com/images/widget-2.jpg"
REC_PLACEMENT_ID = 1823
REC_PID = "184827-09"
ENDPOINT = "https://search-dev.visenze.com"
}
tools {
nodejs('NodeJS16')
}
stages {
stage('Test') {
steps {
script {
sh 'npm ci'
sh 'npm run write-version'
sh 'npx tsc'
withCredentials([
string(credentialsId: 'search.sg.app-1823.staging', variable: 'SEARCH_APP_KEY'),
string(credentialsId: 'rec.sg.app-2967.staging', variable: 'REC_APP_KEY'),
]) {
codeclimate.testWithCoverage({
sh 'npm run test-with-coverage'
})
}
}
}
}
stage('Tag') {
when {
branch 'production'
}
steps {
script {
def version = getVersion()
build(
job: 'devops_github_utility_create_release',
parameters: [
string(name: 'GITHUB_REPO', value: GIT_REPO),
string(name: 'TAG_NAME', value: version),
string(name: 'TARGET_COMMITISH', value: env.BRANCH_NAME),
string(name: 'NAME', value: "${version} Release"),
string(name: 'BODY', value: "Auto release by Jenkins"),
]
)
}
}
}
}
}