Skip to content

Commit de523d7

Browse files
committed
Fixed bug with DB and user cleanup on SKIP_MIGRATIONS
Ready for release v1.2.1
1 parent d3e68e7 commit de523d7

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased] - TBD
88

9+
## [v1.2.1] - 1-23-2018
10+
- Fixed a bug with the cleanup step trying to clean DB and users that weren't created if SKIP_MIGRATIONS = 'true'
11+
912
## [v1.2.0] - 1-23-2018
1013
- SKIP_MIGRATIONS parameter - You can skip running migrations during tests
1114

vars/rails.groovy

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def call(body) {
124124
echo "SQL: CREATE DATABASE IF NOT EXISTS ${env.MYSQL_DATABASE};"
125125
sql connection: 'test_db', sql: "GRANT ALL ON ${env.MYSQL_DATABASE}.* TO \'${env.MYSQL_USER}\'@\'%\' IDENTIFIED BY \'${env.MYSQL_PASSWORD}\';"
126126
echo "SQL: GRANT ALL ON ${env.MYSQL_DATABASE}.* TO \'${env.MYSQL_USER}\'@\'%\' IDENTIFIED BY \'**************\';"
127-
currentBuild.result = 'SUCCESS'
128127
}
128+
currentBuild.result = 'SUCCESS'
129129
}
130130
} catch(Exception e) {
131131
currentBuild.result = 'FAILURE'
@@ -192,13 +192,15 @@ def call(body) {
192192
try {
193193
stage('Clean Up') {
194194
milestone label: 'Clean Up'
195-
sql connection: 'test_db', sql: "DROP DATABASE IF EXISTS ${env.MYSQL_DATABASE};"
196-
echo "SQL: DROP DATABASE IF EXISTS ${env.MYSQL_DATABASE};"
197-
sql connection: 'test_db', sql: "REVOKE ALL PRIVILEGES, GRANT OPTION FROM ${env.MYSQL_USER}@'%';"
198-
echo "SQL: REVOKE ALL PRIVILEGES, GRANT OPTION FROM ${env.MYSQL_USER}@'%';"
199-
sql connection: 'test_db', sql: "DROP USER ${env.MYSQL_USER}@'%';"
200-
echo "SQL: DROP USER ${env.MYSQL_USER}@'%';"
201-
currentBuild.result = 'SUCCESS'
195+
if (config.SKIP_MIGRATIONS == 'false') {
196+
sql connection: 'test_db', sql: "DROP DATABASE IF EXISTS ${env.MYSQL_DATABASE};"
197+
echo "SQL: DROP DATABASE IF EXISTS ${env.MYSQL_DATABASE};"
198+
sql connection: 'test_db', sql: "REVOKE ALL PRIVILEGES, GRANT OPTION FROM ${env.MYSQL_USER}@'%';"
199+
echo "SQL: REVOKE ALL PRIVILEGES, GRANT OPTION FROM ${env.MYSQL_USER}@'%';"
200+
sql connection: 'test_db', sql: "DROP USER ${env.MYSQL_USER}@'%';"
201+
echo "SQL: DROP USER ${env.MYSQL_USER}@'%';"
202+
}
203+
currentBuild.result = 'SUCCESS'
202204
}
203205
} catch(Exception e) {
204206
currentBuild.result = 'FAILURE'

vars/railsOtherBuildEnvs.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env groovy
2+
13
@NonCPS
24
def call() {
35
if (env.OTHER_DEPLOY_ENVS) {

0 commit comments

Comments
 (0)