From 1beaaad422bc73d375acdc5e66b559c9b85c8271 Mon Sep 17 00:00:00 2001 From: Hanbin Lee Date: Thu, 2 Mar 2023 01:57:54 +0900 Subject: [PATCH] =?UTF-8?q?[#33]=20test:=20jenkins=20cloud=20server=20?= =?UTF-8?q?=EA=B5=AC=EC=B6=95=20=EB=B0=8F=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile-service | 35 ++++++++++++++++++----------------- db/build.gradle.kts | 3 +-- db/{conf => }/flyway.conf | 3 ++- script/db_migration.sh | 7 ++++--- 4 files changed, 25 insertions(+), 23 deletions(-) rename db/{conf => }/flyway.conf (64%) diff --git a/Jenkinsfile-service b/Jenkinsfile-service index 54559ee..073ae69 100644 --- a/Jenkinsfile-service +++ b/Jenkinsfile-service @@ -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' +// } +// } } } \ No newline at end of file diff --git a/db/build.gradle.kts b/db/build.gradle.kts index 5a2cb97..7415256 100644 --- a/db/build.gradle.kts +++ b/db/build.gradle.kts @@ -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 } \ No newline at end of file diff --git a/db/conf/flyway.conf b/db/flyway.conf similarity index 64% rename from db/conf/flyway.conf rename to db/flyway.conf index 4a5a3f1..1af2acc 100644 --- a/db/conf/flyway.conf +++ b/db/flyway.conf @@ -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 \ No newline at end of file +flyway.driver=com.mysql.cj.jdbc.Driver +flyway.locations=filesystem:db/migration,db/seed \ No newline at end of file diff --git a/script/db_migration.sh b/script/db_migration.sh index eddb78a..a6ae826 100644 --- a/script/db_migration.sh +++ b/script/db_migration.sh @@ -1,7 +1,8 @@ #!/bin/bash -cd .. +pwd -./gradlew :db:flywayInfo +echo "param: $1" +#./gradlew :db:flywayInfo -Dconfig=$1 -./gradlew :db:flywayValidate \ No newline at end of file +#./gradlew :db:flywayValidate -Dconfig=$1 \ No newline at end of file