Skip to content

Commit

Permalink
Вынос templateDBLoaded на уровень конфигурации
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Aug 29, 2024
1 parent 5c5b284 commit a656789
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,4 @@ class InitInfoBaseOptions implements Serializable {
", extensions=" + extensions +
'}'
}

boolean templateDBLoaded() {
return templateDBPath != null && !templateDBPath.isEmpty()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ class JobConfiguration implements Serializable {
}
}

boolean templateDBLoaded() {
return initInfoBaseOptions.templateDBPath != null && !initInfoBaseOptions.templateDBPath.isEmpty()
}

String v8AgentLabel() {
return v8version
}
Expand Down
2 changes: 1 addition & 1 deletion src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class InitFromFiles implements Serializable {
def options = config.initInfoBaseOptions

String vrunnerSettings = options.vrunnerSettings
if (options.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
if (config.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
command += " --settings $vrunnerSettings"
}

Expand Down
2 changes: 1 addition & 1 deletion src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class InitFromStorage implements Serializable {
def options = config.initInfoBaseOptions

String vrunnerSettings = options.vrunnerSettings
if (options.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
if (config.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
command += " --settings $vrunnerSettings"
}

Expand Down
8 changes: 4 additions & 4 deletions src/ru/pulsar/jenkins/library/steps/InitInfoBase.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class InitInfoBase implements Serializable {
def options = config.initInfoBaseOptions
String settingsIncrement = ''
String vrunnerSettings = options.vrunnerSettings
if (options.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
if (config.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
settingsIncrement = " --settings $vrunnerSettings"
}

if (config.initInfoBaseOptions.runMigration) {
if (options.runMigration) {
Logger.println("Запуск миграции ИБ")

String command = vrunnerPath + ' run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute '
Expand All @@ -61,15 +61,15 @@ class InitInfoBase implements Serializable {
}

steps.catchError {
if (config.initInfoBaseOptions.additionalInitializationSteps.length == 0) {
if (options.additionalInitializationSteps.length == 0) {
FileWrapper[] files = steps.findFiles("tools/vrunner.init*.json")
files = files.sort new OrderBy( { it.name })
files.each {
Logger.println("Первичная инициализация файлом ${it.path}")
VRunner.exec("$vrunnerPath vanessa --settings ${it.path} --ibconnection \"/F./build/ib\"")
}
} else {
config.initInfoBaseOptions.additionalInitializationSteps.each {
options.additionalInitializationSteps.each {
Logger.println("Первичная инициализация командой ${it}")
VRunner.exec("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"${settingsIncrement}")
}
Expand Down
4 changes: 2 additions & 2 deletions src/ru/pulsar/jenkins/library/steps/LoadExtensions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ class LoadExtensions implements Serializable {
}

// For InitInfoBaseOptions, return the vrunner settings path only if the database is loaded from an archive
if (optionsInstance instanceof InitInfoBaseOptions && !optionsInstance.templateDBLoaded()) {
if (optionsInstance instanceof InitInfoBaseOptions && !config.templateDBLoaded()) {
return ""
}

return optionsInstance."vrunnerSettings"
return optionsInstance.vrunnerSettings
}
}

0 comments on commit a656789

Please sign in to comment.