-
Notifications
You must be signed in to change notification settings - Fork 10
/
News-Dashboard-Master-Jenkinsfile
69 lines (61 loc) · 1.86 KB
/
News-Dashboard-Master-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
62
63
64
65
66
67
68
69
node('master') {
timeout(30)
{
stage('Build image') {
openshift.withCluster() {
openshift.withProject() {
echo "Building builder..."
def bc1 = openshift.selector('bc', 'frontend-npm-master-builder')
def buildSelector1 = bc1.startBuild()
sleep(5)
buildSelector1.logs('-f')
sleep(10)
echo "Building runtime..."
def bc2 = openshift.selector('bc', 'frontend-nginx-master-runtime')
def buildSelector2 = bc2.startBuild()
sleep(5)
buildSelector2.logs('-f')
sleep(10)
echo "Assembling frontend..."
def bc3 = openshift.selector('bc', 'news-dashboard-master')
def buildSelector3 = bc3.startBuild()
sleep(5)
buildSelector3.logs('-f')
echo "Inject into runtime..."
def bc4 = openshift.selector('bc', 'news-dashboard-master-static')
def buildSelector4 = bc4.startBuild()
sleep(180)
}
}
}
}
stage('Tag Build') {
openshift.withCluster() {
openshift.withProject() {
echo "Tagging build..."
openshift.tag("news-dashboard-master-static:latest", "news-dashboard-static:MASTER-$BUILD_ID")
openshift.tag("news-dashboard-static:MASTER-$BUILD_ID", "news-dashboard-static:test")
openshift.tag("news-dashboard-static:MASTER-$BUILD_ID", "news-dashboard-static:prod")
}
}
}
stage('Deploy on Test') {
openshift.withCluster() {
openshift.withProject("05e933-test") {
echo "Deploying to test..."
openshift.selector("dc", "news-dashboard").rollout().latest()
}
}
}
timeout(3000)
{
stage('Deploy on Prod') {
input "Deploy to prod?"
openshift.withCluster() {
openshift.withProject("05e933-prod") {
openshift.selector("dc", "news-dashboard").rollout().latest()
}
}
}
}
}