-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfileWin
69 lines (65 loc) · 3.14 KB
/
JenkinsfileWin
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
#!/usr/bin/env groovy
// Liquibase declarative pipeline
//
//
pipeline {
agent any
environment {
PROJ="Postgres_RDS"
GITURL="https://github.com/szandany"
ENVIRONMENT_STEP="${params.step}"
BRANCH="${params.pipeline}"
PATH="C:\\Program Files\\liquibase;${env.PATH}"
}
stages {
stage ('Precheck') {
steps {
bat '''
echo "Current project: "%PROJ%
echo "Current scm branch: "%BRANCH%
echo "Current environment: "%ENVIRONMENT_STEP%
echo "Current PATH: "%PATH%
'''
} // steps
} // stage 'precheck'
stage ('Checkout') {
steps {
// checkout Liquibase project from CLO repo
bat '''
git clone %GITURL%/%PROJ%.git
cd %PROJ%
git checkout %BRANCH%
git status
'''
} // steps for checkout stages
} // stage 'checkout'
stage ('liquibase commands'){
steps {
bat '''
cd %PROJ%
call liquibase --version
echo "------------------------------------"
echo "----------liquibase status----------"
echo "------------------------------------"
call liquibase --url=%Postgres_RDS_URL% --username=%Postgres_RDS_USERNAME% --password=%Postgres_RDS_PASSWORD% --contexts=%ENVIRONMENT_STEP% --changeLogFile=changelog.postgresql.sql --classpath=postgresql-42.2.8.jar status --verbose
echo "---------------------------------------"
echo "----------liquibase updateSQL----------"
echo "---------------------------------------"
call liquibase --url=%Postgres_RDS_URL% --username=%Postgres_RDS_USERNAME% --password=%Postgres_RDS_PASSWORD% --contexts=%ENVIRONMENT_STEP% --changeLogFile=changelog.postgresql.sql --classpath=postgresql-42.2.8.jar updateSQL
echo "--------------------------------------------------------"
echo "----------liquibase tag database with version1----------"
echo "--------------------------------------------------------"
call liquibase --url=%Postgres_RDS_URL% --username=%Postgres_RDS_USERNAME% --password=%Postgres_RDS_PASSWORD% --contexts=%ENVIRONMENT_STEP% --changeLogFile=changelog.postgresql.sql --classpath=postgresql-42.2.8.jar tag version1
echo "------------------------------------"
echo "----------liquibase update----------"
echo "------------------------------------"
call liquibase --url=%Postgres_RDS_URL% --username=%Postgres_RDS_USERNAME% --password=%Postgres_RDS_PASSWORD% --contexts=%ENVIRONMENT_STEP% --changeLogFile=changelog.postgresql.sql --classpath=postgresql-42.2.8.jar update
echo "------------------------------------------------------------"
echo "----------liquibase rollback to version1--------------------"
echo "------------------------------------------------------------"
call liquibase --url=%Postgres_RDS_URL% --username=%Postgres_RDS_USERNAME% --password=%Postgres_RDS_PASSWORD% --contexts=%ENVIRONMENT_STEP% --changeLogFile=changelog.postgresql.sql --classpath=postgresql-42.2.8.jar rollback version1
'''
} // steps
} // Environment stage
} // stages
} // pipeline