-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkinsfile
83 lines (82 loc) · 3.1 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
pipeline {
agent any
stages {
stage('Checkout Application Code') {
steps {
checkout([$class: 'GitSCM', branches: [[name: "*/$BRANCH"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/kdsalvy/Flyway-Application.git']]])
}
}
stage('Validate Scripts on local DB') {
steps {
script {
if("${params.DB}" == "true") {
echo "Validating and Applying scripts ${params.DB}"
flywayrunner commandLineArgs: '', credentialsId: 'mysql-jenkinsdb', flywayCommand: 'migrate', installationName: 'Flyway Runner', locations: "filesystem:${WORKSPACE}\\app-service\\src\\main\\resources\\db\\migration", url: 'jdbc:mysql://localhost:3306/jenkinsdb?useSSL=false'
} else {
echo 'DB option is not checked, skipping stage'
}
}
}
}
stage('Build & Run Unit Tests') {
steps {
script {
if("${params.Backend}" == "true") {
echo "Building Application Backend"
bat "cd ${WORKSPACE}\\app-service && mvn clean compile package -P${params.env}"
} else {
echo 'Backend option is not checked, skipping stage'
}
}
}
}
stage('Build and Push Backend Docker Image') {
steps {
script {
if("${params.Backend}" == "true") {
echo "Building Docker Backend Image"
bat "cd ${WORKSPACE}\\app-service && docker build . -t skedia/app-service:${BUILD_NUMBER}_${params.env}"
// provide credentials to push
//bat "docker push skedia/app-service:${BUILD_NUMBER}_${params.env}"
} else {
echo 'Backend option is not checked, skipping stage'
}
}
}
}
stage('Deploy Backend') {
steps {
script {
if("${params.Backend}" == "true") {
echo 'Calling Deploy tool'
} else {
echo 'Backend option is not checked, skipping stage'
}
}
}
}
stage('Build and Push Frontend Docker Image') {
steps {
script {
if("${params.Frontend}" == "true") {
echo 'Building Frontend docker image'
bat "cd ${WORKSPACE}\\app-ui && docker build . -t skedia/app-ui:${BUILD_NUMBER}_${params.env}"
} else {
echo 'Frontend option is not checked, skipping stage'
}
}
}
}
stage('Deploy Frontend') {
steps {
script {
if("${params.Frontend}" == "true") {
echo 'Calling Deploy tool'
} else {
echo 'Frontend option is not checked, skipping stage'
}
}
}
}
}
}