-
Notifications
You must be signed in to change notification settings - Fork 34
/
SwitchPipeline
58 lines (52 loc) · 1.48 KB
/
SwitchPipeline
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
pipeline {
agent any
parameters {
booleanParam(name: "RELEASE", defaultValue: false)
choice(name: "DEPLOY_TO", choices: ["", "INT", "PRE", "PROD"])
}
stages {
stage("Build") {
steps {
echo "build code"
}
}
stage("Publish") {
parallel {
stage('Pre-Release') {
when { expression { !params.RELEASE } }
steps {
echo "pre-release"
}
}
stage("Release") {
when { expression { params.RELEASE } }
steps {
echo "Release"
}
}
}
}
stage("Deploy") {
parallel {
stage("INT") {
when { expression { params.DEPLOY_TO == "INT" } }
steps {
echo "Integration"
}
}
stage("PRE") {
when { expression { params.DEPLOY_TO == "PRE" } }
steps {
echo "pre-prod"
}
}
stage("PROD") {
when { expression { params.DEPLOY_TO == "PROD" } }
steps {
echo "production"
}
}
}
}
}
}