forked from Sunbird-Ed/SunbirdEd-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
32 lines (32 loc) · 870 Bytes
/
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
#!groovy
node('build-slave') {
currentBuild.result = "SUCCESS"
try {
stage('Checkout'){
checkout scm
// Getting commit short hash
commit_hash = sh (
script: 'git rev-parse --short HEAD',
returnStdout: true
).trim()
branch_name = sh (
script: 'git name-rev --name-only HEAD | rev | cut -d "/" -f1| rev',
returnStdout: true
).trim()
echo 'branch_name: '+branch_name
}
stage('Build'){
sh("printenv")
echo "Git Hash: "+commit_hash
// Building image
sh("sudo ./build.sh ${commit_hash} ${branch_name}")
}
stage('ArchiveArtifacts'){
archiveArtifacts "metadata.json"
}
}
catch (err) {
currentBuild.result = "FAILURE"
throw err
}
}