[#33] test: jenkins cloud server 구축 및 테스트

This commit is contained in:
Hanbin Lee
2023-03-02 01:57:54 +09:00
parent 826cfb0eaa
commit 1beaaad422
4 changed files with 25 additions and 23 deletions

View File

@@ -1,37 +1,38 @@
pipeline {
agent any
tools {
jdk("openjdk-17")
}
// tools {
// jdk("openjdk-17")
// }
stages {
stage('Init') {
steps {
sh 'printenv'
migration_script = './script/db_migration.sh'
FLYWAY_CONFIG = '/home/ec2-user/flyway/flyway.conf'
MIGRATION_SCRIPT = './script/db_migration.sh'
}
}
stage('DB Migrate') {
steps {
sh """
chmod 755 ${migration_script}
/bin/bash ${migration_script}
chmod 755 ${MIGRATION_SCRIPT}
/bin/bash ${MIGRATION_SCRIPT} ${FLYWAY_CONFIG}
"""
}
}
stage('Test') {
steps {
sh './gradlew clean :dongne-service-api:test'
}
}
stage('Build') {
steps {
sh './gradlew clean :dongne-service-api:build -x test'
}
}
// stage('Test') {
// steps {
// sh './gradlew clean :dongne-service-api:test'
// }
// }
//
// stage('Build') {
// steps {
// sh './gradlew clean :dongne-service-api:build -x test'
// }
// }
}
}

View File

@@ -19,8 +19,7 @@ flyway {
baselineDescription = "Start Flyway Migration!"
baselineOnMigrate = true
baselineVersion = "000"
locations = arrayOf("filesystem:./migration", "filesystem:./seed")
configFiles = arrayOf("conf/flyway.conf")
configFiles = arrayOf(System.getProperty("config") ?: "flyway.conf")
cleanDisabled = false // activate flywayClean
ignoreMigrationPatterns = arrayOf("*:pending") // ignore validating pending(대기) state
}

View File

@@ -1,4 +1,5 @@
flyway.url=jdbc:mysql://localhost:3306/dongne?autoreconnect=true&characterEncoding=utf8&serverTimezone=Asia/Seoul
flyway.user=root
flyway.password=beaniejoy
flyway.driver=com.mysql.cj.jdbc.Driver
flyway.driver=com.mysql.cj.jdbc.Driver
flyway.locations=filesystem:db/migration,db/seed

View File

@@ -1,7 +1,8 @@
#!/bin/bash
cd ..
pwd
./gradlew :db:flywayInfo
echo "param: $1"
#./gradlew :db:flywayInfo -Dconfig=$1
./gradlew :db:flywayValidate
#./gradlew :db:flywayValidate -Dconfig=$1