forked from NandiniAV/sunbird-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
51 lines (37 loc) · 1.04 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
#!groovy
node('build-slave') {
currentBuild.result = "SUCCESS"
try {
stage('Checkout'){
checkout scm
}
stage('Pre-Build'){
sh('./installDeps.sh')
}
stage('Build'){
env.NODE_ENV = "build"
print "Environment will be : ${env.NODE_ENV}"
// Getting commit short hash
GIT_COMMIT_HASH = sh (
script: 'git rev-parse --short HEAD',
returnStdout: true
).trim()
echo "Git Hash: ${GIT_COMMIT_HASH}"
// Building image
sh("sudo ./build.sh ${GIT_COMMIT_HASH}")
}
stage('Publish'){
echo 'Push to Repo'
dir('.') {
sh 'ARTIFACT_LABEL=bronze ./dockerPushToRepo.sh'
sh "./src/app/metadata.sh ${GIT_COMMIT_HASH} > metadata.json"
sh "cat metadata.json"
archive includes: "metadata.json"
}
}
}
catch (err) {
currentBuild.result = "FAILURE"
throw err
}
}