in src/com/epam/digital/data/platform/pipelines/stages/impl/dataplatform/CreateSchema.groovy [35:106]
void run() {
try {
removeDataLoadFiles()
context.platform.podExec(context.postgres.masterPod, "bash -c 'mkdir /pgdata/data-load'", "database")
context.platform.podExec(context.postgres.masterPod, "bash -c 'ln -s /pgdata/data-load/ /tmp/data-load'", "database")
context.script.sh(script: "oc rsync data-model/data-load ${context.postgres.masterPod}:/pgdata")
}
catch (any) {
context.logger.warn("Failed to copy data-model/data-load to ${context.postgres.masterPod}")
}
String OPERATIONAL_MASTER_REGISTRY_DB_URL = "jdbc:postgresql://${context.postgres.OPERATIONAL_MASTER_URL}:" +
"${context.postgres.OPERATIONAL_MASTER_PORT}/${context.registry.name}"
String ANALYTICAL_MASTER_REGISTRY_DB_URL = "jdbc:postgresql://${context.postgres.ANALYTICAL_MASTER_URL}:" +
"${context.postgres.ANALYTICAL_MASTER_PORT}/${context.registry.name}"
context.logger.info("Pre master")
runLiquibase(changeLogFile: LIQUIBASE_PRE_DEPLOY_SCRIPT,
url: OPERATIONAL_MASTER_REGISTRY_DB_URL,
dbName: context.registry.name,
contexts: "all,pub",
regVersion: context.registry.version,
username: context.postgres.ownerRole,
password: context.postgres.ownerRolePass)
context.logger.info("Pre replica")
runLiquibase(changeLogFile: LIQUIBASE_PRE_DEPLOY_SCRIPT,
url: ANALYTICAL_MASTER_REGISTRY_DB_URL,
dbName: context.registry.name,
contexts: "all,sub",
connDbname: context.registry.name,
connHost: context.postgres.OPERATIONAL_MASTER_URL,
connPort: context.postgres.OPERATIONAL_MASTER_PORT,
regVersion: context.registry.version,
username: context.postgres.ownerRole,
password: context.postgres.ownerRolePass)
context.logger.info("Main master")
runLiquibase(changeLogFile: LIQUIBASE_MAIN_SCRIPT,
url: OPERATIONAL_MASTER_REGISTRY_DB_URL,
contexts: "all,pub",
username: context.postgres.ownerRole,
password: context.postgres.ownerRolePass)
context.logger.info("Main replica")
runLiquibase(changeLogFile: LIQUIBASE_MAIN_SCRIPT,
url: ANALYTICAL_MASTER_REGISTRY_DB_URL,
contexts: "all,sub",
username: context.postgres.ownerRole,
password: context.postgres.ownerRolePass)
context.logger.info("Post deploy master")
runLiquibase(changeLogFile: LIQUIBASE_POST_DEPLOY_SCRIPT,
url: OPERATIONAL_MASTER_REGISTRY_DB_URL,
contexts: "all,pub",
dbName: context.registry.name,
regVersion: context.registry.version,
username: context.postgres.operational_pg_user,
password: context.postgres.operational_pg_password)
context.logger.info("Post deploy replica")
runLiquibase(changeLogFile: LIQUIBASE_POST_DEPLOY_SCRIPT,
url: ANALYTICAL_MASTER_REGISTRY_DB_URL,
contexts: "all,sub",
dbName: context.registry.name,
regVersion: context.registry.version,
username: context.postgres.analytical_pg_user,
password: context.postgres.analytical_pg_password)
removeDataLoadFiles()
}