forked from BarathArivazhagan/fork-join-springboot-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-pipeline_script
More file actions
84 lines (84 loc) · 2.5 KB
/
Copy pathbuild-pipeline_script
File metadata and controls
84 lines (84 loc) · 2.5 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
env.DEV_PROJECT = "dev"
env.STAGE_PROJECT ="stage"
pipeline {
agent{
label 'nodejs'
}
options { timeout(time: 40, unit: 'MINUTES') }
stages {
stage ('UI checkout'){
steps {
sh "echo '******** Project checkout *******'"
git branch: 'master', url: "https://github.com/parkarteam/fork-join-springboot-angular.git"
sh "echo '******** END Project checkout *******'"
}
}
stage('npm install'){
steps{
dir('fork-join-demo'){
sh "npm install --silent"
}
}
}
stage('UI Build') {
steps {
dir('fork-join-demo') {
sh "echo '******** UI Build *******'"
sh "npm run build"
sh "echo '******** END UI Build *******'"
}
}
}
stage('image build UI'){
steps{
sh "echo ******** UI image build ********"
script {
dir('fork-join-demo'){
sh "mkdir -p target/uiapp "
sh "cp -r dist/ target/uiapp/dist/"
sh "cp ./nginx.conf target/uiapp/nginx.conf"
sh "cp ./Dockerfile target/uiapp/Dockerfile"
sh "ls -l target/uiapp"
openshift.withCluster() {
openshift.withProject(env.DEV_PROJECT) {openshift.selector("bc", "ui-build").startBuild("--from-dir=target/uiapp", "--wait=true")}
}
}
}
sh "echo ******** END UI image build ********"
}
}
stage('UI deploy to dev'){
steps{
script{
openshift.withCluster() {
openshift.withProject(env.DEV_PROJECT) {
openshift.selector("dc", "fork-join-angular").rollout().latest();
openshift.tag("${env.DEV_PROJECT}/ui-build:latest", "${env.STAGE_PROJECT}/ui-build:stage")
}
}
}
}
}
stage('Promote to STAGE?') {
agent {
label 'skopeo'
}
steps {
timeout(time:30, unit:'MINUTES') {
input message: "Promote to STAGE?", ok: "Promote"
}
}
}
stage('UI deploy to stage'){
steps{
script{
openshift.withCluster() {
openshift.withProject(env.STAGE_PROJECT) {
openshift.selector("dc", "fork-join-angular").rollout().latest();
}
}
}
}
}
}
}