Skip to content

Commit

Permalink
Значение настроек vrunnerSettings "По умолчанию" теперь равно ./tools…
Browse files Browse the repository at this point in the history
…/vrunner.json

В случае если база инициализирована из шаблона - настройки добавляются. Если нет - не добавляются. Это работает только на этапе, где настройки не обязательны.
  • Loading branch information
Segate-ekb committed Aug 27, 2024
1 parent 9c0ba58 commit 50e73ea
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion resources/globalConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"runMigration": true,
"additionalInitializationSteps": [],
"templateDBPath": "",
"vrunnerSettings": "",
"vrunnerSettings": "./tools/vrunner.json",
"extensions": []
},
"bdd": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,8 @@ class InitInfoBaseOptions implements Serializable {
", extensions=" + extensions +
'}'
}

boolean templateDBLoaded() {
return templateDBPath != null && !templateDBPath.isEmpty()
}
}
12 changes: 6 additions & 6 deletions src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ru.pulsar.jenkins.library.utils.VRunner

class InitFromFiles implements Serializable {

private final JobConfiguration config;
private final JobConfiguration config

InitFromFiles(JobConfiguration config) {
this.config = config
Expand All @@ -28,26 +28,26 @@ class InitFromFiles implements Serializable {

Logger.println("Распаковка файлов")

String srcDir;
String srcDir

if (config.sourceFormat == SourceFormat.EDT) {
def env = steps.env();
def env = steps.env()
srcDir = "$env.WORKSPACE/$EdtToDesignerFormatTransformation.CONFIGURATION_DIR"

steps.unstash(EdtToDesignerFormatTransformation.CONFIGURATION_ZIP_STASH)
steps.unzip(srcDir, EdtToDesignerFormatTransformation.CONFIGURATION_ZIP)
} else {
srcDir = config.srcDir;
srcDir = config.srcDir
}

Logger.println("Выполнение загрузки конфигурации из файлов")
String vrunnerPath = VRunner.getVRunnerPath();
String vrunnerPath = VRunner.getVRunnerPath()
def command = "$vrunnerPath update-dev --src $srcDir --ibconnection \"/F./build/ib\""

def options = config.initInfoBaseOptions

String vrunnerSettings = options.vrunnerSettings
if (vrunnerSettings != '' && steps.fileExists(vrunnerSettings)) {
if (options.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 (vrunnerSettings != '' && steps.fileExists(vrunnerSettings)) {
if (options.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
command += " --settings $vrunnerSettings"
}

Expand Down
24 changes: 13 additions & 11 deletions src/ru/pulsar/jenkins/library/steps/InitInfoBase.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ru.pulsar.jenkins.library.utils.VRunner

class InitInfoBase implements Serializable {

private final JobConfiguration config;
private final JobConfiguration config

InitInfoBase(JobConfiguration config) {
this.config = config
Expand All @@ -30,7 +30,15 @@ class InitInfoBase implements Serializable {
List<String> logosConfig = ["LOGOS_CONFIG=$config.logosConfig"]
steps.withEnv(logosConfig) {

String vrunnerPath = VRunner.getVRunnerPath();
String vrunnerPath = VRunner.getVRunnerPath()

// Нужны ли настройки vrunner
def options = config.initInfoBaseOptions
String settingsIncrement = ''
String vrunnerSettings = options.vrunnerSettings
if (options.templateDBLoaded() && steps.fileExists(vrunnerSettings)) {
settingsIncrement = " --settings $vrunnerSettings"
}

if (config.initInfoBaseOptions.runMigration) {
Logger.println("Запуск миграции ИБ")
Expand All @@ -40,16 +48,10 @@ class InitInfoBase implements Serializable {
if (steps.isUnix()) {
executeParameter = '\\' + executeParameter
}
command += executeParameter;
command += executeParameter
command += ' --ibconnection "/F./build/ib"'

def options = config.initInfoBaseOptions

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

command += settingsIncrement
// Запуск миграции
steps.catchError {
VRunner.exec(command)
Expand All @@ -69,7 +71,7 @@ class InitInfoBase implements Serializable {
} else {
config.initInfoBaseOptions.additionalInitializationSteps.each {
Logger.println("Первичная инициализация командой ${it}")
VRunner.exec("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"")
VRunner.exec("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"${settingsIncrement}")
}
}
}
Expand Down

0 comments on commit 50e73ea

Please sign in to comment.