-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathJenkinsfile
60 lines (32 loc) · 1.33 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
node('master') {
currentBuild.result = "SUCCESS"
env.BUILD_DIR="build"
env.BUILD_FILE="octopush-${env.BUILD_NUMBER}.tar.gz"
env.IMAGE_NAME = "quay.io/olx_inc/octopush:${env.BUILD_NUMBER}"
def octopush_img=docker.image("quay.io/olx_inc/composer:5.5")
try {
stage 'Checkout'
checkout scm
stage 'Cleanup'
sh 'rm -Rf build/octopush*.tar.gz'
stage 'Test & Build'
octopush_img.inside {
sh 'scripts/jenkins/build.sh'
}
step([$class: 'ArtifactArchiver', artifacts: "${env.BUILD_DIR}/${env.BUILD_FILE}", fingerprint: true])
stage 'Create & Push image'
def image=docker.build(env.IMAGE_NAME, "--build-arg VERSION=${env.BUILD_NUMBER} ${env.BUILD_DIR}")
image.push()
stage 'Deploy Testing'
sh "oc tag ${env.IMAGE_NAME} octopush/octopush:latest"
stage 'Notify'
slackSend channel: '#releases-panamera', color: 'good', message: "Deployed Octopush ${env.BUILD_NUMBER} on Testing"
} catch (err) {
currentBuild.result = "FAILURE"
mail body: "project build error is here: ${env.BUILD_URL}" ,
from: '[email protected]',
subject: 'project build failed',
to: '[email protected]'
throw err
}
}