-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
61 lines (52 loc) · 1.38 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
flag=true
pipeline {
agent any
parameters {
//these are types of parameters
string(name: 'VERSION',defaultValue:'',description:'version to deploy on prod')
choice (name: 'VERSION',choices:['1.1.0','1.2.0','1.3.0'],description:'')
booleanParam(name:'executeTests',defaultValue: true, description:'')
}
environment {
//variables defined here can be used by any stage
NEW_VERSION = '1.3.0'
}
stages {
stage('build') {
steps {
echo 'Building Project'
//using environment variable
//To output the value of variable in string use " "
echo "Building version ${NEW_VERSION}"
echo 'successfully installed npm'
}
}
stage('test') {
when {
expression {
params.executeTests
}
}
steps {
echo 'Testing Project on the behalf of our lord & savior morgott'
}
}
stage('deploy') {
steps {
echo 'Deploying Project'
echo "DEploying version ${params.VERSION}"
}
}
}
post {
// the conditions here will execute after the build is done
always {
//this action will happen always regardless of the result of build
echo 'Post build condition running'
}
failure {
//this action will happen only if the build has failed
echo 'Post Action if Build Failed'
}
}
}