update CD
This commit is contained in:
parent
73949a23cb
commit
99eab81cb3
@ -19,7 +19,9 @@ job("Deploy") {
|
|||||||
|
|
||||||
shellScript {
|
shellScript {
|
||||||
interpreter = "/bin/bash"
|
interpreter = "/bin/bash"
|
||||||
content = "echo \$ID | ssh -i /dev/stdin -r /mnt/space/share/spc-site/ \"\$USER@\$HOST:/opt\""
|
content = """
|
||||||
|
echo ${'$'}ID | ssh -i /dev/stdin -r /mnt/space/share/spc-site/ "${'$'}USER@${'$'}HOST:/opt"
|
||||||
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -51,13 +51,13 @@ fun Application.spcModule() {
|
|||||||
|
|
||||||
val dataPath = Path.of("data")
|
val dataPath = Path.of("data")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Clear data directory if it is outdated
|
// Clear data directory if it is outdated
|
||||||
val deployDate = dataPath.resolve(DEPLOY_DATE_FILE).takeIf { it.exists() }
|
val deployDate = dataPath.resolve(DEPLOY_DATE_FILE).takeIf { it.exists() }
|
||||||
?.readText()?.let { LocalDateTime.parse(it) }
|
?.readText()?.let { LocalDateTime.parse(it) }
|
||||||
val buildDate = javaClass.getResource(BUILD_DATE_FILE)?.readText()?.let { LocalDateTime.parse(it) }
|
val buildDate = javaClass.getResource(BUILD_DATE_FILE)?.readText()?.let { LocalDateTime.parse(it) }
|
||||||
|
|
||||||
|
val inProduction = environment.config.propertyOrNull("ktor.inProduction") != null
|
||||||
|
|
||||||
if (deployDate != null && buildDate != null && buildDate.isAfter(deployDate)) {
|
if (deployDate != null && buildDate != null && buildDate.isAfter(deployDate)) {
|
||||||
log.info("Outdated data. Resetting data directory.")
|
log.info("Outdated data. Resetting data directory.")
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ fun Application.spcModule() {
|
|||||||
dataPath.createDirectories()
|
dataPath.createDirectories()
|
||||||
dataPath.resolve(DEPLOY_DATE_FILE).writeText(LocalDateTime.now().toString())
|
dataPath.resolve(DEPLOY_DATE_FILE).writeText(LocalDateTime.now().toString())
|
||||||
|
|
||||||
} else if (System.getProperty("spc-production") == "true" && deployDate == null && buildDate != null) {
|
} else if (inProduction && deployDate == null && buildDate != null) {
|
||||||
|
|
||||||
//Writing deploy date in production mode if it does not exist
|
//Writing deploy date in production mode if it does not exist
|
||||||
dataPath.createDirectories()
|
dataPath.createDirectories()
|
||||||
|
Loading…
Reference in New Issue
Block a user