From af5791d92a2dfe20472a372ead9f2326633d4c64 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 15 Oct 2020 14:51:58 +0300 Subject: [PATCH 01/99] =?UTF-8?q?=D0=A8=D0=B0=D0=B3=20=D0=B8=D0=BD=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=BD=D0=BE=D0=B9=20=D0=B1=D0=B0=D0=B7=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 5 +++ resources/schema.json | 22 ++++++++++ .../configuration/ConfigurationReader.groovy | 7 ++++ .../configuration/InitInfobaseOptions.groovy | 27 +++++++++++++ .../configuration/JobConfiguration.groovy | 5 +++ .../library/configuration/StageFlags.groovy | 6 ++- .../jenkins/library/steps/InitInfobase.groovy | 40 +++++++++++++++++++ .../ConfigurationReaderTest.java | 9 ++++- test/unit/resources/jobConfiguration.json | 6 +++ vars/initInfobase.groovy | 10 +++++ vars/pipeline1C.groovy | 39 ++++++++++++++---- 11 files changed, 167 insertions(+), 9 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy create mode 100644 src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy create mode 100644 vars/initInfobase.groovy diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index 332119d..cf5a9c6 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -6,11 +6,16 @@ "storage": "UNKNOWN_ID" }, "stages": { + "initSteps": false, "sonarqube": false, "syntaxCheck": false, "edtValidate": false, "smoke": false }, + "initInfobase": { + "runMigration": true, + "additionalMigrationSteps": [] + }, "sonarqube": { "sonarQubeInstallation": "", "useSonarScannerFromPath": true, diff --git a/resources/schema.json b/resources/schema.json index 40bcd1c..df6a028 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -45,6 +45,28 @@ "smoke" : { "type" : "boolean", "description" : "Дымовые тесты включены" + }, + "initSteps" : { + "type" : "boolean", + "description" : "Предварительные шаги инициализации включены" + } + } + }, + "initInfobase" : { + "type" : "object", + "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:InitInfobaseOptions", + "description" : "Настройки шага инициализации ИБ", + "properties" : { + "runMigration" : { + "type" : "boolean", + "description" : "Запустить миграцию ИБ" + }, + "additionalMigrationSteps" : { + "type" : "array", + "description" : "Дополнительные шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.first.json\")\n ", + "items" : { + "type" : "string" + } } } }, diff --git a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy index d17ddf5..1e2bcca 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy @@ -41,12 +41,14 @@ class ConfigurationReader implements Serializable { def nonMergeableSettings = Arrays.asList( "secrets", "stageFlags", + "initInfobaseOptions", "sonarQubeOptions", "syntaxCheckOptions", "resultsTransformOptions" ).toSet() mergeObjects(baseConfiguration, configurationToMerge, nonMergeableSettings) + mergeInitInfobaseOptions(baseConfiguration.initInfobaseOptions, configurationToMerge.initInfobaseOptions); return baseConfiguration; } @@ -70,4 +72,9 @@ class ConfigurationReader implements Serializable { ) }) } + + @NonCPS + private static void mergeInitInfobaseOptions(InitInfobaseOptions baseObject, InitInfobaseOptions objectToMerge) { + baseObject.additionalMigrationSteps = objectToMerge.additionalMigrationSteps.clone() + } } diff --git a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy new file mode 100644 index 0000000..80f6b66 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy @@ -0,0 +1,27 @@ +package ru.pulsar.jenkins.library.configuration + +import com.cloudbees.groovy.cps.NonCPS +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonPropertyDescription + +@JsonIgnoreProperties(ignoreUnknown = true) +class InitInfobaseOptions implements Serializable { + + @JsonPropertyDescription("Запустить миграцию ИБ") + boolean runMigration = true + + @JsonPropertyDescription("""Дополнительные шаги, запускаемые через vrunner. + В каждой строке передается отдельная команда + vrunner и ее аргументы (например, "vanessa --settings ./tools/vrunner.first.json") + """) + String[] additionalMigrationSteps + + @Override + @NonCPS + String toString() { + return "InitInfobaseOptions{" + + "runMigration=" + runMigration + + ", additionalMigrationSteps=" + additionalMigrationSteps + + '}'; + } +} diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index 3368d8e..87e23b3 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -20,6 +20,10 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Идентификаторы сохраненных секретов") Secrets secrets; + @JsonProperty("initInfobase") + @JsonPropertyDescription("Настройки шага инициализации ИБ") + InitInfobaseOptions initInfobaseOptions; + @JsonProperty("sonarqube") @JsonPropertyDescription("Настройки анализа SonarQube") SonarQubeOptions sonarQubeOptions; @@ -40,6 +44,7 @@ class JobConfiguration implements Serializable { ", srcDir='" + srcDir + '\'' + ", stageFlags=" + stageFlags + ", secrets=" + secrets + + ", initInfobaseOptions=" + initInfobaseOptions + ", sonarQubeOptions=" + sonarQubeOptions + ", syntaxCheckOptions=" + syntaxCheckOptions + ", resultsTransformOptions=" + resultsTransformOptions + diff --git a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy index c73a158..042aab2 100644 --- a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy @@ -18,6 +18,9 @@ class StageFlags implements Serializable { @JsonPropertyDescription("Дымовые тесты включены") boolean smoke + @JsonPropertyDescription("Предварительные шаги инициализации включены") + boolean initSteps + @Override @NonCPS String toString() { @@ -26,10 +29,11 @@ class StageFlags implements Serializable { ", syntaxCheck=" + syntaxCheck + ", edtValidate=" + edtValidate + ", smoke=" + smoke + + ", initSteps=" + initSteps + '}'; } boolean needInfobase() { - return smoke || syntaxCheck + return smoke || syntaxCheck || initSteps } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy new file mode 100644 index 0000000..09e1a43 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -0,0 +1,40 @@ +package ru.pulsar.jenkins.library.steps + +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.Logger + +class InitInfobase implements Serializable { + + private final JobConfiguration config; + + InitInfobase(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + if (!config.stageFlags.initSteps) { + Logger.println("Init step is disabled") + return + } + + if (config.initInfobaseOptions.runMigration) { + Logger.println("Запуск миграции ИБ") + + // Запуск миграции + steps.cmd("oscript_modules/bin/vrunner run --command \"ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;\" --execute \$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection \"/F./build/ib\"") + } else { + Logger.println("Шаг миграции ИБ выключен") + } + + config.initInfobaseOptions.additionalMigrationSteps.each { + Logger.println("Первичная инициализация командой ${it}") + steps.cmd("oscript_modules/bin/vrunner ${it}") + } + } +} diff --git a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java index 01e4edc..d0be9f1 100644 --- a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java +++ b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java @@ -31,14 +31,21 @@ class ConfigurationReaderTest { // then assertThat(jobConfiguration.getV8version()).isEqualTo("8.3.14.1944"); + assertThat(jobConfiguration.getSonarQubeOptions().getSonarScannerToolName()).isEqualTo("sonar-scanner"); + assertThat(jobConfiguration.getSecrets()) .hasFieldOrPropertyWithValue("storage", "1234") .hasFieldOrPropertyWithValue("storagePath", "UNKNOWN_ID") ; + assertThat(jobConfiguration.getSyntaxCheckOptions().getCheckModes()).hasSize(1); + assertThat(jobConfiguration.getResultsTransformOptions().isRemoveSupport()).isTrue(); - assertThat(jobConfiguration.getResultsTransformOptions().getSupportLevel()).isEqualTo(0); + assertThat(jobConfiguration.getResultsTransformOptions().getSupportLevel()).isZero(); + + assertThat(jobConfiguration.getInitInfobaseOptions().getRunMigration()).isFalse(); + assertThat(jobConfiguration.getInitInfobaseOptions().getAdditionalMigrationSteps()).contains("vanessa --settings ./tools/vrunner.first.json"); } } \ No newline at end of file diff --git a/test/unit/resources/jobConfiguration.json b/test/unit/resources/jobConfiguration.json index 2cd66f2..173d261 100644 --- a/test/unit/resources/jobConfiguration.json +++ b/test/unit/resources/jobConfiguration.json @@ -6,6 +6,12 @@ "stages": { "syntaxCheck": true }, + "initInfobase": { + "runMigration": false, + "additionalMigrationSteps": [ + "vanessa --settings ./tools/vrunner.first.json" + ] + }, "syntaxCheck": { "checkModes": ["-ThinClient"] }, diff --git a/vars/initInfobase.groovy b/vars/initInfobase.groovy new file mode 100644 index 0000000..7eabdcb --- /dev/null +++ b/vars/initInfobase.groovy @@ -0,0 +1,10 @@ +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.InitInfobase + +def call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) + + def initInfobase = new InitInfobase(config) + initInfobase.run() +} \ No newline at end of file diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index d07006f..e04064f 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -46,18 +46,43 @@ void call() { expression { config.stageFlags.needInfobase() } } - steps { - printLocation() + stages { + stage('Создание ИБ') { + steps { + printLocation() - installLocalDependencies() + installLocalDependencies() - dir("build/out") { echo '' } + dir("build/out") { echo '' } - // Создание базы загрузкой конфигурации из хранилища - initFromStorage config + // Создание базы загрузкой конфигурации из хранилища + initFromStorage config + } + } - zipInfobase() + stage('Инициализация ИБ') { + when { + beforeAgent true + expression { config.stageFlags.initSteps } + } + steps { + printLocation() + + // Инициализация и первичная миграция + initInfobase config + } + } + + stage('Архивация ИБ') { + steps { + printLocation() + + zipInfobase() + } + + } } + } stage('Трансформация в формат EDT') { From efc54c9357d4eb5a677b7799e44a4813caec860c Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 15 Oct 2020 16:23:05 +0300 Subject: [PATCH 02/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BA=D0=B8=20=D0=B2=20=D0=BE=D0=B4=D0=B8=D0=BD=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D1=8B=D1=85=20=D0=BA=D0=B0=D0=B2=D1=8B=D1=87=D0=BA?= =?UTF-8?q?=D0=B0=D1=85=20=D0=B4=D0=BB=D1=8F=20=D1=8D=D0=BA=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20$?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 09e1a43..593d246 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -27,7 +27,7 @@ class InitInfobase implements Serializable { Logger.println("Запуск миграции ИБ") // Запуск миграции - steps.cmd("oscript_modules/bin/vrunner run --command \"ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;\" --execute \$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection \"/F./build/ib\"") + steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \$runnerRoot/epf/ЗакрытьПредприятие.epf') } else { Logger.println("Шаг миграции ИБ выключен") } From a2d734cc8d934445fb99e88a8071db3de3b1657e Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 15 Oct 2020 16:23:14 +0300 Subject: [PATCH 03/99] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/configuration/InitInfobaseOptions.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy index 80f6b66..0e717a8 100644 --- a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy @@ -11,8 +11,8 @@ class InitInfobaseOptions implements Serializable { boolean runMigration = true @JsonPropertyDescription("""Дополнительные шаги, запускаемые через vrunner. - В каждой строке передается отдельная команда - vrunner и ее аргументы (например, "vanessa --settings ./tools/vrunner.first.json") + В каждой строке передается отдельная команда + vrunner и ее аргументы (например, "vanessa --settings ./tools/vrunner.first.json") """) String[] additionalMigrationSteps From ee00dcdbbe286d243ca9b08003e51506aa36dc3b Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 15 Oct 2020 16:38:16 +0300 Subject: [PATCH 04/99] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=83=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B0=20ibconnection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 593d246..9de5a73 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -27,14 +27,14 @@ class InitInfobase implements Serializable { Logger.println("Запуск миграции ИБ") // Запуск миграции - steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \$runnerRoot/epf/ЗакрытьПредприятие.epf') + steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') } else { Logger.println("Шаг миграции ИБ выключен") } config.initInfobaseOptions.additionalMigrationSteps.each { Logger.println("Первичная инициализация командой ${it}") - steps.cmd("oscript_modules/bin/vrunner ${it}") + steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") } } } From 75c69da9b104d06592bb9ee83321f726eea55567 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 15 Oct 2020 17:09:06 +0300 Subject: [PATCH 05/99] =?UTF-8?q?=D0=AD=D0=BA=D1=80=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20$?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 9de5a73..f5940a9 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -27,7 +27,7 @@ class InitInfobase implements Serializable { Logger.println("Запуск миграции ИБ") // Запуск миграции - steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') + steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') } else { Logger.println("Шаг миграции ИБ выключен") } From 77aabd91c590dae88ca6cc27f6657d6183706326 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 15 Oct 2020 17:54:55 +0300 Subject: [PATCH 06/99] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0?= =?UTF-8?q?=20=D1=81=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 2 ++ vars/pipeline1C.groovy | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index f5940a9..df3c59d 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -18,6 +18,8 @@ class InitInfobase implements Serializable { Logger.printLocation() + steps.createDir('build/out') + if (!config.stageFlags.initSteps) { Logger.println("Init step is disabled") return diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index e04064f..d9a1363 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -53,7 +53,7 @@ void call() { installLocalDependencies() - dir("build/out") { echo '' } + createDir('build/out') // Создание базы загрузкой конфигурации из хранилища initFromStorage config From 5918ee3bb8c3291eef3ad4fe94b13b97a880c613 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 19 Oct 2020 14:24:46 +0300 Subject: [PATCH 07/99] =?UTF-8?q?=D0=A1=D0=BA=D0=B0=D1=87=D0=B8=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8=20VAS?= =?UTF-8?q?=20=D1=81=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=D0=BC=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=B4=20linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/IStepExecutor.groovy | 4 ++++ src/ru/pulsar/jenkins/library/StepExecutor.groovy | 5 +++++ src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index 8942a1c..a7b76c2 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -45,4 +45,8 @@ interface IStepExecutor { def unzip(String dir, String zipFile, quiet) def catchError(Closure body) + + def httpRequest(String url, String outputFile) + + def httpRequest(String url, String outputFile, String responseHandle, boolean wrapAsMultipart) } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 2b425a5..f784971 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -103,4 +103,9 @@ class StepExecutor implements IStepExecutor { def catchError(Closure body) { steps.catchError body } + + @Override + def httpRequest(String url, String outputFile, String responseHandle = 'NONE', boolean wrapAsMultipart = false) { + steps.httpRequest responseHandle: responseHandle, outputFile: outputFile, url: url, wrapAsMultipart: wrapAsMultipart + } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index df3c59d..87727c5 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -34,6 +34,12 @@ class InitInfobase implements Serializable { Logger.println("Шаг миграции ИБ выключен") } + // TODO: удалить после выхода VAS 1.0.35 + steps.httpRequest( + 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH', + 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' + ) + config.initInfobaseOptions.additionalMigrationSteps.each { Logger.println("Первичная инициализация командой ${it}") steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") From 58ae0ac1972030942614963b1dafebe66b24cd8b Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 19 Oct 2020 15:48:58 +0300 Subject: [PATCH 08/99] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C?= =?UTF-8?q?=D1=82=D0=B0=D1=82=D0=BE=D0=B2=20=D0=B0=D0=BB=D0=BB=D1=8E=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/IStepExecutor.groovy | 4 ++++ src/ru/pulsar/jenkins/library/StepExecutor.groovy | 9 +++++++-- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index a7b76c2..3691b78 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -34,6 +34,8 @@ interface IStepExecutor { def stash(String name, String includes) + def stash(String name, String includes, boolean allowEmpty) + def unstash(String name) def zip(String dir, String zipFile) @@ -49,4 +51,6 @@ interface IStepExecutor { def httpRequest(String url, String outputFile) def httpRequest(String url, String outputFile, String responseHandle, boolean wrapAsMultipart) + + def error(String errorMessage) } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index f784971..17a7aca 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -80,8 +80,8 @@ class StepExecutor implements IStepExecutor { } @Override - def stash(String name, String includes) { - steps.stash name: name, includes: includes + def stash(String name, String includes, boolean allowEmpty = false) { + steps.stash name: name, includes: includes, allowEmpty: allowEmpty } @Override @@ -108,4 +108,9 @@ class StepExecutor implements IStepExecutor { def httpRequest(String url, String outputFile, String responseHandle = 'NONE', boolean wrapAsMultipart = false) { steps.httpRequest responseHandle: responseHandle, outputFile: outputFile, url: url, wrapAsMultipart: wrapAsMultipart } + + @Override + def error(String errorMessage) { + steps.error errorMessage + } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 87727c5..0dabc30 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -44,5 +44,8 @@ class InitInfobase implements Serializable { Logger.println("Первичная инициализация командой ${it}") steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") } + + steps.stash('init-allure', 'build/out/allure/*', true) + steps.stash('init-cucumber', 'build/out/cucumber/*', true) } } From 6893b6610e2e6e7d6bb008ddd5fcb6850ae7fa03 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 19 Oct 2020 16:48:07 +0300 Subject: [PATCH 09/99] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20allure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/IStepExecutor.groovy | 4 +- .../jenkins/library/StepExecutor.groovy | 12 +++++ .../jenkins/library/steps/InitInfobase.groovy | 12 +++-- .../library/steps/PublishAllure.groovy | 45 +++++++++++++++++++ .../jenkins/library/utils/FileUtils.groovy | 27 +++++++++++ vars/pipeline1C.groovy | 10 ++++- vars/saveResults.groovy | 32 +++++++++++++ 7 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy create mode 100644 src/ru/pulsar/jenkins/library/utils/FileUtils.groovy create mode 100644 vars/saveResults.groovy diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index 3691b78..d706d6b 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -48,9 +48,9 @@ interface IStepExecutor { def catchError(Closure body) - def httpRequest(String url, String outputFile) - def httpRequest(String url, String outputFile, String responseHandle, boolean wrapAsMultipart) def error(String errorMessage) + + def allure(List results) } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 17a7aca..0745577 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -113,4 +113,16 @@ class StepExecutor implements IStepExecutor { def error(String errorMessage) { steps.error errorMessage } + + @Override + def allure(List results) { + steps.allure([ + commandline: 'allure', + includeProperties: false, + jdk: '', + properties: [], + reportBuildPolicy: 'ALWAYS', + results: results + ]) + } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 0dabc30..8e65587 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -29,7 +29,9 @@ class InitInfobase implements Serializable { Logger.println("Запуск миграции ИБ") // Запуск миграции - steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') + steps.catchError { + steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') + } } else { Logger.println("Шаг миграции ИБ выключен") } @@ -40,9 +42,11 @@ class InitInfobase implements Serializable { 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' ) - config.initInfobaseOptions.additionalMigrationSteps.each { - Logger.println("Первичная инициализация командой ${it}") - steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + steps.catchError { + config.initInfobaseOptions.additionalMigrationSteps.each { + Logger.println("Первичная инициализация командой ${it}") + steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + } } steps.stash('init-allure', 'build/out/allure/*', true) diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy new file mode 100644 index 0000000..5375e81 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -0,0 +1,45 @@ +package ru.pulsar.jenkins.library.steps + +import hudson.FilePath +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.FileUtils +import ru.pulsar.jenkins.library.utils.Logger + +class PublishAllure implements Serializable { + + private final JobConfiguration config; + + PublishAllure(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + steps.unstash('init-allure') + + FilePath allurePath = FileUtils.getFilePath('build/out/allure') + if (!allurePath.exists()) { + Logger.println("Отсутствуют результаты allure для публикации") + } + + List results = new ArrayList<>(); + + def allureSubDirs = allurePath.listDirectories() + if (allureSubDirs.size() > 0) { + allureSubDirs.forEach({ filePath -> results.add(getPath(filePath)) }) + } else { + results.add(getPath(allurePath)) + } + + steps.allure(results) + } + + private static String getPath(FilePath filePath) { + filePath.getBaseName() + File.separator + filePath.getName() + } +} diff --git a/src/ru/pulsar/jenkins/library/utils/FileUtils.groovy b/src/ru/pulsar/jenkins/library/utils/FileUtils.groovy new file mode 100644 index 0000000..eadf463 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/utils/FileUtils.groovy @@ -0,0 +1,27 @@ +package ru.pulsar.jenkins.library.utils + +import hudson.FilePath +import jenkins.model.Jenkins +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.ioc.ContextRegistry + +class FileUtils { + + static FilePath getFilePath(String path) { + + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + def env = steps.env(); + + String nodeName = env.NODE_NAME; + if (nodeName == null) { + steps.error 'Переменная среды NODE_NAME не задана. Запуск вне node или без agent?' + } + + if (nodeName == "master") { + return new FilePath(new File(path)); + } else { + return new FilePath(Jenkins.getInstanceOrNull().getComputer(nodeName).getChannel(), path); + } + } +} diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index d9a1363..ae8652e 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -66,8 +66,6 @@ void call() { expression { config.stageFlags.initSteps } } steps { - printLocation() - // Инициализация и первичная миграция initInfobase config } @@ -169,6 +167,14 @@ void call() { } } } + + post('post-stage') { + always { + node('agent') { + saveResults config + } + } + } } } diff --git a/vars/saveResults.groovy b/vars/saveResults.groovy new file mode 100644 index 0000000..c142b28 --- /dev/null +++ b/vars/saveResults.groovy @@ -0,0 +1,32 @@ +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.PublishAllure + +def call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) + + def publishAllure = new PublishAllure(config) + publishAllure.run() + +// step([ +// $class: 'CucumberReportPublisher', +// fileIncludePattern: '*.json', +// jsonReportDirectory: 'build/out/cucumber' +// ]) +// +// step([ +// $class: 'CukedoctorPublisher', +// featuresDir: 'build/out/cucumber', +// format: 'HTML', +// hideFeaturesSection: false, +// hideScenarioKeyword: false, +// hideStepTime: false, +// hideSummary: false, +// hideTags: false, +// numbered: true, +// sectAnchors: true, +// title: 'Living Documentation', +// toc: 'LEFT' +// ]) + +} \ No newline at end of file From 2c937af02eef27dc81c3618aa2be4203aece9569 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 19 Oct 2020 17:23:35 +0300 Subject: [PATCH 10/99] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=82=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82=D1=81=D1=83=D1=82=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=B8=D0=B8=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index 5375e81..f6c404d 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -25,6 +25,7 @@ class PublishAllure implements Serializable { FilePath allurePath = FileUtils.getFilePath('build/out/allure') if (!allurePath.exists()) { Logger.println("Отсутствуют результаты allure для публикации") + return } List results = new ArrayList<>(); From c6b8e7532de55a2e5add94dcf379172960eab140 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 19 Oct 2020 18:19:25 +0300 Subject: [PATCH 11/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=81=D0=BA=D0=B0=D1=87=D0=B8=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20VAS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 8e65587..6c72477 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -38,7 +38,7 @@ class InitInfobase implements Serializable { // TODO: удалить после выхода VAS 1.0.35 steps.httpRequest( - 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH', + 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' ) From 72a53cf4936f07611b739091b8afdafbc0742d2b Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 20 Oct 2020 09:55:52 +0300 Subject: [PATCH 12/99] =?UTF-8?q?includeAll=20=D0=B2=20=D1=81=D1=82=D1=8D?= =?UTF-8?q?=D1=88=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 6c72477..deb5ec7 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -49,7 +49,7 @@ class InitInfobase implements Serializable { } } - steps.stash('init-allure', 'build/out/allure/*', true) - steps.stash('init-cucumber', 'build/out/cucumber/*', true) + steps.stash('init-allure', 'build/out/allure/**', true) + steps.stash('init-cucumber', 'build/out/cucumber/**', true) } } From 1ad6797a58e62dc2bc13f1b36eae10e01324558b Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 20 Oct 2020 11:41:31 +0300 Subject: [PATCH 13/99] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=BD=D0=BE=D0=B5=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=B0=D0=BB=D0=BB=D1=8E=D1=80=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index f6c404d..135c824 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -22,7 +22,9 @@ class PublishAllure implements Serializable { steps.unstash('init-allure') - FilePath allurePath = FileUtils.getFilePath('build/out/allure') + def env = steps.env(); + + FilePath allurePath = FileUtils.getFilePath("$env.WORKSPACE/build/out/allure") if (!allurePath.exists()) { Logger.println("Отсутствуют результаты allure для публикации") return From 67a46f4e1344f1686fe18277798f1a3a3beca0a1 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 20 Oct 2020 11:59:42 +0300 Subject: [PATCH 14/99] =?UTF-8?q?=D0=A3=D0=BA=D0=B0=D0=B7=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BB=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BF=D1=83=D1=82=D0=B8=20=D0=BD=D0=B0=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BD=D0=BE=D0=B9=20=D0=BC=D0=B0=D1=88=D0=B8?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=B4=D0=BB=D1=8F=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index 135c824..9db5e24 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -34,15 +34,12 @@ class PublishAllure implements Serializable { def allureSubDirs = allurePath.listDirectories() if (allureSubDirs.size() > 0) { - allureSubDirs.forEach({ filePath -> results.add(getPath(filePath)) }) + allureSubDirs.forEach({ filePath -> results.add(filePath.getRemote()) }) } else { - results.add(getPath(allurePath)) + results.add(allurePath.getRemote()) } steps.allure(results) } - private static String getPath(FilePath filePath) { - filePath.getBaseName() + File.separator + filePath.getName() - } } From 2f61ef2e36bea54c9cb46c2f349e89f701a28a83 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 20 Oct 2020 16:17:57 +0300 Subject: [PATCH 15/99] =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D1=82=D0=B0=D1=86=D0=B8=D1=8F=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=20=D0=B2=20ResultsConfi?= =?UTF-8?q?g=20allure-=D1=88=D0=B0=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 1 + src/ru/pulsar/jenkins/library/StepExecutor.groovy | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8e31f1f..7af7246 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -79,6 +79,7 @@ sharedLibrary { pluginDependencies { dependency("org.jenkins-ci.plugins", "pipeline-build-step", "2.12") dependency("org.6wind.jenkins", "lockable-resources", "2.7") + dependency("ru.yandex.qatools.allure", "allure-jenkins-plugin", "2.28.1") val declarativePluginsVersion = "1.6.0" dependency("org.jenkinsci.plugins", "pipeline-model-api", declarativePluginsVersion) dependency("org.jenkinsci.plugins", "pipeline-model-declarative-agent", "1.1.1") diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 0745577..8c1a2b0 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,6 +1,7 @@ package ru.pulsar.jenkins.library import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction +import ru.yandex.qatools.allure.jenkins.config.ResultsConfig class StepExecutor implements IStepExecutor { @@ -122,7 +123,7 @@ class StepExecutor implements IStepExecutor { jdk: '', properties: [], reportBuildPolicy: 'ALWAYS', - results: results + results: ResultsConfig.convertPaths(results) ]) } } From b935f8a7dac36893f03617da24113909cda6cea7 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 11:33:02 +0300 Subject: [PATCH 16/99] forEach -> each --- src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index 9db5e24..de76c22 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -32,10 +32,10 @@ class PublishAllure implements Serializable { List results = new ArrayList<>(); - def allureSubDirs = allurePath.listDirectories() - if (allureSubDirs.size() > 0) { - allureSubDirs.forEach({ filePath -> results.add(filePath.getRemote()) }) - } else { + allurePath.listDirectories().each { FilePath filePath -> + results.add(filePath.getRemote()) + } + if (results.isEmpty()) { results.add(allurePath.getRemote()) } From 83e2ac876b40055bf47507e31a13d21845b82834 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 12:17:07 +0300 Subject: [PATCH 17/99] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D0=BE=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20?= =?UTF-8?q?=D1=88=D0=B0=D0=B3=D0=B0=20=D0=B0=D0=BB=D0=BB=D1=8E=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/StepExecutor.groovy | 2 ++ src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 8c1a2b0..df33b21 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,6 +1,7 @@ package ru.pulsar.jenkins.library import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction +import ru.pulsar.jenkins.library.utils.Logger import ru.yandex.qatools.allure.jenkins.config.ResultsConfig class StepExecutor implements IStepExecutor { @@ -117,6 +118,7 @@ class StepExecutor implements IStepExecutor { @Override def allure(List results) { + Logger.println(ResultsConfig.convertPaths(results)) steps.allure([ commandline: 'allure', includeProperties: false, diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index de76c22..09d7569 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -32,6 +32,9 @@ class PublishAllure implements Serializable { List results = new ArrayList<>(); + Logger.println(allurePath.toString()) + Logger.println(allurePath.listDirectories().toString()) + allurePath.listDirectories().each { FilePath filePath -> results.add(filePath.getRemote()) } @@ -39,6 +42,8 @@ class PublishAllure implements Serializable { results.add(allurePath.getRemote()) } + Logger.println(results.toString()) + steps.allure(results) } From d6e3b02085987c494df4ed61bf2c0d2db8743b04 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 12:27:51 +0300 Subject: [PATCH 18/99] =?UTF-8?q?BDD=20=D1=88=D0=B0=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 6 +++ resources/schema.json | 20 +++++++- .../jenkins/library/IStepExecutor.groovy | 2 + .../jenkins/library/StepExecutor.groovy | 5 ++ .../library/configuration/BddOptions.groovy | 26 +++++++++++ .../configuration/ConfigurationReader.groovy | 17 ++++++- .../configuration/JobConfiguration.groovy | 5 ++ .../library/configuration/StageFlags.groovy | 6 ++- .../pulsar/jenkins/library/steps/Bdd.groovy | 46 +++++++++++++++++++ .../ConfigurationReaderTest.java | 2 + vars/bdd.groovy | 10 ++++ vars/pipeline1C.groovy | 11 +++++ 12 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/configuration/BddOptions.groovy create mode 100644 src/ru/pulsar/jenkins/library/steps/Bdd.groovy create mode 100644 vars/bdd.groovy diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index cf5a9c6..25b5e5a 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -8,6 +8,7 @@ "stages": { "initSteps": false, "sonarqube": false, + "bdd": false, "syntaxCheck": false, "edtValidate": false, "smoke": false @@ -16,6 +17,11 @@ "runMigration": true, "additionalMigrationSteps": [] }, + "bddOptions": { + "vrunnerSteps": [ + "vanessa --settings ./tools/vrunner.json" + ] + }, "sonarqube": { "sonarQubeInstallation": "", "useSonarScannerFromPath": true, diff --git a/resources/schema.json b/resources/schema.json index df6a028..75512e8 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -49,6 +49,10 @@ "initSteps" : { "type" : "boolean", "description" : "Предварительные шаги инициализации включены" + }, + "bdd" : { + "type" : "boolean", + "description" : "Запуск BDD сценариев включен" } } }, @@ -63,7 +67,21 @@ }, "additionalMigrationSteps" : { "type" : "array", - "description" : "Дополнительные шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.first.json\")\n ", + "description" : "Дополнительные шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.first.json\")\n ", + "items" : { + "type" : "string" + } + } + } + }, + "bddOptions" : { + "type" : "object", + "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:BddOptions", + "description" : "Настройки шага запуска BDD сценариев", + "properties" : { + "vrunnerSteps" : { + "type" : "array", + "description" : "Шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.json\").\n По умолчанию содержит одну команду \"vanessa --settings ./tools/vrunner.json\".\n ", "items" : { "type" : "string" } diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index d706d6b..54d57af 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -53,4 +53,6 @@ interface IStepExecutor { def error(String errorMessage) def allure(List results) + + def installLocalDependencies() } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index df33b21..1bc06a0 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -128,4 +128,9 @@ class StepExecutor implements IStepExecutor { results: ResultsConfig.convertPaths(results) ]) } + + @Override + def installLocalDependencies() { + steps.installLocalDependencies() + } } diff --git a/src/ru/pulsar/jenkins/library/configuration/BddOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/BddOptions.groovy new file mode 100644 index 0000000..95e7458 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/configuration/BddOptions.groovy @@ -0,0 +1,26 @@ +package ru.pulsar.jenkins.library.configuration + +import com.cloudbees.groovy.cps.NonCPS +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonPropertyDescription + +@JsonIgnoreProperties(ignoreUnknown = true) +class BddOptions implements Serializable { + + @JsonPropertyDescription("""Шаги, запускаемые через vrunner. + В каждой строке передается отдельная команда + vrunner и ее аргументы (например, "vanessa --settings ./tools/vrunner.json"). + По умолчанию содержит одну команду "vanessa --settings ./tools/vrunner.json". + """) + String[] vrunnerSteps = [ + 'vanessa --settings ./tools/vrunner.json' + ] + + @Override + @NonCPS + String toString() { + return "BddOptions{" + + "vrunnerSteps=" + vrunnerSteps + + '}'; + } +} diff --git a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy index 1e2bcca..1065790 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy @@ -7,6 +7,8 @@ import org.apache.commons.beanutils.BeanUtils import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.ioc.ContextRegistry +import javax.annotation.CheckForNull + class ConfigurationReader implements Serializable { private static ObjectMapper mapper @@ -42,6 +44,7 @@ class ConfigurationReader implements Serializable { "secrets", "stageFlags", "initInfobaseOptions", + "bddOptions", "sonarQubeOptions", "syntaxCheckOptions", "resultsTransformOptions" @@ -49,6 +52,7 @@ class ConfigurationReader implements Serializable { mergeObjects(baseConfiguration, configurationToMerge, nonMergeableSettings) mergeInitInfobaseOptions(baseConfiguration.initInfobaseOptions, configurationToMerge.initInfobaseOptions); + mergeBddOptions(baseConfiguration.bddOptions, configurationToMerge.bddOptions); return baseConfiguration; } @@ -74,7 +78,18 @@ class ConfigurationReader implements Serializable { } @NonCPS - private static void mergeInitInfobaseOptions(InitInfobaseOptions baseObject, InitInfobaseOptions objectToMerge) { + private static void mergeInitInfobaseOptions(InitInfobaseOptions baseObject, @CheckForNull InitInfobaseOptions objectToMerge) { + if (objectToMerge == null || objectToMerge.additionalMigrationSteps == null) { + return + } baseObject.additionalMigrationSteps = objectToMerge.additionalMigrationSteps.clone() } + + @NonCPS + private static void mergeBddOptions(BddOptions baseObject, @CheckForNull BddOptions objectToMerge) { + if (objectToMerge == null || objectToMerge.vrunnerSteps == null) { + return + } + baseObject.vrunnerSteps = objectToMerge.vrunnerSteps.clone() + } } diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index 87e23b3..2ff51f8 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -24,6 +24,10 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Настройки шага инициализации ИБ") InitInfobaseOptions initInfobaseOptions; + @JsonProperty("bddOptions") + @JsonPropertyDescription("Настройки шага запуска BDD сценариев") + BddOptions bddOptions; + @JsonProperty("sonarqube") @JsonPropertyDescription("Настройки анализа SonarQube") SonarQubeOptions sonarQubeOptions; @@ -45,6 +49,7 @@ class JobConfiguration implements Serializable { ", stageFlags=" + stageFlags + ", secrets=" + secrets + ", initInfobaseOptions=" + initInfobaseOptions + + ", bddOptions=" + bddOptions + ", sonarQubeOptions=" + sonarQubeOptions + ", syntaxCheckOptions=" + syntaxCheckOptions + ", resultsTransformOptions=" + resultsTransformOptions + diff --git a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy index 042aab2..2fdcbe7 100644 --- a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy @@ -21,6 +21,9 @@ class StageFlags implements Serializable { @JsonPropertyDescription("Предварительные шаги инициализации включены") boolean initSteps + @JsonPropertyDescription("Запуск BDD сценариев включен") + boolean bdd + @Override @NonCPS String toString() { @@ -30,10 +33,11 @@ class StageFlags implements Serializable { ", edtValidate=" + edtValidate + ", smoke=" + smoke + ", initSteps=" + initSteps + + ", bdd=" + bdd + '}'; } boolean needInfobase() { - return smoke || syntaxCheck || initSteps + return smoke || syntaxCheck || initSteps || bdd } } diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy new file mode 100644 index 0000000..6a1e9cb --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -0,0 +1,46 @@ +package ru.pulsar.jenkins.library.steps + +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.Logger + +class Bdd implements Serializable { + + private final JobConfiguration config; + + Bdd(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + if (!config.stageFlags.bdd) { + Logger.println("BDD step is disabled") + return + } + + steps.installLocalDependencies() + + steps.createDir('build/out') + + // TODO: удалить после выхода VAS 1.0.35 + steps.httpRequest( + 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', + 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' + ) + + steps.catchError { + config.bddOptions.vrunnerSteps.each { + Logger.println("Шаг запуска сценариев командой ${it}") + steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + } + } + + steps.stash('bdd-allure', 'build/out/allure/**', true) + steps.stash('bdd-cucumber', 'build/out/cucumber/**', true) + } +} diff --git a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java index d0be9f1..b547510 100644 --- a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java +++ b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java @@ -46,6 +46,8 @@ class ConfigurationReaderTest { assertThat(jobConfiguration.getInitInfobaseOptions().getRunMigration()).isFalse(); assertThat(jobConfiguration.getInitInfobaseOptions().getAdditionalMigrationSteps()).contains("vanessa --settings ./tools/vrunner.first.json"); + + assertThat(jobConfiguration.getBddOptions().getVrunnerSteps()).contains("vanessa --settings ./tools/vrunner.json"); } } \ No newline at end of file diff --git a/vars/bdd.groovy b/vars/bdd.groovy new file mode 100644 index 0000000..13d045a --- /dev/null +++ b/vars/bdd.groovy @@ -0,0 +1,10 @@ +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.Bdd + +def call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) + + def bdd = new Bdd(config) + bdd.run() +} \ No newline at end of file diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index ae8652e..6ad9808 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -113,6 +113,17 @@ void call() { } } + stage('BDD сценарии') { + when { + beforeAgent true + expression { config.stageFlags.bdd } + } + steps { + // Инициализация и первичная миграция + bdd config + } + } + stage('Синтаксический контроль') { agent { label agent1C From 1dbf4dce47d1b61edb50133759166160f742825f Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 14:20:38 +0300 Subject: [PATCH 19/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D1=87=D0=B0=20=D0=B2=20=D0=B0=D0=BB=D0=BB=D1=8E=D1=80=20=D0=BE?= =?UTF-8?q?=D1=82=D0=BD=D0=BE=D1=81=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=BF=D1=83=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy | 4 ++-- src/ru/pulsar/jenkins/library/utils/FileUtils.groovy | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index 09d7569..36f1237 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -36,10 +36,10 @@ class PublishAllure implements Serializable { Logger.println(allurePath.listDirectories().toString()) allurePath.listDirectories().each { FilePath filePath -> - results.add(filePath.getRemote()) + results.add(FileUtils.getLocalPath(filePath)) } if (results.isEmpty()) { - results.add(allurePath.getRemote()) + results.add(FileUtils.getLocalPath(allurePath)) } Logger.println(results.toString()) diff --git a/src/ru/pulsar/jenkins/library/utils/FileUtils.groovy b/src/ru/pulsar/jenkins/library/utils/FileUtils.groovy index eadf463..43d475b 100644 --- a/src/ru/pulsar/jenkins/library/utils/FileUtils.groovy +++ b/src/ru/pulsar/jenkins/library/utils/FileUtils.groovy @@ -24,4 +24,12 @@ class FileUtils { return new FilePath(Jenkins.getInstanceOrNull().getComputer(nodeName).getChannel(), path); } } + + static String getLocalPath(FilePath filePath) { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + def env = steps.env(); + + return filePath.getRemote().replaceAll("^$env.WORKSPACE/", "").toString() + } } From 316decba7c46f925dd25c89c1acb324ab962f32a Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 14:52:13 +0300 Subject: [PATCH 20/99] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/StepExecutor.groovy | 2 -- src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy | 5 ----- 2 files changed, 7 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 1bc06a0..facf839 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,7 +1,6 @@ package ru.pulsar.jenkins.library import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction -import ru.pulsar.jenkins.library.utils.Logger import ru.yandex.qatools.allure.jenkins.config.ResultsConfig class StepExecutor implements IStepExecutor { @@ -118,7 +117,6 @@ class StepExecutor implements IStepExecutor { @Override def allure(List results) { - Logger.println(ResultsConfig.convertPaths(results)) steps.allure([ commandline: 'allure', includeProperties: false, diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index 36f1237..c1c00cb 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -32,9 +32,6 @@ class PublishAllure implements Serializable { List results = new ArrayList<>(); - Logger.println(allurePath.toString()) - Logger.println(allurePath.listDirectories().toString()) - allurePath.listDirectories().each { FilePath filePath -> results.add(FileUtils.getLocalPath(filePath)) } @@ -42,8 +39,6 @@ class PublishAllure implements Serializable { results.add(FileUtils.getLocalPath(allurePath)) } - Logger.println(results.toString()) - steps.allure(results) } From a8e02a0886ebe13a2aca8cf376d5639da4475cb5 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 16:12:45 +0300 Subject: [PATCH 21/99] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=81=D0=B5=D0=BA=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B0=D0=B3=D0=B5=D0=BD=D1=82=D0=B0=20=D0=B2=20=D0=B1=D0=B4?= =?UTF-8?q?=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 6ad9808..8cdc1a9 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -114,6 +114,9 @@ void call() { } stage('BDD сценарии') { + agent { + label agent1C + } when { beforeAgent true expression { config.stageFlags.bdd } From d6f505c2e6830ee2988064084d61f80c4de99c55 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 16:34:56 +0300 Subject: [PATCH 22/99] =?UTF-8?q?=D0=91=D0=B5=D0=B7=D0=BE=D0=BF=D0=B0?= =?UTF-8?q?=D1=81=D0=BD=D1=8B=D0=B9=20unstash=20=D1=80=D0=B5=D0=B7=D1=83?= =?UTF-8?q?=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/steps/PublishAllure.groovy | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy index c1c00cb..2c6360d 100644 --- a/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy +++ b/src/ru/pulsar/jenkins/library/steps/PublishAllure.groovy @@ -10,17 +10,19 @@ import ru.pulsar.jenkins.library.utils.Logger class PublishAllure implements Serializable { private final JobConfiguration config; + private IStepExecutor steps; PublishAllure(JobConfiguration config) { this.config = config } def run() { - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + steps = ContextRegistry.getContext().getStepExecutor() Logger.printLocation() - steps.unstash('init-allure') + safeUnstash('init-allure') + safeUnstash('bdd-allure') def env = steps.env(); @@ -42,4 +44,11 @@ class PublishAllure implements Serializable { steps.allure(results) } + private void safeUnstash(String stashName) { + try { + steps.unstash(stashName) + } catch (Exception ex) { + Logger.println("Can't unstash $stashName") + } + } } From b471342028f3036c36a5db422d03da2f83677b9e Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 17:43:39 +0300 Subject: [PATCH 23/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=20=D1=81=D0=B2=D0=BE=D0=B9=D1=81=D1=82=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 2 +- resources/schema.json | 2 +- .../jenkins/library/configuration/JobConfiguration.groovy | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index 25b5e5a..d7bd1ae 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -17,7 +17,7 @@ "runMigration": true, "additionalMigrationSteps": [] }, - "bddOptions": { + "bdd": { "vrunnerSteps": [ "vanessa --settings ./tools/vrunner.json" ] diff --git a/resources/schema.json b/resources/schema.json index 75512e8..2e05d48 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -74,7 +74,7 @@ } } }, - "bddOptions" : { + "bdd" : { "type" : "object", "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:BddOptions", "description" : "Настройки шага запуска BDD сценариев", diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index 2ff51f8..352308f 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -24,7 +24,7 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Настройки шага инициализации ИБ") InitInfobaseOptions initInfobaseOptions; - @JsonProperty("bddOptions") + @JsonProperty("bdd") @JsonPropertyDescription("Настройки шага запуска BDD сценариев") BddOptions bddOptions; From 1dde97a0dc45454a6362806499e9b69839bf0ad0 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 18:07:33 +0300 Subject: [PATCH 24/99] =?UTF-8?q?=D0=92=D1=80=D0=B5=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=B0=D1=8F=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BE=D1=87=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=BB=D0=BE=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 8cdc1a9..879d48e 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -117,6 +117,9 @@ void call() { agent { label agent1C } + environment { + LOGOS_LEVEL = 'DEBUG' + } when { beforeAgent true expression { config.stageFlags.bdd } From 89acdc563a55e5cea3d873786efe8f67d2311417 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 21 Oct 2020 18:43:08 +0300 Subject: [PATCH 25/99] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D0=B0=D1=80=D1=85?= =?UTF-8?q?=D0=B8=D0=B2=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=98=D0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 879d48e..5f46749 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -125,7 +125,9 @@ void call() { expression { config.stageFlags.bdd } } steps { - // Инициализация и первичная миграция + + unzipInfobase() + bdd config } } From ff07c6431410ccccf566351e0cc7f8393062ad4e Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 26 Oct 2020 17:54:59 +0300 Subject: [PATCH 26/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=BE=D0=B2=20git=20?= =?UTF-8?q?lfs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 1 + resources/globalConfiguration.json | 7 +- resources/schema.json | 18 +++++ .../jenkins/library/IStepExecutor.groovy | 6 ++ .../jenkins/library/StepExecutor.groovy | 12 ++++ .../configuration/ConfigurationReader.groovy | 3 +- .../configuration/GitSCMOptions.groovy | 23 +++++++ .../configuration/JobConfiguration.groovy | 5 ++ .../library/configuration/Secrets.groovy | 4 ++ .../jenkins/library/steps/EdtTransform.groovy | 66 +++++++++++++++++++ .../library/steps/GitSCMExtension.groovy | 16 +++++ 11 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy create mode 100644 src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy diff --git a/build.gradle.kts b/build.gradle.kts index 7af7246..643a9db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -78,6 +78,7 @@ sharedLibrary { // TODO: retrieve downloaded plugin resource pluginDependencies { dependency("org.jenkins-ci.plugins", "pipeline-build-step", "2.12") + dependency("org.jenkins-ci.plugins", "git", "4.4.4") dependency("org.6wind.jenkins", "lockable-resources", "2.7") dependency("ru.yandex.qatools.allure", "allure-jenkins-plugin", "2.28.1") val declarativePluginsVersion = "1.6.0" diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index d7bd1ae..8841a10 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -3,7 +3,8 @@ "srcDir": "src/cf", "secrets": { "storagePath": "UNKNOWN_ID", - "storage": "UNKNOWN_ID" + "storage": "UNKNOWN_ID", + "lfs": "UNKNOWN_ID" }, "stages": { "initSteps": false, @@ -47,5 +48,9 @@ "resultsTransform": { "removeSupport": false, "supportLevel": 0 + }, + "git": { + "lfsPull": false, + "lfsURI": "" } } diff --git a/resources/schema.json b/resources/schema.json index 2e05d48..8534a7e 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -22,6 +22,10 @@ "storage" : { "type" : "string", "description" : "Данные авторизации в хранилище конфигурации" + }, + "lfs" : { + "type" : "string", + "description" : "Данные авторизации для работы с LFS" } } }, @@ -143,6 +147,20 @@ "description" : "Настройка фильтрации замечаний по уровню поддержки.\n 0 - удалить файлы на замке;\n 1 - удалить файлы на замке и на поддержке;\n 2 - удалить файлы на замке, на поддержке и снятые с поддержки.\n " } } + }, + "git" : { + "type" : "object", + "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:GitSCMOptions", + "description" : "Настройки git-репозитория", + "properties" : { + "lfsPull" : { + "type" : "boolean", + "description" : "Дополнительно выполнить git lfs pull" + }, + "lfsURI" : { + "type" : "string" + } + } } } } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index 54d57af..5d9d8a8 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -1,5 +1,7 @@ package ru.pulsar.jenkins.library +import hudson.plugins.git.GitSCM +import hudson.scm.SCM import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction interface IStepExecutor { @@ -26,6 +28,10 @@ interface IStepExecutor { EnvironmentAction env() + GitSCM scm() + + void checkout(SCM scm) + void createDir(String path) def withEnv(List strings, Closure body) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index facf839..c297dfa 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,5 +1,7 @@ package ru.pulsar.jenkins.library +import hudson.plugins.git.GitSCM +import hudson.scm.SCM import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction import ru.yandex.qatools.allure.jenkins.config.ResultsConfig @@ -63,6 +65,16 @@ class StepExecutor implements IStepExecutor { return steps.env } + @Override + GitSCM scm() { + return steps.scm + } + + @Override + void checkout(SCM scm) { + steps.checkout(scm) + } + @Override void createDir(String path) { steps.createDir(path) diff --git a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy index 1065790..8388096 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy @@ -47,7 +47,8 @@ class ConfigurationReader implements Serializable { "bddOptions", "sonarQubeOptions", "syntaxCheckOptions", - "resultsTransformOptions" + "resultsTransformOptions", + "gitSCMOptions" ).toSet() mergeObjects(baseConfiguration, configurationToMerge, nonMergeableSettings) diff --git a/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy new file mode 100644 index 0000000..e47a71e --- /dev/null +++ b/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy @@ -0,0 +1,23 @@ +package ru.pulsar.jenkins.library.configuration + +import com.cloudbees.groovy.cps.NonCPS +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonPropertyDescription + +@JsonIgnoreProperties(ignoreUnknown = true) +class GitSCMOptions implements Serializable { + + @JsonPropertyDescription("Дополнительно выполнить git lfs pull") + boolean lfsPull + + String lfsURI = "" + + @Override + @NonCPS + String toString() { + return "GitSCMOptions{" + + "lfsPull=" + lfsPull + + "lfsURI=" + lfsURI + + '}'; + } +} diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index 352308f..babde5a 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -40,6 +40,10 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Настройки трансформации результатов анализа") ResultsTransformOptions resultsTransformOptions; + @JsonProperty("git") + @JsonPropertyDescription("Настройки git-репозитория") + GitSCMOptions gitSCMOptions; + @Override @NonCPS String toString() { @@ -53,6 +57,7 @@ class JobConfiguration implements Serializable { ", sonarQubeOptions=" + sonarQubeOptions + ", syntaxCheckOptions=" + syntaxCheckOptions + ", resultsTransformOptions=" + resultsTransformOptions + + ", gitSCMOptions=" + gitSCMOptions + '}'; } } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy b/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy index 0ee17f0..b27d418 100644 --- a/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy @@ -13,12 +13,16 @@ class Secrets implements Serializable { @JsonPropertyDescription("Данные авторизации в хранилище конфигурации") String storage + @JsonPropertyDescription("Данные авторизации для работы с LFS") + String lfs + @Override @NonCPS String toString() { return "Secrets{" + "storagePath='" + storagePath + '\'' + ", storage='" + storage + '\'' + + ", lfs='" + lfs + '\'' + '}'; } } diff --git a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy index 4b2a065..c8e8102 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy @@ -1,5 +1,9 @@ package ru.pulsar.jenkins.library.steps + +import hudson.plugins.git.GitSCM +import hudson.plugins.git.UserRemoteConfig +import hudson.plugins.git.extensions.impl.GitLFSPull import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry @@ -28,6 +32,8 @@ class EdtTransform implements Serializable { return } + doSCM() + def env = steps.env(); def workspaceDir = "$env.WORKSPACE/$WORKSPACE" @@ -47,4 +53,64 @@ class EdtTransform implements Serializable { steps.zip(WORKSPACE, WORKSPACE_ZIP) steps.stash(WORKSPACE_ZIP_STASH, WORKSPACE_ZIP) } + + private void doSCM() { + + def gitSCMOptions = config.gitSCMOptions + + if (!gitSCMOptions.lfsPull) { + return + } + + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + def scm = steps.scm() + + boolean needToCheckout = false + needToCheckout = addLFS(scm, needToCheckout) + scm = addLFSRemoteConfig(scm) + + if (needToCheckout) { + steps.checkout(scm) + } + } + + private boolean addLFS(GitSCM scm, boolean needToCheckout) { + GitLFSPull gitLFS = new GitLFSPull(); + def extensions = scm.getExtensions() + if (!extensions.contains(gitLFS)) { + needToCheckout = true + extensions.add(gitLFS) + } + needToCheckout + } + + private GitSCM addLFSRemoteConfig(GitSCM scm) { + def gitSCMOptions = config.gitSCMOptions + + if (gitSCMOptions.lfsURI.isEmpty()) { + return scm + } + + List userRemoteConfigs = new ArrayList<>(scm.getUserRemoteConfigs()) + + def userRemoteConfig = userRemoteConfigs.find { it.url == gitSCMOptions.lfsURI } + if (userRemoteConfig == null) { + def credentialsId = config.secrets.lfs.isEmpty() ? null : config.secrets.lfs + userRemoteConfig = new UserRemoteConfig(config.gitSCMOptions.lfsURI, null, null, credentialsId) + userRemoteConfigs.add(0, userRemoteConfig) + + scm = new GitSCM( + userRemoteConfigs, + scm.branches, + scm.doGenerateSubmoduleConfigurations, + scm.submoduleCfg, + scm.browser, + scm.gitTool, + scm.extensions + ) + } + + return scm + } } diff --git a/src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy b/src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy new file mode 100644 index 0000000..af387cc --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy @@ -0,0 +1,16 @@ +package ru.pulsar.jenkins.library.steps + +import ru.pulsar.jenkins.library.configuration.JobConfiguration + +class GitSCMExtension implements Serializable { + + private final JobConfiguration config; + + GitSCMExtension(JobConfiguration config) { + this.config = config + } + + def run() { + + } +} From 82c5147177236ac51b740cb43c0e2a69f9aa5cc3 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 29 Oct 2020 14:01:48 +0300 Subject: [PATCH 27/99] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3?= =?UTF-8?q?=D1=83=D1=80=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20lfs?= =?UTF-8?q?Uri=20=D0=B8=20lfsRepoUri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 3 +- resources/schema.json | 7 +++- .../configuration/GitSCMOptions.groovy | 5 +++ .../jenkins/library/steps/EdtTransform.groovy | 34 +++++++++++++++++-- 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index 8841a10..0d5a3b9 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -51,6 +51,7 @@ }, "git": { "lfsPull": false, - "lfsURI": "" + "lfsURI": "", + "lfsRepoURI": "" } } diff --git a/resources/schema.json b/resources/schema.json index 8534a7e..46022fd 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -158,7 +158,12 @@ "description" : "Дополнительно выполнить git lfs pull" }, "lfsURI" : { - "type" : "string" + "type" : "string", + "description" : "Адрес для получения данных LFS" + }, + "lfsRepoURI" : { + "type" : "string", + "description" : "Адрес удаленного репозитория для авторизации на LFS" } } } diff --git a/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy index e47a71e..9b98d15 100644 --- a/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy @@ -10,14 +10,19 @@ class GitSCMOptions implements Serializable { @JsonPropertyDescription("Дополнительно выполнить git lfs pull") boolean lfsPull + @JsonPropertyDescription("Адрес для получения данных LFS") String lfsURI = "" + @JsonPropertyDescription("Адрес удаленного репозитория для авторизации на LFS") + String lfsRepoURI = "" + @Override @NonCPS String toString() { return "GitSCMOptions{" + "lfsPull=" + lfsPull + "lfsURI=" + lfsURI + + "lfsRepoURI=" + lfsRepoURI + '}'; } } diff --git a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy index c8e8102..739d57d 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy @@ -92,14 +92,42 @@ class EdtTransform implements Serializable { return scm } + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + // TODO: get git.exe path from scm settings + steps.cmd("git config -f .lfsconfig lfs.url $gitSCMOptions.lfsURI") + List userRemoteConfigs = new ArrayList<>(scm.getUserRemoteConfigs()) - def userRemoteConfig = userRemoteConfigs.find { it.url == gitSCMOptions.lfsURI } + def userRemoteConfig = userRemoteConfigs.find { it.url == gitSCMOptions.lfsRepoURI } + boolean needToUpdateUserRemoteConfigs if (userRemoteConfig == null) { def credentialsId = config.secrets.lfs.isEmpty() ? null : config.secrets.lfs - userRemoteConfig = new UserRemoteConfig(config.gitSCMOptions.lfsURI, null, null, credentialsId) - userRemoteConfigs.add(0, userRemoteConfig) + userRemoteConfig = new UserRemoteConfig( + config.gitSCMOptions.lfsRepoURI, + null, + null, + credentialsId + ) + needToUpdateUserRemoteConfigs = true + } else { + def credentialsId = config.secrets.lfs.isEmpty() ? userRemoteConfig.credentialsId : config.secrets.lfs + + if (userRemoteConfig.credentialsId != credentialsId) { + userRemoteConfig = new UserRemoteConfig( + userRemoteConfig.url, + null, + userRemoteConfig.refspec, + credentialsId + ) + + needToUpdateUserRemoteConfigs = true + } + } + + if (needToUpdateUserRemoteConfigs) { + userRemoteConfigs.add(0, userRemoteConfig) scm = new GitSCM( userRemoteConfigs, scm.branches, From e5537b7eeb47b5ca1e0cf2e2df08155f45add7ef Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 30 Oct 2020 09:48:24 +0300 Subject: [PATCH 28/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B4=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=83=D0=BB=D0=B8=D0=BD=D0=B3=D0=B0=20=D1=82=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=BA=D0=BE=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=20lfsRepoUri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy index 739d57d..3ff8e48 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy @@ -99,6 +99,10 @@ class EdtTransform implements Serializable { List userRemoteConfigs = new ArrayList<>(scm.getUserRemoteConfigs()) + if (gitSCMOptions.lfsRepoURI.isEmpty()) { + return scm + } + def userRemoteConfig = userRemoteConfigs.find { it.url == gitSCMOptions.lfsRepoURI } boolean needToUpdateUserRemoteConfigs if (userRemoteConfig == null) { From 4f6c09cf532f711fd754c73a3760d73dc2ab5eda Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 30 Oct 2020 10:01:15 +0300 Subject: [PATCH 29/99] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BE=D1=87=D0=BD=D0=BE=D0=B5=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 3 --- 1 file changed, 3 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 5f46749..d7a8037 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -117,9 +117,6 @@ void call() { agent { label agent1C } - environment { - LOGOS_LEVEL = 'DEBUG' - } when { beforeAgent true expression { config.stageFlags.bdd } From fd83b770b5c32b4cc1598593eee36a8be0745c80 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 30 Oct 2020 16:37:12 +0300 Subject: [PATCH 30/99] =?UTF-8?q?=D0=92=D1=8B=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20LFS=20=D0=BF=D0=BE=20=D1=83=D0=BC?= =?UTF-8?q?=D0=BE=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index d7a8037..5b38171 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -21,6 +21,10 @@ void call() { timestamps() } + environment { + GIT_LFS_SKIP_SMUDGE = '1' + } + stages { stage('pre-stage') { From 156f1dc727cd13fc24e9a76a042b30c493b0fef3 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 30 Oct 2020 17:02:16 +0300 Subject: [PATCH 31/99] =?UTF-8?q?=D0=9E=D1=82=D0=BB=D0=BE=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D0=B0=D1=8F=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 5b38171..4dbf8c6 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -19,10 +19,7 @@ void call() { buildDiscarder(logRotator(numToKeepStr: '30')) timeout(time: 2, unit: TimeUnit.HOURS) timestamps() - } - - environment { - GIT_LFS_SKIP_SMUDGE = '1' + skipDefaultCheckout(true) } stages { @@ -31,7 +28,14 @@ void call() { agent { label 'agent' } + + environment { + GIT_LFS_SKIP_SMUDGE=1 + } + steps { + echo "test" + checkout scm script { config = jobConfiguration() as JobConfiguration agent1C = config.v8version @@ -55,6 +59,8 @@ void call() { steps { printLocation() + checkout scm + installLocalDependencies() createDir('build/out') @@ -96,6 +102,7 @@ void call() { expression { config.stageFlags.edtValidate } } steps { + checkout scm edtTransform config } } @@ -113,6 +120,7 @@ void call() { expression { config.stageFlags.edtValidate } } steps { + checkout scm edtValidate config } } @@ -126,7 +134,7 @@ void call() { expression { config.stageFlags.bdd } } steps { - + checkout scm unzipInfobase() bdd config @@ -142,6 +150,7 @@ void call() { expression { config.stageFlags.syntaxCheck } } steps { + checkout scm syntaxCheck config } } @@ -155,6 +164,7 @@ void call() { expression { config.stageFlags.smoke } } steps { + checkout scm smoke config } } @@ -170,6 +180,7 @@ void call() { expression { config.stageFlags.edtValidate } } steps { + checkout scm transform config } } @@ -183,6 +194,7 @@ void call() { expression { config.stageFlags.sonarqube } } steps { + checkout scm sonarScanner config } } From c1083777a114f9c1fc206722fed5016f8e2d4141 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 3 Nov 2020 11:50:41 +0300 Subject: [PATCH 32/99] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=BE=D1=81=20scm-?= =?UTF-8?q?=D1=88=D0=B0=D0=B3=D0=B0=20=D0=B2=20=D0=BE=D1=82=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/steps/Checkout.groovy | 97 +++++++++++++++++++ .../jenkins/library/steps/EdtTransform.groovy | 94 ------------------ vars/customCheckout.groovy | 10 ++ vars/pipeline1C.groovy | 21 ++-- 4 files changed, 119 insertions(+), 103 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/steps/Checkout.groovy create mode 100644 vars/customCheckout.groovy diff --git a/src/ru/pulsar/jenkins/library/steps/Checkout.groovy b/src/ru/pulsar/jenkins/library/steps/Checkout.groovy new file mode 100644 index 0000000..8414b4f --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/Checkout.groovy @@ -0,0 +1,97 @@ +package ru.pulsar.jenkins.library.steps + +import hudson.plugins.git.GitSCM +import hudson.plugins.git.UserRemoteConfig +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.Logger + +class Checkout implements Serializable { + + private final JobConfiguration config; + + Checkout(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + def gitSCMOptions = config.gitSCMOptions + + if (!gitSCMOptions.lfsPull) { + return + } + + def scm = steps.scm() + + scm = addLFSRemoteConfig(scm) + + steps.checkout(scm) + + } + + private GitSCM addLFSRemoteConfig(GitSCM scm) { + def gitSCMOptions = config.gitSCMOptions + + if (gitSCMOptions.lfsURI.isEmpty()) { + return scm + } + + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + // TODO: get git.exe path from scm settings + steps.cmd("git config -f .lfsconfig lfs.url $gitSCMOptions.lfsURI") + + List userRemoteConfigs = new ArrayList<>(scm.getUserRemoteConfigs()) + + if (gitSCMOptions.lfsRepoURI.isEmpty()) { + return scm + } + + def userRemoteConfig = userRemoteConfigs.find { it.url == gitSCMOptions.lfsRepoURI } + boolean needToUpdateUserRemoteConfigs + if (userRemoteConfig == null) { + def credentialsId = config.secrets.lfs.isEmpty() ? null : config.secrets.lfs + userRemoteConfig = new UserRemoteConfig( + config.gitSCMOptions.lfsRepoURI, + null, + null, + credentialsId + ) + + needToUpdateUserRemoteConfigs = true + } else { + def credentialsId = config.secrets.lfs.isEmpty() ? userRemoteConfig.credentialsId : config.secrets.lfs + + if (userRemoteConfig.credentialsId != credentialsId) { + userRemoteConfig = new UserRemoteConfig( + userRemoteConfig.url, + null, + userRemoteConfig.refspec, + credentialsId + ) + + needToUpdateUserRemoteConfigs = true + } + } + + if (needToUpdateUserRemoteConfigs) { + userRemoteConfigs.add(0, userRemoteConfig) + scm = new GitSCM( + userRemoteConfigs, + scm.branches, + scm.doGenerateSubmoduleConfigurations, + scm.submoduleCfg, + scm.browser, + scm.gitTool, + scm.extensions + ) + } + + return scm + } +} diff --git a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy index 3ff8e48..837108d 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy @@ -1,9 +1,6 @@ package ru.pulsar.jenkins.library.steps -import hudson.plugins.git.GitSCM -import hudson.plugins.git.UserRemoteConfig -import hudson.plugins.git.extensions.impl.GitLFSPull import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry @@ -54,95 +51,4 @@ class EdtTransform implements Serializable { steps.stash(WORKSPACE_ZIP_STASH, WORKSPACE_ZIP) } - private void doSCM() { - - def gitSCMOptions = config.gitSCMOptions - - if (!gitSCMOptions.lfsPull) { - return - } - - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - - def scm = steps.scm() - - boolean needToCheckout = false - needToCheckout = addLFS(scm, needToCheckout) - scm = addLFSRemoteConfig(scm) - - if (needToCheckout) { - steps.checkout(scm) - } - } - - private boolean addLFS(GitSCM scm, boolean needToCheckout) { - GitLFSPull gitLFS = new GitLFSPull(); - def extensions = scm.getExtensions() - if (!extensions.contains(gitLFS)) { - needToCheckout = true - extensions.add(gitLFS) - } - needToCheckout - } - - private GitSCM addLFSRemoteConfig(GitSCM scm) { - def gitSCMOptions = config.gitSCMOptions - - if (gitSCMOptions.lfsURI.isEmpty()) { - return scm - } - - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - - // TODO: get git.exe path from scm settings - steps.cmd("git config -f .lfsconfig lfs.url $gitSCMOptions.lfsURI") - - List userRemoteConfigs = new ArrayList<>(scm.getUserRemoteConfigs()) - - if (gitSCMOptions.lfsRepoURI.isEmpty()) { - return scm - } - - def userRemoteConfig = userRemoteConfigs.find { it.url == gitSCMOptions.lfsRepoURI } - boolean needToUpdateUserRemoteConfigs - if (userRemoteConfig == null) { - def credentialsId = config.secrets.lfs.isEmpty() ? null : config.secrets.lfs - userRemoteConfig = new UserRemoteConfig( - config.gitSCMOptions.lfsRepoURI, - null, - null, - credentialsId - ) - - needToUpdateUserRemoteConfigs = true - } else { - def credentialsId = config.secrets.lfs.isEmpty() ? userRemoteConfig.credentialsId : config.secrets.lfs - - if (userRemoteConfig.credentialsId != credentialsId) { - userRemoteConfig = new UserRemoteConfig( - userRemoteConfig.url, - null, - userRemoteConfig.refspec, - credentialsId - ) - - needToUpdateUserRemoteConfigs = true - } - } - - if (needToUpdateUserRemoteConfigs) { - userRemoteConfigs.add(0, userRemoteConfig) - scm = new GitSCM( - userRemoteConfigs, - scm.branches, - scm.doGenerateSubmoduleConfigurations, - scm.submoduleCfg, - scm.browser, - scm.gitTool, - scm.extensions - ) - } - - return scm - } } diff --git a/vars/customCheckout.groovy b/vars/customCheckout.groovy new file mode 100644 index 0000000..2056db9 --- /dev/null +++ b/vars/customCheckout.groovy @@ -0,0 +1,10 @@ +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.Checkout + +void call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) + + def checkout = new Checkout(config) + checkout.run() +} \ No newline at end of file diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 4dbf8c6..cebaec1 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -29,13 +29,16 @@ void call() { label 'agent' } + options { + skipDefaultCheckout(false) + } + environment { GIT_LFS_SKIP_SMUDGE=1 } steps { echo "test" - checkout scm script { config = jobConfiguration() as JobConfiguration agent1C = config.v8version @@ -59,7 +62,7 @@ void call() { steps { printLocation() - checkout scm + customCheckout config installLocalDependencies() @@ -102,7 +105,7 @@ void call() { expression { config.stageFlags.edtValidate } } steps { - checkout scm + customCheckout config edtTransform config } } @@ -120,7 +123,7 @@ void call() { expression { config.stageFlags.edtValidate } } steps { - checkout scm + customCheckout config edtValidate config } } @@ -134,7 +137,7 @@ void call() { expression { config.stageFlags.bdd } } steps { - checkout scm + customCheckout config unzipInfobase() bdd config @@ -150,7 +153,7 @@ void call() { expression { config.stageFlags.syntaxCheck } } steps { - checkout scm + customCheckout config syntaxCheck config } } @@ -164,7 +167,7 @@ void call() { expression { config.stageFlags.smoke } } steps { - checkout scm + customCheckout config smoke config } } @@ -180,7 +183,7 @@ void call() { expression { config.stageFlags.edtValidate } } steps { - checkout scm + customCheckout config transform config } } @@ -194,7 +197,7 @@ void call() { expression { config.stageFlags.sonarqube } } steps { - checkout scm + customCheckout config sonarScanner config } } From 33dafb1297aab64130321bb35518607f0992c138 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 3 Nov 2020 11:53:01 +0300 Subject: [PATCH 33/99] =?UTF-8?q?=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index cebaec1..79a224f 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -30,7 +30,7 @@ void call() { } options { - skipDefaultCheckout(false) + skipDefaultCheckout(true) } environment { @@ -39,6 +39,8 @@ void call() { steps { echo "test" + cmd "env" + checkout scm script { config = jobConfiguration() as JobConfiguration agent1C = config.v8version From 92e886c58ea14d95c0d7b522217e33301499aa06 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 10 Nov 2020 10:23:50 +0300 Subject: [PATCH 34/99] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=B0=D1=82=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20scm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/steps/EdtTransform.groovy | 2 -- vars/pipeline1C.groovy | 21 ------------------- 2 files changed, 23 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy index 837108d..68e53e6 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy @@ -29,8 +29,6 @@ class EdtTransform implements Serializable { return } - doSCM() - def env = steps.env(); def workspaceDir = "$env.WORKSPACE/$WORKSPACE" diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 79a224f..04ee349 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -19,7 +19,6 @@ void call() { buildDiscarder(logRotator(numToKeepStr: '30')) timeout(time: 2, unit: TimeUnit.HOURS) timestamps() - skipDefaultCheckout(true) } stages { @@ -29,18 +28,7 @@ void call() { label 'agent' } - options { - skipDefaultCheckout(true) - } - - environment { - GIT_LFS_SKIP_SMUDGE=1 - } - steps { - echo "test" - cmd "env" - checkout scm script { config = jobConfiguration() as JobConfiguration agent1C = config.v8version @@ -64,8 +52,6 @@ void call() { steps { printLocation() - customCheckout config - installLocalDependencies() createDir('build/out') @@ -107,7 +93,6 @@ void call() { expression { config.stageFlags.edtValidate } } steps { - customCheckout config edtTransform config } } @@ -125,7 +110,6 @@ void call() { expression { config.stageFlags.edtValidate } } steps { - customCheckout config edtValidate config } } @@ -139,7 +123,6 @@ void call() { expression { config.stageFlags.bdd } } steps { - customCheckout config unzipInfobase() bdd config @@ -155,7 +138,6 @@ void call() { expression { config.stageFlags.syntaxCheck } } steps { - customCheckout config syntaxCheck config } } @@ -169,7 +151,6 @@ void call() { expression { config.stageFlags.smoke } } steps { - customCheckout config smoke config } } @@ -185,7 +166,6 @@ void call() { expression { config.stageFlags.edtValidate } } steps { - customCheckout config transform config } } @@ -199,7 +179,6 @@ void call() { expression { config.stageFlags.sonarqube } } steps { - customCheckout config sonarScanner config } } From db501918420c921a44774967c0a36e6cfc138224 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 31 May 2021 17:35:32 +0300 Subject: [PATCH 35/99] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=84=D0=B8=D0=BA=D1=81=D0=B0=20VAS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/Bdd.groovy | 6 ------ src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy index 6a1e9cb..29be444 100644 --- a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -27,12 +27,6 @@ class Bdd implements Serializable { steps.createDir('build/out') - // TODO: удалить после выхода VAS 1.0.35 - steps.httpRequest( - 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', - 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' - ) - steps.catchError { config.bddOptions.vrunnerSteps.each { Logger.println("Шаг запуска сценариев командой ${it}") diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index deb5ec7..65ffe18 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -36,12 +36,6 @@ class InitInfobase implements Serializable { Logger.println("Шаг миграции ИБ выключен") } - // TODO: удалить после выхода VAS 1.0.35 - steps.httpRequest( - 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', - 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' - ) - steps.catchError { config.initInfobaseOptions.additionalMigrationSteps.each { Logger.println("Первичная инициализация командой ${it}") From 6def56e2d9704f6fcc159869557602bb25b2611d Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 31 May 2021 17:35:32 +0300 Subject: [PATCH 36/99] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=B2?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20VAS=20=D1=81?= =?UTF-8?q?=20=D1=82=D0=B8=D1=85=D0=BE=D0=B9=20=D1=83=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BA=D0=BE=D0=B9=20Vanessa-Ext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/Bdd.groovy | 6 ++++++ src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy index 29be444..6a1e9cb 100644 --- a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -27,6 +27,12 @@ class Bdd implements Serializable { steps.createDir('build/out') + // TODO: удалить после выхода VAS 1.0.35 + steps.httpRequest( + 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', + 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' + ) + steps.catchError { config.bddOptions.vrunnerSteps.each { Logger.println("Шаг запуска сценариев командой ${it}") diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 65ffe18..deb5ec7 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -36,6 +36,12 @@ class InitInfobase implements Serializable { Logger.println("Шаг миграции ИБ выключен") } + // TODO: удалить после выхода VAS 1.0.35 + steps.httpRequest( + 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', + 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' + ) + steps.catchError { config.initInfobaseOptions.additionalMigrationSteps.each { Logger.println("Первичная инициализация командой ${it}") From e11fa81b7ba4d63ae4c31adcc20111052fcf05f3 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 2 Jun 2021 13:00:19 +0300 Subject: [PATCH 37/99] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8?= =?UTF-8?q?=D0=B3=D1=83=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20logos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 3 +- resources/schema.json | 4 +++ src/JobConfigurationSchemaGenerator.java | 2 +- .../configuration/JobConfiguration.groovy | 5 +++ .../pulsar/jenkins/library/steps/Bdd.groovy | 25 ++++++++------ .../jenkins/library/steps/InitInfobase.groovy | 34 +++++++++++-------- .../ConfigurationReaderTest.java | 2 ++ test/unit/resources/jobConfiguration.json | 3 +- 8 files changed, 49 insertions(+), 29 deletions(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index 0d5a3b9..b25868f 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -53,5 +53,6 @@ "lfsPull": false, "lfsURI": "", "lfsRepoURI": "" - } + }, + "logosConfig": "" } diff --git a/resources/schema.json b/resources/schema.json index 46022fd..e964184 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -166,6 +166,10 @@ "description" : "Адрес удаленного репозитория для авторизации на LFS" } } + }, + "logosConfig" : { + "type" : "string", + "description" : "Конфигурация библиотеки logos. Применяется перед запуском каждой стадии сборки" } } } \ No newline at end of file diff --git a/src/JobConfigurationSchemaGenerator.java b/src/JobConfigurationSchemaGenerator.java index 68fe569..0a542b0 100644 --- a/src/JobConfigurationSchemaGenerator.java +++ b/src/JobConfigurationSchemaGenerator.java @@ -21,7 +21,7 @@ public class JobConfigurationSchemaGenerator { File jsonSchemaFile = new File("./resources/schema.json"); mapper.writeValue(jsonSchemaFile, jsonSchema); - System.out.println(json.toString()); + System.out.println(json); } } diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index babde5a..fbb3e93 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -44,6 +44,10 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Настройки git-репозитория") GitSCMOptions gitSCMOptions; + @JsonProperty("logosConfig") + @JsonPropertyDescription("Конфигурация библиотеки logos. Применяется перед запуском каждой стадии сборки") + String logosConfig; + @Override @NonCPS String toString() { @@ -58,6 +62,7 @@ class JobConfiguration implements Serializable { ", syntaxCheckOptions=" + syntaxCheckOptions + ", resultsTransformOptions=" + resultsTransformOptions + ", gitSCMOptions=" + gitSCMOptions + + ", logosConfig=" + logosConfig + '}'; } } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy index 6a1e9cb..ebb8629 100644 --- a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -23,20 +23,23 @@ class Bdd implements Serializable { return } - steps.installLocalDependencies() + List logosConfig = ["LOGOS_CONFIG=$config.logosConfig"] + steps.withEnv(logosConfig) { + steps.installLocalDependencies() - steps.createDir('build/out') + steps.createDir('build/out') - // TODO: удалить после выхода VAS 1.0.35 - steps.httpRequest( - 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', - 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' - ) + // TODO: удалить после выхода VAS 1.0.35 + steps.httpRequest( + 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', + 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' + ) - steps.catchError { - config.bddOptions.vrunnerSteps.each { - Logger.println("Шаг запуска сценариев командой ${it}") - steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + steps.catchError { + config.bddOptions.vrunnerSteps.each { + Logger.println("Шаг запуска сценариев командой ${it}") + steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + } } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index deb5ec7..4cbb215 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -25,27 +25,31 @@ class InitInfobase implements Serializable { return } - if (config.initInfobaseOptions.runMigration) { - Logger.println("Запуск миграции ИБ") - - // Запуск миграции - steps.catchError { - steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') - } - } else { - Logger.println("Шаг миграции ИБ выключен") - } - // TODO: удалить после выхода VAS 1.0.35 steps.httpRequest( 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' ) - steps.catchError { - config.initInfobaseOptions.additionalMigrationSteps.each { - Logger.println("Первичная инициализация командой ${it}") - steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + List logosConfig = ["LOGOS_CONFIG=$config.logosConfig"] + steps.withEnv(logosConfig) { + + if (config.initInfobaseOptions.runMigration) { + Logger.println("Запуск миграции ИБ") + + // Запуск миграции + steps.catchError { + steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') + } + } else { + Logger.println("Шаг миграции ИБ выключен") + } + + steps.catchError { + config.initInfobaseOptions.additionalMigrationSteps.each { + Logger.println("Первичная инициализация командой ${it}") + steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + } } } diff --git a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java index b547510..90cdd26 100644 --- a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java +++ b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java @@ -48,6 +48,8 @@ class ConfigurationReaderTest { assertThat(jobConfiguration.getInitInfobaseOptions().getAdditionalMigrationSteps()).contains("vanessa --settings ./tools/vrunner.first.json"); assertThat(jobConfiguration.getBddOptions().getVrunnerSteps()).contains("vanessa --settings ./tools/vrunner.json"); + + assertThat(jobConfiguration.getLogosConfig()).isEqualTo("logger.rootLogger=DEBUG"); } } \ No newline at end of file diff --git a/test/unit/resources/jobConfiguration.json b/test/unit/resources/jobConfiguration.json index 173d261..f73b8bb 100644 --- a/test/unit/resources/jobConfiguration.json +++ b/test/unit/resources/jobConfiguration.json @@ -17,5 +17,6 @@ }, "resultsTransform": { "removeSupport": true - } + }, + "logosConfig": "logger.rootLogger=DEBUG" } \ No newline at end of file From 0a007ec1166ea6a028131bbf5863e9867839dd6c Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 9 Jun 2021 22:14:24 +0300 Subject: [PATCH 38/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D1=87=D0=B0=20vrunner.json=20=D0=B2=20syntax-check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 5 ++-- resources/schema.json | 6 ++++- .../configuration/SyntaxCheckOptions.groovy | 20 ++++++++++---- vars/syntaxCheck.groovy | 26 ++++++++++++++----- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index b25868f..d0e62b6 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -30,7 +30,7 @@ }, "syntaxCheck": { "groupErrorsByMetadata": true, - "pathToJUnitReport": "build/out/jUnit/syntax.xml", + "pathToJUnitReport": "./build/out/jUnit/syntax.xml", "checkModes": [ "-ThinClient", "-WebClient", @@ -43,7 +43,8 @@ "-CheckUseModality", "-CheckUseSynchronousCalls", "-DistributiveModules" - ] + ], + "vrunnerSettings": "./tools/vrunner.json" }, "resultsTransform": { "removeSupport": false, diff --git a/resources/schema.json b/resources/schema.json index e964184..669178d 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -118,7 +118,7 @@ "properties" : { "pathToJUnitReport" : { "type" : "string", - "description" : "Путь к файлу отчета jUnit" + "description" : "Путь к файлу отчета jUnit\n По умолчанию содержит значение \"./build/out/junitsyntax.xml\"\n " }, "groupErrorsByMetadata" : { "type" : "boolean", @@ -130,6 +130,10 @@ "items" : { "type" : "string" } + }, + "vrunnerSettings" : { + "type" : "string", + "description" : "Путь к конфигурационному файлу vanessa-runner.\n По умолчанию содержит значение \"./tools/vrunner.json\".\n " } } }, diff --git a/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy index dc765f4..6edbf9b 100644 --- a/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy @@ -7,14 +7,23 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription @JsonIgnoreProperties(ignoreUnknown = true) class SyntaxCheckOptions implements Serializable { - @JsonPropertyDescription("Путь к файлу отчета jUnit") - String pathToJUnitReport + @JsonPropertyDescription("""Путь к файлу отчета jUnit + По умолчанию содержит значение "./build/out/jUnit/syntax.xml" + """) + String pathToJUnitReport = "./build/out/jUnit/syntax.xml" - @JsonPropertyDescription("Группировать выявленные ошибки по объектам метаданных") - boolean groupErrorsByMetadata; + @JsonPropertyDescription("""Группировать выявленные ошибки по объектам метаданных. + По умолчанию включено. + """) + boolean groupErrorsByMetadata = true @JsonPropertyDescription("Режимы проверки конфигурации") - String[] checkModes; + String[] checkModes + + @JsonPropertyDescription("""Путь к конфигурационному файлу vanessa-runner. + По умолчанию содержит значение "./tools/vrunner.json". + """) + String vrunnerSettings = "./tools/vrunner.json" @Override @NonCPS @@ -23,6 +32,7 @@ class SyntaxCheckOptions implements Serializable { "pathToJUnitReport='" + pathToJUnitReport + '\'' + ", groupErrorsByMetadata=" + groupErrorsByMetadata + ", checkModes=" + checkModes + + ", vrunnerSettings=" + vrunnerSettings + '}'; } } diff --git a/vars/syntaxCheck.groovy b/vars/syntaxCheck.groovy index 3d36d25..048cb6f 100644 --- a/vars/syntaxCheck.groovy +++ b/vars/syntaxCheck.groovy @@ -1,5 +1,7 @@ +import hudson.FilePath import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.FileUtils def call(JobConfiguration config) { @@ -20,27 +22,37 @@ def call(JobConfiguration config) { unzipInfobase() - def outPath = new File(options.pathToJUnitReport).getParent() + FilePath pathToJUnitReport = FileUtils.getFilePath("$env.WORKSPACE/$options.pathToJUnitReport") + + String outPath = pathToJUnitReport.getParent() createDir(outPath) - String command = "oscript_modules/bin/vrunner syntax-check --ibconnection \"/F./build/ib\"" + String command = 'oscript_modules/bin/vrunner syntax-check --ibconnection "/F./build/ib"' // Временно убрал передачу параметра. // См. https://github.com/vanessa-opensource/vanessa-runner/issues/361 // command += " --workspace $env.WORKSPACE" if (options.groupErrorsByMetadata) { - command += " --groupbymetadata" + command += ' --groupbymetadata' } - command += " --junitpath " + options.pathToJUnitReport; + command += " --junitpath $pathToJUnitReport"; - command += " --mode " + options.checkModes.join(" ") + FilePath vrunnerSettings = FileUtils.getFilePath("$env.WORKSPACE/$options.vrunnerSettings") + if (vrunnerSettings.exists()) { + command += " --settings $vrunnerSettings"; + } + + if (options.checkModes.length > 0) { + def checkModes = options.checkModes.join(" ") + command += " --mode $checkModes" + } // Запуск синтакс-проверки cmd(command, true) - junit allowEmptyResults: true, testResults: options.pathToJUnitReport + junit allowEmptyResults: true, testResults: FileUtils.getLocalPath(pathToJUnitReport) - archiveArtifacts options.pathToJUnitReport + archiveArtifacts FileUtils.getLocalPath(pathToJUnitReport) } From f778452da808906c0962f6af889dcc7f0ae71237 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 11 Jun 2021 14:55:57 +0300 Subject: [PATCH 39/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 2 +- resources/schema.json | 6 +++--- .../library/configuration/ConfigurationReader.groovy | 4 ++-- .../library/configuration/InitInfobaseOptions.groovy | 4 ++-- src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index d0e62b6..e6ffa64 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -16,7 +16,7 @@ }, "initInfobase": { "runMigration": true, - "additionalMigrationSteps": [] + "additionalInitializationSteps": [] }, "bdd": { "vrunnerSteps": [ diff --git a/resources/schema.json b/resources/schema.json index 669178d..03b81de 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -69,7 +69,7 @@ "type" : "boolean", "description" : "Запустить миграцию ИБ" }, - "additionalMigrationSteps" : { + "additionalInitializationSteps" : { "type" : "array", "description" : "Дополнительные шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.first.json\")\n ", "items" : { @@ -118,11 +118,11 @@ "properties" : { "pathToJUnitReport" : { "type" : "string", - "description" : "Путь к файлу отчета jUnit\n По умолчанию содержит значение \"./build/out/junitsyntax.xml\"\n " + "description" : "Путь к файлу отчета jUnit\n По умолчанию содержит значение \"./build/out/jUnit/syntax.xml\"\n " }, "groupErrorsByMetadata" : { "type" : "boolean", - "description" : "Группировать выявленные ошибки по объектам метаданных" + "description" : "Группировать выявленные ошибки по объектам метаданных.\n По умолчанию включено.\n " }, "checkModes" : { "type" : "array", diff --git a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy index 8388096..ea04ae4 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy @@ -80,10 +80,10 @@ class ConfigurationReader implements Serializable { @NonCPS private static void mergeInitInfobaseOptions(InitInfobaseOptions baseObject, @CheckForNull InitInfobaseOptions objectToMerge) { - if (objectToMerge == null || objectToMerge.additionalMigrationSteps == null) { + if (objectToMerge == null || objectToMerge.additionalInitializationSteps == null) { return } - baseObject.additionalMigrationSteps = objectToMerge.additionalMigrationSteps.clone() + baseObject.additionalInitializationSteps = objectToMerge.additionalInitializationSteps.clone() } @NonCPS diff --git a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy index 0e717a8..6350339 100644 --- a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy @@ -14,14 +14,14 @@ class InitInfobaseOptions implements Serializable { В каждой строке передается отдельная команда vrunner и ее аргументы (например, "vanessa --settings ./tools/vrunner.first.json") """) - String[] additionalMigrationSteps + String[] additionalInitializationSteps @Override @NonCPS String toString() { return "InitInfobaseOptions{" + "runMigration=" + runMigration + - ", additionalMigrationSteps=" + additionalMigrationSteps + + ", additionalInitializationSteps=" + additionalInitializationSteps + '}'; } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 4cbb215..dce9133 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -46,7 +46,7 @@ class InitInfobase implements Serializable { } steps.catchError { - config.initInfobaseOptions.additionalMigrationSteps.each { + config.initInfobaseOptions.additionalInitializationSteps.each { Logger.println("Первичная инициализация командой ${it}") steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") } From bdc72ccdd4c0e73aff95d6bd2f44a66337255a88 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 11 Jun 2021 14:57:08 +0300 Subject: [PATCH 40/99] =?UTF-8?q?removeSupport=20=D0=BF=D0=BE=20=D1=83?= =?UTF-8?q?=D0=BC=D0=BE=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E=20=D0=B2=D0=BA?= =?UTF-8?q?=D0=BB=D1=8E=D1=87=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 2 +- resources/schema.json | 2 +- .../library/configuration/ResultsTransformOptions.groovy | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index e6ffa64..d4e6cde 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -47,7 +47,7 @@ "vrunnerSettings": "./tools/vrunner.json" }, "resultsTransform": { - "removeSupport": false, + "removeSupport": true, "supportLevel": 0 }, "git": { diff --git a/resources/schema.json b/resources/schema.json index 03b81de..32fe1bc 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -144,7 +144,7 @@ "properties" : { "removeSupport" : { "type" : "boolean", - "description" : "Фильтровать замечания по уровню поддержки модуля" + "description" : "Фильтровать замечания по уровню поддержки модуля. По умолчанию включено." }, "supportLevel" : { "type" : "integer", diff --git a/src/ru/pulsar/jenkins/library/configuration/ResultsTransformOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/ResultsTransformOptions.groovy index c159fd2..08168fc 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ResultsTransformOptions.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ResultsTransformOptions.groovy @@ -7,8 +7,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription @JsonIgnoreProperties(ignoreUnknown = true) class ResultsTransformOptions implements Serializable { - @JsonPropertyDescription("Фильтровать замечания по уровню поддержки модуля") - boolean removeSupport + @JsonPropertyDescription("Фильтровать замечания по уровню поддержки модуля. По умолчанию включено.") + boolean removeSupport = true @JsonPropertyDescription("""Настройка фильтрации замечаний по уровню поддержки. 0 - удалить файлы на замке; From ec1bdd1dfca82c0a0f88d23c7b33793a28d64475 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 11 Jun 2021 14:57:34 +0300 Subject: [PATCH 41/99] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c08c25..796647b 100644 --- a/README.md +++ b/README.md @@ -23,18 +23,23 @@ 1. Для запуска шага анализа SonarQube требуется агент с меткой `sonar`. 1. Для запуска шага валидации EDT требуется агент с меткой `edt` (для собственно валидации) и агент с меткой `oscript` (для трансформации результатов с помощью библиотеки [stebi](https://github.com/Stepa86/stebi)). 1. Для запуска шагов, работающих с 1С (подготовка, синтаксический контроль и т.д.) требуется агент с меткой, совпадающей со значением в поле `v8version` файла конфигурации. -1. В качестве ИБ используется файловая база, создаваемая в `./build/ib`, без данных авторизации. Переопределение "в следующих сериях". +1. В качестве ИБ используется файловая база, создаваемая в `./build/ib` на основании конфигурации из хранилища без пользователей. При необходимости вы можете создать пользователей на фазе инициализации ИБ. 1. Stage "Дымовые тесты" пока пустой. 1. Запуск `vrunner` на текущий момент происходит из локального каталога `oscript_modules`. Предполагается наличие в корне репозитория файла `packagedef`, в котором бы была указана зависимость от `vanessa-runner` ## Возможности 1. Все шаги можно запустить на базе docker-образов из форка репозитория onec-docker. См. [памятку по слоям и последовательности сборки](https://github.com/firstBitSemenovskaya/onec-docker/blob/feature/first-bit/Layers.md) -1. Трансформация кода из формата конфигуратора в формат EDT (только если включен шаг `edtValidate`). 1. Подготовка информационной базы по версии из хранилища конфигурации. +1. Запуск ИБ в режиме выполнения обработчиков обновления БСП. +1. Дополнительные шаги инициализации данных в ИБ. +1. Трансформация кода из формата конфигуратора в формат EDT (только если включен шаг `edtValidate`). +1. Запуск BDD сценариев с сохранением результатов в формате Allure. 1. Запуск синтаксического контроля средствами конфигуратора и сохранение результатов в виде отчета jUnit. 1. Запуск валидации проекта средствами EDT и конвертация отчета в формате generic issues. -1. Запуск статического анализа для SonarQube +1. Запуск статического анализа для SonarQube. +1. Публикация результатов junit и Allure в интерфейс Jenkins. +1. Конфигурирование логгера запускаемых oscript-приложений. ## Подключение @@ -60,7 +65,7 @@ pipeline1C() ## Внешний вид пайплайна в интерфейсе Blue Ocean -![image](https://user-images.githubusercontent.com/1132840/80956084-27b14400-8e09-11ea-9e92-683818a14503.png) +![image](https://user-images.githubusercontent.com/1132840/121659170-b67f9e00-caaa-11eb-91be-107a689e893d.png) ## Конфигурирование @@ -89,3 +94,26 @@ pipeline1C() } } ``` + +## Параметры по умолчанию + +В библиотеке применяется принцип "соглашения по конфигурации" (convention over configuration): конфигурационный файл +содержит ряд настроек "по умолчанию". При соблюдении определенных правил структуры репозитория можно сократить +количество переопределений конфигурационного файла до минимума. + +* Общее: + * Исходники конфигурации ожидаются в каталоге `src/cf`. + * TODO: Имена "секретов" (jenkins credentials) по умолчанию высчитываются как `GROUP_REPO_KEY`, где `GROUP` и `REPO` - это группа проектов и имя проектов (например, `firstBitSemenovskaya` и `jenkins-lib`), а `KEY` - ключ секрета: + * `STORAGE_PATH` - путь к хранилищу конфигурации; + * `STORAGE_USER` - параметры авторизации в хранилище вида "username with password". + * Все "шаги" по умолчанию выключены. +* Инициализация: + * Если включен шаг `initSteps`, то будет выполняться запуск ИБ с целью запуска обработчиков обновления из БСП. (`initInfobase` -> `runMigration`) + * TODO: Если в настройках шага инициализации не заполнен массив дополнительных шагов миграции (`initInfobase` -> `additionalInitializationSteps`), но в каталоге `tools` присутствуют файлы с именами, удовлетворяющими шаблону `vrunner.init*.json`, то автоматически выполняется запуск `vrunner vanessa` с передачей найденных файлов в качестве значения настроек (параметр `--settings`) в порядке лексиграфической сортировки имен файлов. +* BDD: + * TODO: Если в репозитории существует файл `tools/vrunner.json`, а настройка `bdd` -> `vrunnerSteps` не заполнена, то автоматически выполняется запуск `vrunner vanessa --settings tools/vrunner.json`. +* Синтаксический контроль: + * Если в репозитории существует файл `tools/vrunner.json`, то синтаксический контроль конфигурации с помощью конфигуратора будет выполняться с передачей файла в параметры запуска `vrunner syntax-check --settings tools/vrunner.json`. + * TODO: Значение параметра `--mode` из конфигурационного файла vrunner имеют приоритет над `syntaxCheck` -> `checkModes`. Значение из `jobConfiguration.json` передается только в том случае, если параметр отсутствует в конфигурационном файле `vrunner`. +* Трансформация результатов валидации EDT: + * По умолчанию из результатов анализа исключаются замечания, сработавшие на модулях с включенным запретом редактирования (желтый куб с замком) \ No newline at end of file From be0108fd0dce80bb7d3d7bca91f117927c77f6f9 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 11 Jun 2021 15:03:59 +0300 Subject: [PATCH 42/99] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=8D=D0=BA=D1=81=D0=BF=D0=B5=D1=80=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=B2=20git=20scm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 8 +- resources/schema.json | 23 ----- .../jenkins/library/IStepExecutor.groovy | 6 -- .../jenkins/library/StepExecutor.groovy | 13 +-- .../configuration/ConfigurationReader.groovy | 3 +- .../configuration/GitSCMOptions.groovy | 28 ------ .../configuration/JobConfiguration.groovy | 5 - .../library/configuration/Secrets.groovy | 4 - .../jenkins/library/steps/Checkout.groovy | 97 ------------------- .../library/steps/GitSCMExtension.groovy | 16 --- .../ConfigurationReaderTest.java | 4 +- test/unit/resources/jobConfiguration.json | 4 +- vars/customCheckout.groovy | 10 -- 13 files changed, 7 insertions(+), 214 deletions(-) delete mode 100644 src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy delete mode 100644 src/ru/pulsar/jenkins/library/steps/Checkout.groovy delete mode 100644 src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy delete mode 100644 vars/customCheckout.groovy diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index d4e6cde..e2e2ca1 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -3,8 +3,7 @@ "srcDir": "src/cf", "secrets": { "storagePath": "UNKNOWN_ID", - "storage": "UNKNOWN_ID", - "lfs": "UNKNOWN_ID" + "storage": "UNKNOWN_ID" }, "stages": { "initSteps": false, @@ -50,10 +49,5 @@ "removeSupport": true, "supportLevel": 0 }, - "git": { - "lfsPull": false, - "lfsURI": "", - "lfsRepoURI": "" - }, "logosConfig": "" } diff --git a/resources/schema.json b/resources/schema.json index 32fe1bc..7a61217 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -22,10 +22,6 @@ "storage" : { "type" : "string", "description" : "Данные авторизации в хранилище конфигурации" - }, - "lfs" : { - "type" : "string", - "description" : "Данные авторизации для работы с LFS" } } }, @@ -152,25 +148,6 @@ } } }, - "git" : { - "type" : "object", - "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:GitSCMOptions", - "description" : "Настройки git-репозитория", - "properties" : { - "lfsPull" : { - "type" : "boolean", - "description" : "Дополнительно выполнить git lfs pull" - }, - "lfsURI" : { - "type" : "string", - "description" : "Адрес для получения данных LFS" - }, - "lfsRepoURI" : { - "type" : "string", - "description" : "Адрес удаленного репозитория для авторизации на LFS" - } - } - }, "logosConfig" : { "type" : "string", "description" : "Конфигурация библиотеки logos. Применяется перед запуском каждой стадии сборки" diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index 5d9d8a8..54d57af 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -1,7 +1,5 @@ package ru.pulsar.jenkins.library -import hudson.plugins.git.GitSCM -import hudson.scm.SCM import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction interface IStepExecutor { @@ -28,10 +26,6 @@ interface IStepExecutor { EnvironmentAction env() - GitSCM scm() - - void checkout(SCM scm) - void createDir(String path) def withEnv(List strings, Closure body) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index c297dfa..8cbe2de 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,7 +1,6 @@ package ru.pulsar.jenkins.library -import hudson.plugins.git.GitSCM -import hudson.scm.SCM + import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction import ru.yandex.qatools.allure.jenkins.config.ResultsConfig @@ -65,16 +64,6 @@ class StepExecutor implements IStepExecutor { return steps.env } - @Override - GitSCM scm() { - return steps.scm - } - - @Override - void checkout(SCM scm) { - steps.checkout(scm) - } - @Override void createDir(String path) { steps.createDir(path) diff --git a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy index ea04ae4..55b7ad2 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy @@ -47,8 +47,7 @@ class ConfigurationReader implements Serializable { "bddOptions", "sonarQubeOptions", "syntaxCheckOptions", - "resultsTransformOptions", - "gitSCMOptions" + "resultsTransformOptions" ).toSet() mergeObjects(baseConfiguration, configurationToMerge, nonMergeableSettings) diff --git a/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy deleted file mode 100644 index 9b98d15..0000000 --- a/src/ru/pulsar/jenkins/library/configuration/GitSCMOptions.groovy +++ /dev/null @@ -1,28 +0,0 @@ -package ru.pulsar.jenkins.library.configuration - -import com.cloudbees.groovy.cps.NonCPS -import com.fasterxml.jackson.annotation.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonPropertyDescription - -@JsonIgnoreProperties(ignoreUnknown = true) -class GitSCMOptions implements Serializable { - - @JsonPropertyDescription("Дополнительно выполнить git lfs pull") - boolean lfsPull - - @JsonPropertyDescription("Адрес для получения данных LFS") - String lfsURI = "" - - @JsonPropertyDescription("Адрес удаленного репозитория для авторизации на LFS") - String lfsRepoURI = "" - - @Override - @NonCPS - String toString() { - return "GitSCMOptions{" + - "lfsPull=" + lfsPull + - "lfsURI=" + lfsURI + - "lfsRepoURI=" + lfsRepoURI + - '}'; - } -} diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index fbb3e93..c404c9d 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -40,10 +40,6 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Настройки трансформации результатов анализа") ResultsTransformOptions resultsTransformOptions; - @JsonProperty("git") - @JsonPropertyDescription("Настройки git-репозитория") - GitSCMOptions gitSCMOptions; - @JsonProperty("logosConfig") @JsonPropertyDescription("Конфигурация библиотеки logos. Применяется перед запуском каждой стадии сборки") String logosConfig; @@ -61,7 +57,6 @@ class JobConfiguration implements Serializable { ", sonarQubeOptions=" + sonarQubeOptions + ", syntaxCheckOptions=" + syntaxCheckOptions + ", resultsTransformOptions=" + resultsTransformOptions + - ", gitSCMOptions=" + gitSCMOptions + ", logosConfig=" + logosConfig + '}'; } diff --git a/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy b/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy index b27d418..0ee17f0 100644 --- a/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy @@ -13,16 +13,12 @@ class Secrets implements Serializable { @JsonPropertyDescription("Данные авторизации в хранилище конфигурации") String storage - @JsonPropertyDescription("Данные авторизации для работы с LFS") - String lfs - @Override @NonCPS String toString() { return "Secrets{" + "storagePath='" + storagePath + '\'' + ", storage='" + storage + '\'' + - ", lfs='" + lfs + '\'' + '}'; } } diff --git a/src/ru/pulsar/jenkins/library/steps/Checkout.groovy b/src/ru/pulsar/jenkins/library/steps/Checkout.groovy deleted file mode 100644 index 8414b4f..0000000 --- a/src/ru/pulsar/jenkins/library/steps/Checkout.groovy +++ /dev/null @@ -1,97 +0,0 @@ -package ru.pulsar.jenkins.library.steps - -import hudson.plugins.git.GitSCM -import hudson.plugins.git.UserRemoteConfig -import ru.pulsar.jenkins.library.IStepExecutor -import ru.pulsar.jenkins.library.configuration.JobConfiguration -import ru.pulsar.jenkins.library.ioc.ContextRegistry -import ru.pulsar.jenkins.library.utils.Logger - -class Checkout implements Serializable { - - private final JobConfiguration config; - - Checkout(JobConfiguration config) { - this.config = config - } - - def run() { - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - - Logger.printLocation() - - def gitSCMOptions = config.gitSCMOptions - - if (!gitSCMOptions.lfsPull) { - return - } - - def scm = steps.scm() - - scm = addLFSRemoteConfig(scm) - - steps.checkout(scm) - - } - - private GitSCM addLFSRemoteConfig(GitSCM scm) { - def gitSCMOptions = config.gitSCMOptions - - if (gitSCMOptions.lfsURI.isEmpty()) { - return scm - } - - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - - // TODO: get git.exe path from scm settings - steps.cmd("git config -f .lfsconfig lfs.url $gitSCMOptions.lfsURI") - - List userRemoteConfigs = new ArrayList<>(scm.getUserRemoteConfigs()) - - if (gitSCMOptions.lfsRepoURI.isEmpty()) { - return scm - } - - def userRemoteConfig = userRemoteConfigs.find { it.url == gitSCMOptions.lfsRepoURI } - boolean needToUpdateUserRemoteConfigs - if (userRemoteConfig == null) { - def credentialsId = config.secrets.lfs.isEmpty() ? null : config.secrets.lfs - userRemoteConfig = new UserRemoteConfig( - config.gitSCMOptions.lfsRepoURI, - null, - null, - credentialsId - ) - - needToUpdateUserRemoteConfigs = true - } else { - def credentialsId = config.secrets.lfs.isEmpty() ? userRemoteConfig.credentialsId : config.secrets.lfs - - if (userRemoteConfig.credentialsId != credentialsId) { - userRemoteConfig = new UserRemoteConfig( - userRemoteConfig.url, - null, - userRemoteConfig.refspec, - credentialsId - ) - - needToUpdateUserRemoteConfigs = true - } - } - - if (needToUpdateUserRemoteConfigs) { - userRemoteConfigs.add(0, userRemoteConfig) - scm = new GitSCM( - userRemoteConfigs, - scm.branches, - scm.doGenerateSubmoduleConfigurations, - scm.submoduleCfg, - scm.browser, - scm.gitTool, - scm.extensions - ) - } - - return scm - } -} diff --git a/src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy b/src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy deleted file mode 100644 index af387cc..0000000 --- a/src/ru/pulsar/jenkins/library/steps/GitSCMExtension.groovy +++ /dev/null @@ -1,16 +0,0 @@ -package ru.pulsar.jenkins.library.steps - -import ru.pulsar.jenkins.library.configuration.JobConfiguration - -class GitSCMExtension implements Serializable { - - private final JobConfiguration config; - - GitSCMExtension(JobConfiguration config) { - this.config = config - } - - def run() { - - } -} diff --git a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java index 90cdd26..a1fe3b2 100644 --- a/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java +++ b/test/unit/groovy/ru/pulsar/jenkins/library/configuration/ConfigurationReaderTest.java @@ -41,11 +41,11 @@ class ConfigurationReaderTest { assertThat(jobConfiguration.getSyntaxCheckOptions().getCheckModes()).hasSize(1); - assertThat(jobConfiguration.getResultsTransformOptions().isRemoveSupport()).isTrue(); + assertThat(jobConfiguration.getResultsTransformOptions().isRemoveSupport()).isFalse(); assertThat(jobConfiguration.getResultsTransformOptions().getSupportLevel()).isZero(); assertThat(jobConfiguration.getInitInfobaseOptions().getRunMigration()).isFalse(); - assertThat(jobConfiguration.getInitInfobaseOptions().getAdditionalMigrationSteps()).contains("vanessa --settings ./tools/vrunner.first.json"); + assertThat(jobConfiguration.getInitInfobaseOptions().getAdditionalInitializationSteps()).contains("vanessa --settings ./tools/vrunner.first.json"); assertThat(jobConfiguration.getBddOptions().getVrunnerSteps()).contains("vanessa --settings ./tools/vrunner.json"); diff --git a/test/unit/resources/jobConfiguration.json b/test/unit/resources/jobConfiguration.json index f73b8bb..947e8ba 100644 --- a/test/unit/resources/jobConfiguration.json +++ b/test/unit/resources/jobConfiguration.json @@ -8,7 +8,7 @@ }, "initInfobase": { "runMigration": false, - "additionalMigrationSteps": [ + "additionalInitializationSteps": [ "vanessa --settings ./tools/vrunner.first.json" ] }, @@ -16,7 +16,7 @@ "checkModes": ["-ThinClient"] }, "resultsTransform": { - "removeSupport": true + "removeSupport": false }, "logosConfig": "logger.rootLogger=DEBUG" } \ No newline at end of file diff --git a/vars/customCheckout.groovy b/vars/customCheckout.groovy deleted file mode 100644 index 2056db9..0000000 --- a/vars/customCheckout.groovy +++ /dev/null @@ -1,10 +0,0 @@ -import ru.pulsar.jenkins.library.configuration.JobConfiguration -import ru.pulsar.jenkins.library.ioc.ContextRegistry -import ru.pulsar.jenkins.library.steps.Checkout - -void call(JobConfiguration config) { - ContextRegistry.registerDefaultContext(this) - - def checkout = new Checkout(config) - checkout.run() -} \ No newline at end of file From 945031956a2c6443baf35b2e358b4de7a81ff3ff Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 11 Jun 2021 15:53:11 +0300 Subject: [PATCH 43/99] =?UTF-8?q?Fix=20#12.=20=D0=9E=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B4=D0=B5=D1=84=D0=BE=D0=BB?= =?UTF-8?q?=D1=82=D0=BD=D0=B0=D1=8F=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D0=B0=20=D0=B8=D0=B7=20=D0=B3=D0=BB=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=84=D0=B8=D0=B3=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 796647b..7701d68 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ pipeline1C() * Если включен шаг `initSteps`, то будет выполняться запуск ИБ с целью запуска обработчиков обновления из БСП. (`initInfobase` -> `runMigration`) * TODO: Если в настройках шага инициализации не заполнен массив дополнительных шагов миграции (`initInfobase` -> `additionalInitializationSteps`), но в каталоге `tools` присутствуют файлы с именами, удовлетворяющими шаблону `vrunner.init*.json`, то автоматически выполняется запуск `vrunner vanessa` с передачей найденных файлов в качестве значения настроек (параметр `--settings`) в порядке лексиграфической сортировки имен файлов. * BDD: - * TODO: Если в репозитории существует файл `tools/vrunner.json`, а настройка `bdd` -> `vrunnerSteps` не заполнена, то автоматически выполняется запуск `vrunner vanessa --settings tools/vrunner.json`. + * Если в конфигурационном файле проекта не заполнена настройка `bdd` -> `vrunnerSteps`, то автоматически выполняется запуск `vrunner vanessa --settings tools/vrunner.json`. * Синтаксический контроль: * Если в репозитории существует файл `tools/vrunner.json`, то синтаксический контроль конфигурации с помощью конфигуратора будет выполняться с передачей файла в параметры запуска `vrunner syntax-check --settings tools/vrunner.json`. * TODO: Значение параметра `--mode` из конфигурационного файла vrunner имеют приоритет над `syntaxCheck` -> `checkModes`. Значение из `jobConfiguration.json` передается только в том случае, если параметр отсутствует в конфигурационном файле `vrunner`. From eb0e9c361f111412c6ee3a5c648036538e027d7d Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Fri, 11 Jun 2021 17:17:02 +0300 Subject: [PATCH 44/99] =?UTF-8?q?Fix=20#11.=20=D0=9F=D0=BE=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20vrunner.init.js?= =?UTF-8?q?on=20=D0=B4=D0=BB=D1=8F=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B2=D0=B8=D1=87=D0=BD=D0=BE=D0=B9?= =?UTF-8?q?=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- build.gradle.kts | 1 + .../pulsar/jenkins/library/IStepExecutor.groovy | 5 +++++ .../pulsar/jenkins/library/StepExecutor.groovy | 7 ++++++- .../jenkins/library/steps/InitInfobase.groovy | 16 +++++++++++++--- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7701d68..d67fd24 100644 --- a/README.md +++ b/README.md @@ -107,9 +107,10 @@ pipeline1C() * `STORAGE_PATH` - путь к хранилищу конфигурации; * `STORAGE_USER` - параметры авторизации в хранилище вида "username with password". * Все "шаги" по умолчанию выключены. + * Результаты в формате `allure` ожидаются в каталоге `build/out/allure` или его подкаталогах. * Инициализация: * Если включен шаг `initSteps`, то будет выполняться запуск ИБ с целью запуска обработчиков обновления из БСП. (`initInfobase` -> `runMigration`) - * TODO: Если в настройках шага инициализации не заполнен массив дополнительных шагов миграции (`initInfobase` -> `additionalInitializationSteps`), но в каталоге `tools` присутствуют файлы с именами, удовлетворяющими шаблону `vrunner.init*.json`, то автоматически выполняется запуск `vrunner vanessa` с передачей найденных файлов в качестве значения настроек (параметр `--settings`) в порядке лексиграфической сортировки имен файлов. + * Если в настройках шага инициализации не заполнен массив дополнительных шагов миграции (`initInfobase` -> `additionalInitializationSteps`), но в каталоге `tools` присутствуют файлы с именами, удовлетворяющими шаблону `vrunner.init*.json`, то автоматически выполняется запуск `vrunner vanessa` с передачей найденных файлов в качестве значения настроек (параметр `--settings`) в порядке лексиграфической сортировки имен файлов. * BDD: * Если в конфигурационном файле проекта не заполнена настройка `bdd` -> `vrunnerSteps`, то автоматически выполняется запуск `vrunner vanessa --settings tools/vrunner.json`. * Синтаксический контроль: diff --git a/build.gradle.kts b/build.gradle.kts index 643a9db..903165c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -78,6 +78,7 @@ sharedLibrary { // TODO: retrieve downloaded plugin resource pluginDependencies { dependency("org.jenkins-ci.plugins", "pipeline-build-step", "2.12") + dependency("org.jenkins-ci.plugins", "pipeline-utility-steps", "2.8.0") dependency("org.jenkins-ci.plugins", "git", "4.4.4") dependency("org.6wind.jenkins", "lockable-resources", "2.7") dependency("ru.yandex.qatools.allure", "allure-jenkins-plugin", "2.28.1") diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index 54d57af..8c11196 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -1,5 +1,6 @@ package ru.pulsar.jenkins.library +import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction interface IStepExecutor { @@ -12,6 +13,10 @@ interface IStepExecutor { String libraryResource(String path) + FileWrapper[] findFiles(String glob) + + FileWrapper[] findFiles(String glob, String excludes) + String readFile(String file, String encoding) void echo(message) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 8cbe2de..573673b 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,6 +1,6 @@ package ru.pulsar.jenkins.library - +import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction import ru.yandex.qatools.allure.jenkins.config.ResultsConfig @@ -37,6 +37,11 @@ class StepExecutor implements IStepExecutor { steps.readFile encoding: encoding, file: file } + @Override + FileWrapper[] findFiles(String glob, String excludes = '') { + steps.findFiles glob: glob, excludes: excludes + } + @Override void echo(Object message) { steps.echo message diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index dce9133..eaef74b 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -1,5 +1,6 @@ package ru.pulsar.jenkins.library.steps +import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry @@ -46,9 +47,18 @@ class InitInfobase implements Serializable { } steps.catchError { - config.initInfobaseOptions.additionalInitializationSteps.each { - Logger.println("Первичная инициализация командой ${it}") - steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + if (config.initInfobaseOptions.additionalInitializationSteps.length == 0) { + FileWrapper[] files = steps.findFiles("tools/vrunner.init*.json") + files = files.sort new OrderBy( { it.name }) + files.each { + Logger.println("Первичная инициализация файлом ${it.path}") + steps.cmd("oscript_modules/bin/vrunner vanessa --settings ${it.path} --ibconnection \"/F./build/ib\"") + } + } else { + config.initInfobaseOptions.additionalInitializationSteps.each { + Logger.println("Первичная инициализация командой ${it}") + steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + } } } } From ad527f680b38ba269c073278bb31ad7c050eabd2 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Jun 2021 21:50:01 +0300 Subject: [PATCH 45/99] fix checkfornull --- .../library/configuration/ConfigurationReader.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy index 55b7ad2..7b44dc1 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy @@ -7,8 +7,6 @@ import org.apache.commons.beanutils.BeanUtils import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.ioc.ContextRegistry -import javax.annotation.CheckForNull - class ConfigurationReader implements Serializable { private static ObjectMapper mapper @@ -78,7 +76,7 @@ class ConfigurationReader implements Serializable { } @NonCPS - private static void mergeInitInfobaseOptions(InitInfobaseOptions baseObject, @CheckForNull InitInfobaseOptions objectToMerge) { + private static void mergeInitInfobaseOptions(InitInfobaseOptions baseObject, InitInfobaseOptions objectToMerge) { if (objectToMerge == null || objectToMerge.additionalInitializationSteps == null) { return } @@ -86,7 +84,7 @@ class ConfigurationReader implements Serializable { } @NonCPS - private static void mergeBddOptions(BddOptions baseObject, @CheckForNull BddOptions objectToMerge) { + private static void mergeBddOptions(BddOptions baseObject, BddOptions objectToMerge) { if (objectToMerge == null || objectToMerge.vrunnerSteps == null) { return } From c5d410bef6cfb99720d358258dee385ccb0064b7 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 16 Jun 2021 10:29:35 +0300 Subject: [PATCH 46/99] =?UTF-8?q?=D0=A2=D0=B8=D0=BF=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/cmd.groovy | 2 +- vars/pipeline1C.groovy | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vars/cmd.groovy b/vars/cmd.groovy index b5ad056..692b019 100644 --- a/vars/cmd.groovy +++ b/vars/cmd.groovy @@ -4,6 +4,6 @@ import ru.pulsar.jenkins.library.ioc.ContextRegistry int call(String script, boolean returnStatus = false) { ContextRegistry.registerDefaultContext(this) - def cmd = new Cmd(script, returnStatus) + Cmd cmd = new Cmd(script, returnStatus) return cmd.run() } diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 04ee349..8da44df 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -1,3 +1,4 @@ +/* groovylint-disable NestedBlockDepth */ import groovy.transform.Field import ru.pulsar.jenkins.library.configuration.JobConfiguration @@ -7,7 +8,7 @@ import java.util.concurrent.TimeUnit JobConfiguration config @Field -def agent1C +String agent1C void call() { From cbb1f5618d415eae40d64546870be29f389bec67 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Fri, 30 Jul 2021 16:52:40 +0500 Subject: [PATCH 47/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B5=20?= =?UTF-8?q?=D1=88=D0=B0=D0=B3=D0=B8=20=D0=BA=20=D0=BD=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=BC=D1=83=20=D1=88=D0=B0=D0=B3=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 1 + resources/schema.json | 4 +++ .../library/configuration/StageFlags.groovy | 6 +++- .../jenkins/library/steps/EdtTransform.groovy | 35 +++++++++++++++++++ vars/edtTransform.groovy | 7 ++++ vars/pipeline1C.groovy | 13 +++++++ 6 files changed, 65 insertions(+), 1 deletion(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index e2e2ca1..c6927ad 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -6,6 +6,7 @@ "storage": "UNKNOWN_ID" }, "stages": { + "srcEDT" : true, "initSteps": false, "sonarqube": false, "bdd": false, diff --git a/resources/schema.json b/resources/schema.json index 7a61217..09d599b 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -53,6 +53,10 @@ "bdd" : { "type" : "boolean", "description" : "Запуск BDD сценариев включен" + }, + "srcEDT" : { + "type" : "boolean", + "description" : "Конвертировать исходники из формата EDT в формат конфигуратора" } } }, diff --git a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy index 2fdcbe7..d7d70b0 100644 --- a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy @@ -24,6 +24,9 @@ class StageFlags implements Serializable { @JsonPropertyDescription("Запуск BDD сценариев включен") boolean bdd + @JsonPropertyDescription("Исходники в формате EDT") + boolean srcEDT + @Override @NonCPS String toString() { @@ -34,10 +37,11 @@ class StageFlags implements Serializable { ", smoke=" + smoke + ", initSteps=" + initSteps + ", bdd=" + bdd + + ", srcEDT=" + srcEDT + '}'; } boolean needInfobase() { - return smoke || syntaxCheck || initSteps || bdd + return smoke || syntaxCheck || initSteps || bdd || srcEDT } } diff --git a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy index 68e53e6..749384e 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy @@ -12,6 +12,10 @@ class EdtTransform implements Serializable { public static final String WORKSPACE = 'build/edt-workspace' public static final String WORKSPACE_ZIP = 'build/edt-workspace.zip' public static final String WORKSPACE_ZIP_STASH = 'edt-workspace-zip' + public static final String WORKSPACECFG = 'build/cfg-workspace' + public static final String WORKSPACE_ZIP_CFG = 'build/cfg-workspace.zip' + public static final String WORKSPACE_ZIP_STASH_CFG = 'cfg-workspace-zip' + private final JobConfiguration config; @@ -49,4 +53,35 @@ class EdtTransform implements Serializable { steps.stash(WORKSPACE_ZIP_STASH, WORKSPACE_ZIP) } + def run(boolean srcEDT) { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + if (!config.stageFlags.srcEDT) { + Logger.println("SRC is not EDT format.") + return + } + + def env = steps.env(); + + + def workspaceDir = config.srcDir + def configurationRoot = "$env.WORKSPACE/$WORKSPACECFG" + def PROJECT_NAME = "pb17" // TODO взять из srcDIR + + steps.createDir(workspaceDir) + + Logger.println("Конвертация исходников из формата EDT в формат конфигуратора") + + def ringCommand = "ring edt workspace import --configuration-files '$configurationRoot' --project-name $PROJECT_NAME --workspace-location '$workspaceDir'" + + def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru'] + steps.withEnv(ringOpts) { + steps.cmd(ringCommand) + } + + steps.zip(WORKSPACECFG, WORKSPACE_ZIP_CFG) + steps.stash(WORKSPACE_ZIP_STASH_CFG, WORKSPACE_ZIP_CFG) + } } diff --git a/vars/edtTransform.groovy b/vars/edtTransform.groovy index de901e5..6fbe0fd 100644 --- a/vars/edtTransform.groovy +++ b/vars/edtTransform.groovy @@ -8,3 +8,10 @@ def call(JobConfiguration config) { def edtTransform = new EdtTransform(config) edtTransform.run() } + +def call(JobConfiguration config, boolean srcEDT) { + ContextRegistry.registerDefaultContext(this) + + def edtTransform = new EdtTransform(config) + edtTransform.run(true) +} diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 8da44df..ed06072 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -49,6 +49,19 @@ void call() { } stages { + stage('Трансформация из формата EDT') { + agent { + label 'edt' + } + when { + beforeAgent true + expression { config.stageFlags.srcEDT } + } + steps { + edtTransform config true + } + } + stage('Создание ИБ') { steps { printLocation() From 25941073dd37420094451995165a19e05fd6d80e Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Mon, 2 Aug 2021 07:45:59 +0500 Subject: [PATCH 48/99] Fix --- vars/pipeline1C.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index ed06072..98a2eff 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -58,7 +58,9 @@ void call() { expression { config.stageFlags.srcEDT } } steps { - edtTransform config true + script{ + edtTransform config true + } } } From 6cf6991c66c94209f1d808de4a8715fa1fa10034 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Tue, 3 Aug 2021 23:10:30 +0500 Subject: [PATCH 49/99] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=B0=D1=82=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/steps/EdtTransform.groovy | 35 ------------------- vars/edtTransform.groovy | 7 ---- 2 files changed, 42 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy index 749384e..68e53e6 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtTransform.groovy @@ -12,10 +12,6 @@ class EdtTransform implements Serializable { public static final String WORKSPACE = 'build/edt-workspace' public static final String WORKSPACE_ZIP = 'build/edt-workspace.zip' public static final String WORKSPACE_ZIP_STASH = 'edt-workspace-zip' - public static final String WORKSPACECFG = 'build/cfg-workspace' - public static final String WORKSPACE_ZIP_CFG = 'build/cfg-workspace.zip' - public static final String WORKSPACE_ZIP_STASH_CFG = 'cfg-workspace-zip' - private final JobConfiguration config; @@ -53,35 +49,4 @@ class EdtTransform implements Serializable { steps.stash(WORKSPACE_ZIP_STASH, WORKSPACE_ZIP) } - def run(boolean srcEDT) { - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - - Logger.printLocation() - - if (!config.stageFlags.srcEDT) { - Logger.println("SRC is not EDT format.") - return - } - - def env = steps.env(); - - - def workspaceDir = config.srcDir - def configurationRoot = "$env.WORKSPACE/$WORKSPACECFG" - def PROJECT_NAME = "pb17" // TODO взять из srcDIR - - steps.createDir(workspaceDir) - - Logger.println("Конвертация исходников из формата EDT в формат конфигуратора") - - def ringCommand = "ring edt workspace import --configuration-files '$configurationRoot' --project-name $PROJECT_NAME --workspace-location '$workspaceDir'" - - def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru'] - steps.withEnv(ringOpts) { - steps.cmd(ringCommand) - } - - steps.zip(WORKSPACECFG, WORKSPACE_ZIP_CFG) - steps.stash(WORKSPACE_ZIP_STASH_CFG, WORKSPACE_ZIP_CFG) - } } diff --git a/vars/edtTransform.groovy b/vars/edtTransform.groovy index 6fbe0fd..de901e5 100644 --- a/vars/edtTransform.groovy +++ b/vars/edtTransform.groovy @@ -8,10 +8,3 @@ def call(JobConfiguration config) { def edtTransform = new EdtTransform(config) edtTransform.run() } - -def call(JobConfiguration config, boolean srcEDT) { - ContextRegistry.registerDefaultContext(this) - - def edtTransform = new EdtTransform(config) - edtTransform.run(true) -} From 2a666a10db5dffe2bad85856c0df4db14561a058 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Tue, 3 Aug 2021 23:11:01 +0500 Subject: [PATCH 50/99] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D1=81=D1=81=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D0=B2=D0=B5=D1=80=D1=82=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B0=20EDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/steps/EdtBackTransform.groovy | 52 +++++++++++++++++++ vars/edtBackTransform.groovy | 10 ++++ 2 files changed, 62 insertions(+) create mode 100644 src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy create mode 100644 vars/edtBackTransform.groovy diff --git a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy new file mode 100644 index 0000000..a21efda --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy @@ -0,0 +1,52 @@ +package ru.pulsar.jenkins.library.steps + + +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.Logger + +class EdtBackTransform implements Serializable { + + public static final String PROJECT_NAME = 'pb17' // TODO Брать из srcDir + public static final String WORKSPACE = 'build/edt-workspace' + public static final String CONFIGURATION_ZIP = 'build/cfgPath.zip' + public static final String CONFIGURATION_ZIP_STASH = 'cfgPath-zip' + + private final JobConfiguration config; + + EdtBackTransform(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + if (!config.stageFlags.srcEDT) { + Logger.println("SRC is not EDT format. No transform is needed.") + return + } + + def env = steps.env(); + + def workspaceDir = "$env.WORKSPACE/$WORKSPACE" + def configurationRoot = config.srcDir + + steps.createDir(workspaceDir) + + Logger.println("Конвертация исходников из формата EDT в формат Конфигуратора") + + def ringCommand = "ring edt workspace export --configuration-files '$configurationRoot' --project-name $PROJECT_NAME --workspace-location '$workspaceDir'" + + def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru'] + steps.withEnv(ringOpts) { + steps.cmd(ringCommand) + } + + steps.zip(WORKSPACE, CONFIGURATION_ZIP) + steps.stash(CONFIGURATION_ZIP_STASH, CONFIGURATION_ZIP) + } + +} diff --git a/vars/edtBackTransform.groovy b/vars/edtBackTransform.groovy new file mode 100644 index 0000000..d81d7a0 --- /dev/null +++ b/vars/edtBackTransform.groovy @@ -0,0 +1,10 @@ +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.EdtBackTransform + +def call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) + + def edtBackTransform = new EdtBackTransform(config) + edtBackTransform.run() +} From fa36cf1a25058319ba6cbea984bffab4d8f5a0f6 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Tue, 3 Aug 2021 23:28:39 +0500 Subject: [PATCH 51/99] fix --- vars/pipeline1C.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 98a2eff..64e6f94 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -59,7 +59,7 @@ void call() { } steps { script{ - edtTransform config true + edtBackTransform config } } } From 86618f27417094c2c8a593cdc360a422de340d4e Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 4 Aug 2021 08:05:45 +0500 Subject: [PATCH 52/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BF=D1=83=D1=82=D0=B8=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D0=B2=D0=B5=D1=80=D1=82=D0=B0=D1=86=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/steps/EdtBackTransform.groovy | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy index a21efda..5189d00 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy @@ -8,10 +8,10 @@ import ru.pulsar.jenkins.library.utils.Logger class EdtBackTransform implements Serializable { - public static final String PROJECT_NAME = 'pb17' // TODO Брать из srcDir - public static final String WORKSPACE = 'build/edt-workspace' - public static final String CONFIGURATION_ZIP = 'build/cfgPath.zip' - public static final String CONFIGURATION_ZIP_STASH = 'cfgPath-zip' + public static final String WORKSPACE = 'build/workcspace' + public static final String CONFIGURATION_DIR = 'build/cfg' + public static final String CONFIGURATION_ZIP = 'build/cfg.zip' + public static final String CONFIGURATION_ZIP_STASH = 'cfg-zip' private final JobConfiguration config; @@ -31,21 +31,23 @@ class EdtBackTransform implements Serializable { def env = steps.env(); - def workspaceDir = "$env.WORKSPACE/$WORKSPACE" - def configurationRoot = config.srcDir + def projectDir = config.srcDir + def workspaceDir = "$env.WORKSPACE/$WORKSPACE" + def configurationRoot = "$env.WORKSPACE/$CONFIGURATION_DIR" steps.createDir(workspaceDir) + steps.createDir(configurationRoot) Logger.println("Конвертация исходников из формата EDT в формат Конфигуратора") - def ringCommand = "ring edt workspace export --configuration-files '$configurationRoot' --project-name $PROJECT_NAME --workspace-location '$workspaceDir'" + def ringCommand = "ring edt workspace export --configuration-files '$configurationRoot' --project $projectDir --workspace-location '$workspaceDir'" def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru'] steps.withEnv(ringOpts) { steps.cmd(ringCommand) } - steps.zip(WORKSPACE, CONFIGURATION_ZIP) + steps.zip(CONFIGURATION_DIR, CONFIGURATION_ZIP) steps.stash(CONFIGURATION_ZIP_STASH, CONFIGURATION_ZIP) } From 2ff7f5413396ba87eb7231df802fc207262915b4 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 4 Aug 2021 12:01:18 +0500 Subject: [PATCH 53/99] =?UTF-8?q?=D0=9F=D0=BE=D0=B8=D1=81=D0=BA=20=D1=80?= =?UTF-8?q?=D0=B5=D1=88=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B1?= =?UTF-8?q?=D0=BB=D0=B5=D0=BC=D1=8B=20=D1=81=20EDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 64e6f94..1ef56e5 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -37,6 +37,19 @@ void call() { } } + stage('Трансформация из формата EDT') { + agent { + label 'edt' + } + when { + beforeAgent true + expression { config.stageFlags.srcEDT } + } + steps { + edtBackTransform config + } + } + stage('Подготовка') { parallel { stage('Подготовка 1C базы') { @@ -49,21 +62,6 @@ void call() { } stages { - stage('Трансформация из формата EDT') { - agent { - label 'edt' - } - when { - beforeAgent true - expression { config.stageFlags.srcEDT } - } - steps { - script{ - edtBackTransform config - } - } - } - stage('Создание ИБ') { steps { printLocation() From a8985b0cc2a3acce48c07d1e5f47c8bd9fc1b50c Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 4 Aug 2021 13:01:11 +0500 Subject: [PATCH 54/99] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=BB=D1=81=D1=8F=20=D1=81=20=D0=BF=D1=80=D0=BE=D0=B1?= =?UTF-8?q?=D0=BB=D0=B5=D0=BC=D0=BE=D0=B9=20=D0=B0=D0=B3=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=20EDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 1ef56e5..64e6f94 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -37,19 +37,6 @@ void call() { } } - stage('Трансформация из формата EDT') { - agent { - label 'edt' - } - when { - beforeAgent true - expression { config.stageFlags.srcEDT } - } - steps { - edtBackTransform config - } - } - stage('Подготовка') { parallel { stage('Подготовка 1C базы') { @@ -62,6 +49,21 @@ void call() { } stages { + stage('Трансформация из формата EDT') { + agent { + label 'edt' + } + when { + beforeAgent true + expression { config.stageFlags.srcEDT } + } + steps { + script{ + edtBackTransform config + } + } + } + stage('Создание ИБ') { steps { printLocation() From 485c9c70d8228150f07bab5884ae014a6f8278b5 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 4 Aug 2021 13:09:44 +0500 Subject: [PATCH 55/99] =?UTF-8?q?=D0=9E=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BF=D1=83=D1=82=D1=8F=D0=BC=D0=B8=20=D0=BA=20=D0=B8?= =?UTF-8?q?=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D0=B8=D0=BA=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy index 5189d00..01f6afb 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy @@ -31,7 +31,8 @@ class EdtBackTransform implements Serializable { def env = steps.env(); - def projectDir = config.srcDir + def srcDir = config.srcDir + def projectDir = "$env.WORKSPACE/$srcDir" def workspaceDir = "$env.WORKSPACE/$WORKSPACE" def configurationRoot = "$env.WORKSPACE/$CONFIGURATION_DIR" From 45a3e5987f5a9a09736c1b165cd34123fdec077a Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Mon, 9 Aug 2021 07:51:42 +0500 Subject: [PATCH 56/99] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B8=D0=B7=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/configuration/StageFlags.groovy | 4 ++ .../library/steps/InitFromFiles.groovy | 38 +++++++++++++++++++ vars/initFromFiles.groovy | 10 +++++ vars/pipeline1C.groovy | 12 ++++-- 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy create mode 100644 vars/initFromFiles.groovy diff --git a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy index d7d70b0..618c255 100644 --- a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy @@ -44,4 +44,8 @@ class StageFlags implements Serializable { boolean needInfobase() { return smoke || syntaxCheck || initSteps || bdd || srcEDT } + + boolean infobaseFromFiles() { + return srcEDT + } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy new file mode 100644 index 0000000..dbbf975 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy @@ -0,0 +1,38 @@ +package ru.pulsar.jenkins.library.steps + +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.Logger + +class InitFromFiles implements Serializable { + + private final JobConfiguration config; + + InitFromFiles(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + if (!config.stageFlags.infobaseFromFiles()) { + Logger.println("init infoBase from files is disabled") + return + } + + Logger.println("Распаковка файлов") + + def env = steps.env(); + + def srcDir = "$env.WORKSPACE/$EdtBackTransform.CONFIGURATION_DIR" + + steps.unstash(EdtBackTransform.CONFIGURATION_ZIP_STASH) + steps.unzip(srcDir, EdtBackTransform.CONFIGURATION_ZIP) + + Logger.println("Выполнение загрузки конфигурации из файлов") + def initCommand = "oscript_modules/bin/vrunner init-dev --src $srcDir --ibconnection \"/F./build/ib\"" + steps.cmd(initCommand) + } +} diff --git a/vars/initFromFiles.groovy b/vars/initFromFiles.groovy new file mode 100644 index 0000000..ea0779b --- /dev/null +++ b/vars/initFromFiles.groovy @@ -0,0 +1,10 @@ +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.InitFromFiles + +def call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) + + def initFromFiles = new InitFromFiles(config) + initFromFiles.run() +} \ No newline at end of file diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 64e6f94..c11e8f9 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -72,8 +72,14 @@ void call() { createDir('build/out') - // Создание базы загрузкой конфигурации из хранилища - initFromStorage config + if (config.stageFlags.infobaseFromFiles()){ + // Создание базы загрузкой из файлов + initFromFiles config + } + else{ + // Создание базы загрузкой конфигурации из хранилища + initFromStorage config + } } } @@ -106,7 +112,7 @@ void call() { } when { beforeAgent true - expression { config.stageFlags.edtValidate } + expression { config.stageFlags.edtValidate && !config.stageFlags.srcEDT} } steps { edtTransform config From 34e1ed411fd1ddf0d3caffd76b90b97b6ed017c8 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Thu, 19 Aug 2021 21:51:02 +0500 Subject: [PATCH 57/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index c11e8f9..c32f06e 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -66,19 +66,21 @@ void call() { stage('Создание ИБ') { steps { - printLocation() + script{ + printLocation() - installLocalDependencies() + installLocalDependencies() - createDir('build/out') + createDir('build/out') - if (config.stageFlags.infobaseFromFiles()){ - // Создание базы загрузкой из файлов - initFromFiles config - } - else{ - // Создание базы загрузкой конфигурации из хранилища - initFromStorage config + if (config.stageFlags.infobaseFromFiles()){ + // Создание базы загрузкой из файлов + initFromFiles config + } + else{ + // Создание базы загрузкой конфигурации из хранилища + initFromStorage config + } } } } From 5f7a1d280f4f5283227bd3437e6f7303aff01fcd Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Fri, 20 Aug 2021 09:23:58 +0500 Subject: [PATCH 58/99] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy index dbbf975..5cb2c07 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy @@ -1,6 +1,7 @@ package ru.pulsar.jenkins.library.steps import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger From c9bc42def86493d86ce6aacaaeec0bf86c2d2a95 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Fri, 20 Aug 2021 14:43:56 +0500 Subject: [PATCH 59/99] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=D0=BB=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8?= =?UTF-8?q?,=20=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0=20=D0=B8=D1=81=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=BD=D0=B8=D0=BA=D0=B8=20=D0=B2=20=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B0=D1=82=D0=B5=20EDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pulsar/jenkins/library/steps/SonarScanner.groovy | 11 +++++++++-- .../pulsar/jenkins/library/utils/VersionParser.groovy | 8 ++++++++ vars/pipeline1C.groovy | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy b/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy index a75f6ec..2e26ae9 100644 --- a/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy +++ b/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy @@ -9,7 +9,7 @@ import ru.pulsar.jenkins.library.utils.VersionParser class SonarScanner implements Serializable { private final JobConfiguration config; - private final String rootFile + private String rootFile SonarScanner(JobConfiguration config) { this.config = config @@ -39,7 +39,14 @@ class SonarScanner implements Serializable { String sonarCommand = "$sonarScannerBinary -Dsonar.branch.name=$env.BRANCH_NAME" - String configurationVersion = VersionParser.configuration(rootFile) + String configurationVersion = "" + if (config.stageFlags.srcEDT) { + rootFile = "$config.srcDir/Configuration/Configuration.mdo" + configurationVersion = VersionParser.edt(rootFile) + }else { + configurationVersion = VersionParser.configuration(rootFile) + } + if (configurationVersion) { sonarCommand += " -Dsonar.projectVersion=$configurationVersion" } diff --git a/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy b/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy index 092e97f..8826ee0 100644 --- a/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy +++ b/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy @@ -30,4 +30,12 @@ class VersionParser implements Serializable { return matcher != null && matcher.getCount() == 1 ? matcher[0][1] : "" } + static String edt(rootFile = 'src/Configuration/Configuration.mdo') { + + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + def configurationText = steps.readFile(rootFile, 'UTF-8'); + return version(configurationText, VERSION_REGEXP) + } + } diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index c32f06e..6215f4b 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -59,7 +59,7 @@ void call() { } steps { script{ - edtBackTransform config + // edtBackTransform config } } } @@ -75,7 +75,7 @@ void call() { if (config.stageFlags.infobaseFromFiles()){ // Создание базы загрузкой из файлов - initFromFiles config + // initFromFiles config } else{ // Создание базы загрузкой конфигурации из хранилища From 3e957f435ab2b39a844f17877a78c32f218f8ece Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Fri, 20 Aug 2021 14:45:08 +0500 Subject: [PATCH 60/99] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 6215f4b..cad3fc5 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -58,9 +58,9 @@ void call() { expression { config.stageFlags.srcEDT } } steps { - script{ - // edtBackTransform config - } + // script{ + // // edtBackTransform config + // } } } From 071dbd7364bcbbabecce8f0338378bb9761d658f Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Fri, 20 Aug 2021 14:47:00 +0500 Subject: [PATCH 61/99] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index cad3fc5..a106596 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -49,20 +49,20 @@ void call() { } stages { - stage('Трансформация из формата EDT') { - agent { - label 'edt' - } - when { - beforeAgent true - expression { config.stageFlags.srcEDT } - } - steps { - // script{ - // // edtBackTransform config - // } - } - } + // stage('Трансформация из формата EDT') { + // agent { + // label 'edt' + // } + // when { + // beforeAgent true + // expression { config.stageFlags.srcEDT } + // } + // steps { + // script{ + // edtBackTransform config + // } + // } + // } stage('Создание ИБ') { steps { @@ -75,7 +75,7 @@ void call() { if (config.stageFlags.infobaseFromFiles()){ // Создание базы загрузкой из файлов - // initFromFiles config + initFromFiles config } else{ // Создание базы загрузкой конфигурации из хранилища From d63073e2199f6a36b93d3971aaaeacf86b38fd83 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Fri, 20 Aug 2021 14:57:21 +0500 Subject: [PATCH 62/99] =?UTF-8?q?=D0=95=D1=81=D0=BB=D0=B8=20=D0=98=D1=81?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=D0=BD=D0=B8=D0=BA=D0=B8=20=D0=B2=20=D1=84?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B5=20EDT,=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B7=D0=B0=20=D0=BD=D0=B5=20=D0=B2=D1=81=D0=B5=D0=B3=D0=B4?= =?UTF-8?q?=D0=B0=20=D0=BD=D1=83=D0=B6=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy index 618c255..73832e6 100644 --- a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy @@ -42,7 +42,7 @@ class StageFlags implements Serializable { } boolean needInfobase() { - return smoke || syntaxCheck || initSteps || bdd || srcEDT + return smoke || syntaxCheck || initSteps || bdd } boolean infobaseFromFiles() { From 1fd842662658f64e17546ba4082f5711634941e1 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Fri, 20 Aug 2021 14:59:50 +0500 Subject: [PATCH 63/99] =?UTF-8?q?=D0=95=D1=81=D0=BB=D0=B8=20=D0=B8=D1=81?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=D0=BD=D0=B8=D0=BA=D0=B8=20=D0=B2=20=D1=84?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B5=20EDT,=20=D0=91=D0=B0?= =?UTF-8?q?=D0=B7=D0=B0=20=D0=BD=D0=B5=20=D0=B2=D1=81=D0=B5=D0=B3=D0=B4?= =?UTF-8?q?=D0=B0=20=D0=BD=D1=83=D0=B6=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index a106596..c32f06e 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -49,20 +49,20 @@ void call() { } stages { - // stage('Трансформация из формата EDT') { - // agent { - // label 'edt' - // } - // when { - // beforeAgent true - // expression { config.stageFlags.srcEDT } - // } - // steps { - // script{ - // edtBackTransform config - // } - // } - // } + stage('Трансформация из формата EDT') { + agent { + label 'edt' + } + when { + beforeAgent true + expression { config.stageFlags.srcEDT } + } + steps { + script{ + edtBackTransform config + } + } + } stage('Создание ИБ') { steps { From e91bc7e73b5add5eb74ff6c2fb1cf3eaef54dd29 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 25 Aug 2021 07:40:58 +0500 Subject: [PATCH 64/99] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D0=BA=D0=BE=D0=BD=D0=B2=D0=B5=D1=80=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B8=D0=B7=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0?= =?UTF-8?q?=D1=82=D0=B0=20EDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy index 01f6afb..4f5bf45 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy @@ -43,7 +43,7 @@ class EdtBackTransform implements Serializable { def ringCommand = "ring edt workspace export --configuration-files '$configurationRoot' --project $projectDir --workspace-location '$workspaceDir'" - def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru'] + def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru -Xmx=16376m'] steps.withEnv(ringOpts) { steps.cmd(ringCommand) } From 22ab9b76c5e8c7c653f25aac3d334313f404980d Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 25 Aug 2021 07:54:20 +0500 Subject: [PATCH 65/99] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B1=D0=BB=D0=B5?= =?UTF-8?q?=D0=BC=D1=8B=20=D1=81=20=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D1=8C?= =?UTF-8?q?=D1=8E=2032=20=D1=80=D0=B0=D0=B7=D1=8F=D1=80=D1=8F=D0=B4=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20JAAVA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy index 4f5bf45..01f6afb 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtBackTransform.groovy @@ -43,7 +43,7 @@ class EdtBackTransform implements Serializable { def ringCommand = "ring edt workspace export --configuration-files '$configurationRoot' --project $projectDir --workspace-location '$workspaceDir'" - def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru -Xmx=16376m'] + def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru'] steps.withEnv(ringOpts) { steps.cmd(ringCommand) } From 62521d6fa8aefd5b885983ca3c8b8fb0c5751d52 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 8 Sep 2021 16:44:40 +0500 Subject: [PATCH 66/99] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 2 +- resources/schema.json | 9 +++++---- .../configuration/JobConfiguration.groovy | 4 ++++ .../library/configuration/SourceFormat.groovy | 17 +++++++++++++++++ .../library/configuration/StageFlags.groovy | 8 -------- vars/pipeline1C.groovy | 4 ++-- 6 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index c6927ad..d5a546c 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -1,12 +1,12 @@ { "$schema": "schema.json", "srcDir": "src/cf", + "sourceFormat": "designer", "secrets": { "storagePath": "UNKNOWN_ID", "storage": "UNKNOWN_ID" }, "stages": { - "srcEDT" : true, "initSteps": false, "sonarqube": false, "bdd": false, diff --git a/resources/schema.json b/resources/schema.json index 09d599b..a88fa04 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -10,6 +10,11 @@ "type" : "string", "description" : "Путь к корневому каталогу с исходниками конфигурации" }, + "sourceFormat" : { + "type" : "string", + "description" : "Формат исходников конфигурации", + "enum" : [ "edt", "designer" ] + }, "secrets" : { "type" : "object", "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:Secrets", @@ -53,10 +58,6 @@ "bdd" : { "type" : "boolean", "description" : "Запуск BDD сценариев включен" - }, - "srcEDT" : { - "type" : "boolean", - "description" : "Конвертировать исходники из формата EDT в формат конфигуратора" } } }, diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index c404c9d..d7fe835 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -13,6 +13,9 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Путь к корневому каталогу с исходниками конфигурации") String srcDir + @JsonPropertyDescription("Формат исходников конфигурации") + SourceFormat sourceFormat; + @JsonProperty("stages") @JsonPropertyDescription("Включение этапов сборок") StageFlags stageFlags; @@ -50,6 +53,7 @@ class JobConfiguration implements Serializable { return "JobConfiguration{" + "v8version='" + v8version + '\'' + ", srcDir='" + srcDir + '\'' + + ", sourceFormat='" + sourceFormat + ", stageFlags=" + stageFlags + ", secrets=" + secrets + ", initInfobaseOptions=" + initInfobaseOptions + diff --git a/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy b/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy new file mode 100644 index 0000000..da2d721 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy @@ -0,0 +1,17 @@ +package ru.pulsar.jenkins.library.configuration + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty + +@JsonIgnoreProperties(ignoreUnknown = true) +public enum SourceFormat{ + @JsonProperty("edt") + EDT, + + @JsonProperty("designer") + DESIGNER + + boolean infobaseFromFiles(){ + return EDT + } +} \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy index 73832e6..2fdcbe7 100644 --- a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy @@ -24,9 +24,6 @@ class StageFlags implements Serializable { @JsonPropertyDescription("Запуск BDD сценариев включен") boolean bdd - @JsonPropertyDescription("Исходники в формате EDT") - boolean srcEDT - @Override @NonCPS String toString() { @@ -37,15 +34,10 @@ class StageFlags implements Serializable { ", smoke=" + smoke + ", initSteps=" + initSteps + ", bdd=" + bdd + - ", srcEDT=" + srcEDT + '}'; } boolean needInfobase() { return smoke || syntaxCheck || initSteps || bdd } - - boolean infobaseFromFiles() { - return srcEDT - } } diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index c32f06e..6d1088b 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -55,7 +55,7 @@ void call() { } when { beforeAgent true - expression { config.stageFlags.srcEDT } + expression { config.sourceFormat.infobaseFromFiles() } } steps { script{ @@ -73,7 +73,7 @@ void call() { createDir('build/out') - if (config.stageFlags.infobaseFromFiles()){ + if (config.sourceFormat.infobaseFromFiles()){ // Создание базы загрузкой из файлов initFromFiles config } From f0e72e772e4ec8258f221ef4324d8f8951eb7019 Mon Sep 17 00:00:00 2001 From: kuzja086 Date: Wed, 8 Sep 2021 16:44:40 +0500 Subject: [PATCH 67/99] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 2 +- resources/schema.json | 9 ++++--- .../configuration/JobConfiguration.groovy | 4 +++ .../library/configuration/SourceFormat.groovy | 27 +++++++++++++++++++ .../library/configuration/StageFlags.groovy | 8 ------ vars/pipeline1C.groovy | 4 +-- 6 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index c6927ad..d5a546c 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -1,12 +1,12 @@ { "$schema": "schema.json", "srcDir": "src/cf", + "sourceFormat": "designer", "secrets": { "storagePath": "UNKNOWN_ID", "storage": "UNKNOWN_ID" }, "stages": { - "srcEDT" : true, "initSteps": false, "sonarqube": false, "bdd": false, diff --git a/resources/schema.json b/resources/schema.json index 09d599b..a88fa04 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -10,6 +10,11 @@ "type" : "string", "description" : "Путь к корневому каталогу с исходниками конфигурации" }, + "sourceFormat" : { + "type" : "string", + "description" : "Формат исходников конфигурации", + "enum" : [ "edt", "designer" ] + }, "secrets" : { "type" : "object", "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:Secrets", @@ -53,10 +58,6 @@ "bdd" : { "type" : "boolean", "description" : "Запуск BDD сценариев включен" - }, - "srcEDT" : { - "type" : "boolean", - "description" : "Конвертировать исходники из формата EDT в формат конфигуратора" } } }, diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index c404c9d..d7fe835 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -13,6 +13,9 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Путь к корневому каталогу с исходниками конфигурации") String srcDir + @JsonPropertyDescription("Формат исходников конфигурации") + SourceFormat sourceFormat; + @JsonProperty("stages") @JsonPropertyDescription("Включение этапов сборок") StageFlags stageFlags; @@ -50,6 +53,7 @@ class JobConfiguration implements Serializable { return "JobConfiguration{" + "v8version='" + v8version + '\'' + ", srcDir='" + srcDir + '\'' + + ", sourceFormat='" + sourceFormat + ", stageFlags=" + stageFlags + ", secrets=" + secrets + ", initInfobaseOptions=" + initInfobaseOptions + diff --git a/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy b/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy new file mode 100644 index 0000000..32e2cfb --- /dev/null +++ b/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy @@ -0,0 +1,27 @@ +package ru.pulsar.jenkins.library.configuration + +import com.cloudbees.groovy.cps.NonCPS +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty + +@JsonIgnoreProperties(ignoreUnknown = true) +public enum SourceFormat{ + @JsonProperty("edt") + EDT, + + @JsonProperty("designer") + DESIGNER + + @Override + @NonCPS + String toString() { + return "SourceFormat{" + + "edt='" + EDT + + "designer='" + DESIGNER + + '}'; + } + boolean infobaseFromFiles(){ + return EDT + } + +} \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy index 73832e6..2fdcbe7 100644 --- a/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy @@ -24,9 +24,6 @@ class StageFlags implements Serializable { @JsonPropertyDescription("Запуск BDD сценариев включен") boolean bdd - @JsonPropertyDescription("Исходники в формате EDT") - boolean srcEDT - @Override @NonCPS String toString() { @@ -37,15 +34,10 @@ class StageFlags implements Serializable { ", smoke=" + smoke + ", initSteps=" + initSteps + ", bdd=" + bdd + - ", srcEDT=" + srcEDT + '}'; } boolean needInfobase() { return smoke || syntaxCheck || initSteps || bdd } - - boolean infobaseFromFiles() { - return srcEDT - } } diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index c32f06e..6d1088b 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -55,7 +55,7 @@ void call() { } when { beforeAgent true - expression { config.stageFlags.srcEDT } + expression { config.sourceFormat.infobaseFromFiles() } } steps { script{ @@ -73,7 +73,7 @@ void call() { createDir('build/out') - if (config.stageFlags.infobaseFromFiles()){ + if (config.sourceFormat.infobaseFromFiles()){ // Создание базы загрузкой из файлов initFromFiles config } From e8434be82724a3fe67839af68d044bf5ea680963 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 20 Oct 2021 14:18:28 +0300 Subject: [PATCH 68/99] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=B0=D0=B7=20=D0=BE?= =?UTF-8?q?=D1=82=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE=D0=B9?= =?UTF-8?q?=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20VAS.=20=D0=98=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D0=B5=D0=BC=201.2.037?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/Bdd.groovy | 6 ------ src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy index ebb8629..c4ea75d 100644 --- a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -29,12 +29,6 @@ class Bdd implements Serializable { steps.createDir('build/out') - // TODO: удалить после выхода VAS 1.0.35 - steps.httpRequest( - 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', - 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' - ) - steps.catchError { config.bddOptions.vrunnerSteps.each { Logger.println("Шаг запуска сценариев командой ${it}") diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index eaef74b..2de093f 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -26,12 +26,6 @@ class InitInfobase implements Serializable { return } - // TODO: удалить после выхода VAS 1.0.35 - steps.httpRequest( - 'https://cloud.svc.pulsar.ru/index.php/s/WKwmqpFXSjfYjAH/download', - 'oscript_modules/vanessa-automation-single/vanessa-automation-single.epf' - ) - List logosConfig = ["LOGOS_CONFIG=$config.logosConfig"] steps.withEnv(logosConfig) { From 6dc682a5738e49a66689811e71ae9cb292bad640 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Sun, 31 Oct 2021 21:58:01 +0300 Subject: [PATCH 69/99] =?UTF-8?q?Fix=20#21=20=D0=92=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D1=8F=208.3=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BA=D0=B0=D0=BA=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D1=8F=20=D0=BF=D0=BE=20=D1=83=D0=BC=D0=BE?= =?UTF-8?q?=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index e2e2ca1..f6034ba 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -1,5 +1,6 @@ { "$schema": "schema.json", + "v8version": "8.3" "srcDir": "src/cf", "secrets": { "storagePath": "UNKNOWN_ID", From 0bdfe3ebaf0767949f3e4ce06519d79ef50fd99f Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Sun, 31 Oct 2021 22:13:53 +0300 Subject: [PATCH 70/99] =?UTF-8?q?#21=20=D0=A3=D1=82=D0=BE=D1=87=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=20=D0=B2=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BF=D0=BE=20=D1=83=D0=BC=D0=BE=D0=BB=D1=87?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8E=20=D0=B2=20=D1=80=D0=B8=D0=B4=D0=BC?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d67fd24..37e6b6f 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ pipeline1C() количество переопределений конфигурационного файла до минимума. * Общее: + * В качестве маски версии платформы используется строка "8.3". * Исходники конфигурации ожидаются в каталоге `src/cf`. * TODO: Имена "секретов" (jenkins credentials) по умолчанию высчитываются как `GROUP_REPO_KEY`, где `GROUP` и `REPO` - это группа проектов и имя проектов (например, `firstBitSemenovskaya` и `jenkins-lib`), а `KEY` - ключ секрета: * `STORAGE_PATH` - путь к хранилищу конфигурации; @@ -117,4 +118,4 @@ pipeline1C() * Если в репозитории существует файл `tools/vrunner.json`, то синтаксический контроль конфигурации с помощью конфигуратора будет выполняться с передачей файла в параметры запуска `vrunner syntax-check --settings tools/vrunner.json`. * TODO: Значение параметра `--mode` из конфигурационного файла vrunner имеют приоритет над `syntaxCheck` -> `checkModes`. Значение из `jobConfiguration.json` передается только в том случае, если параметр отсутствует в конфигурационном файле `vrunner`. * Трансформация результатов валидации EDT: - * По умолчанию из результатов анализа исключаются замечания, сработавшие на модулях с включенным запретом редактирования (желтый куб с замком) \ No newline at end of file + * По умолчанию из результатов анализа исключаются замечания, сработавшие на модулях с включенным запретом редактирования (желтый куб с замком) From b8ffc3823835c20ab77620430f4c7d3237afafae Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Mon, 1 Nov 2021 12:33:48 +0300 Subject: [PATCH 71/99] =?UTF-8?q?#21=20=D0=98=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=B8=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D0=BA=D1=81=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20=D0=B2=20json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index f6034ba..c2c1ded 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -1,6 +1,6 @@ { "$schema": "schema.json", - "v8version": "8.3" + "v8version": "8.3", "srcDir": "src/cf", "secrets": { "storagePath": "UNKNOWN_ID", From 9cde4679af04cce35beeead73971baee75230a21 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 1 Nov 2021 13:20:18 +0300 Subject: [PATCH 72/99] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20vrunner,=20=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=B3=D0=BB=D0=BE=D0=B1=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE.=20=D0=9E=D0=BF=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=88=D0=B0=D0=B3=20=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BB=D0=BE=D0=BA?= =?UTF-8?q?=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20=D0=B7=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/IStepExecutor.groovy | 2 ++ .../jenkins/library/StepExecutor.groovy | 5 +++++ .../pulsar/jenkins/library/steps/Bdd.groovy | 4 +++- .../jenkins/library/steps/InitInfobase.groovy | 9 ++++++--- .../jenkins/library/utils/VRunner.groovy | 20 +++++++++++++++++++ .../jenkins/library/utils/TestUtils.java | 5 +++++ vars/initFromStorage.groovy | 4 +++- vars/installLocalDependencies.groovy | 7 +++++++ vars/syntaxCheck.groovy | 4 +++- 9 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/utils/VRunner.groovy diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index 8c11196..c8d36c7 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -19,6 +19,8 @@ interface IStepExecutor { String readFile(String file, String encoding) + boolean fileExists(String file) + void echo(message) int cmd(String script, boolean returnStatus) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 573673b..8bd9348 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -37,6 +37,11 @@ class StepExecutor implements IStepExecutor { steps.readFile encoding: encoding, file: file } + @Override + boolean fileExists(String file) { + steps.fileExists file + } + @Override FileWrapper[] findFiles(String glob, String excludes = '') { steps.findFiles glob: glob, excludes: excludes diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy index c4ea75d..33940e9 100644 --- a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -4,6 +4,7 @@ import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger +import ru.pulsar.jenkins.library.utils.VRunner class Bdd implements Serializable { @@ -32,7 +33,8 @@ class Bdd implements Serializable { steps.catchError { config.bddOptions.vrunnerSteps.each { Logger.println("Шаг запуска сценариев командой ${it}") - steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + String vrunnerPath = VRunner.getVRunnerPath(); + steps.cmd("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"") } } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 2de093f..4518a35 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -5,6 +5,7 @@ import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger +import ru.pulsar.jenkins.library.utils.VRunner class InitInfobase implements Serializable { @@ -29,12 +30,14 @@ class InitInfobase implements Serializable { List logosConfig = ["LOGOS_CONFIG=$config.logosConfig"] steps.withEnv(logosConfig) { + String vrunnerPath = VRunner.getVRunnerPath(); + if (config.initInfobaseOptions.runMigration) { Logger.println("Запуск миграции ИБ") // Запуск миграции steps.catchError { - steps.cmd('oscript_modules/bin/vrunner run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') + steps.cmd(vrunnerPath + ' run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') } } else { Logger.println("Шаг миграции ИБ выключен") @@ -46,12 +49,12 @@ class InitInfobase implements Serializable { files = files.sort new OrderBy( { it.name }) files.each { Logger.println("Первичная инициализация файлом ${it.path}") - steps.cmd("oscript_modules/bin/vrunner vanessa --settings ${it.path} --ibconnection \"/F./build/ib\"") + steps.cmd("$vrunnerPath vanessa --settings ${it.path} --ibconnection \"/F./build/ib\"") } } else { config.initInfobaseOptions.additionalInitializationSteps.each { Logger.println("Первичная инициализация командой ${it}") - steps.cmd("oscript_modules/bin/vrunner ${it} --ibconnection \"/F./build/ib\"") + steps.cmd("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"") } } } diff --git a/src/ru/pulsar/jenkins/library/utils/VRunner.groovy b/src/ru/pulsar/jenkins/library/utils/VRunner.groovy new file mode 100644 index 0000000..53fd98d --- /dev/null +++ b/src/ru/pulsar/jenkins/library/utils/VRunner.groovy @@ -0,0 +1,20 @@ +package ru.pulsar.jenkins.library.utils + +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.ioc.ContextRegistry + +class VRunner { + + static String getVRunnerPath() { + + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + String vrunnerBinary = steps.isUnix() ? "vrunner" : "vrunner.bat"; + String vrunnerPath = "oscript_modules/bin/$vrunnerBinary"; + if (!steps.fileExists(vrunnerPath)) { + vrunnerPath = vrunnerBinary; + } + + return vrunnerPath; + } +} diff --git a/test/unit/groovy/ru/pulsar/jenkins/library/utils/TestUtils.java b/test/unit/groovy/ru/pulsar/jenkins/library/utils/TestUtils.java index 2531ae6..6d2e88b 100644 --- a/test/unit/groovy/ru/pulsar/jenkins/library/utils/TestUtils.java +++ b/test/unit/groovy/ru/pulsar/jenkins/library/utils/TestUtils.java @@ -34,6 +34,11 @@ public class TestUtils { return FileUtils.readFileToString(new File(file), encoding); }); + when(steps.fileExists(anyString())).thenAnswer(invocation -> { + String file = invocation.getArgument(0); + return new File(file).exists(); + }); + return steps; } diff --git a/vars/initFromStorage.groovy b/vars/initFromStorage.groovy index 3937c0c..b4f9a87 100644 --- a/vars/initFromStorage.groovy +++ b/vars/initFromStorage.groovy @@ -1,4 +1,5 @@ import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.utils.VRunner import ru.pulsar.jenkins.library.utils.VersionParser def call(JobConfiguration jobConfiguration) { @@ -17,6 +18,7 @@ def call(JobConfiguration jobConfiguration) { variable: 'STORAGE_PATH' ) ]) { - cmd "oscript_modules/bin/vrunner init-dev --storage --storage-name $STORAGE_PATH --storage-user $STORAGE_USR --storage-pwd $STORAGE_PSW $storageVersionParameter --ibconnection \"/F./build/ib\"" + String vrunnerPath = VRunner.getVRunnerPath(); + cmd "$vrunnerPath init-dev --storage --storage-name $STORAGE_PATH --storage-user $STORAGE_USR --storage-pwd $STORAGE_PSW $storageVersionParameter --ibconnection \"/F./build/ib\"" } } \ No newline at end of file diff --git a/vars/installLocalDependencies.groovy b/vars/installLocalDependencies.groovy index 86c9580..02c13b4 100644 --- a/vars/installLocalDependencies.groovy +++ b/vars/installLocalDependencies.groovy @@ -1,3 +1,10 @@ +import ru.pulsar.jenkins.library.utils.Logger + def call() { + if (!fileExists("packagedef")) { + return + } + + Logger.println("Установка локальных зависимостей OneScript") cmd("opm install -l") } \ No newline at end of file diff --git a/vars/syntaxCheck.groovy b/vars/syntaxCheck.groovy index 048cb6f..393a511 100644 --- a/vars/syntaxCheck.groovy +++ b/vars/syntaxCheck.groovy @@ -2,6 +2,7 @@ import hudson.FilePath import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.FileUtils +import ru.pulsar.jenkins.library.utils.VRunner def call(JobConfiguration config) { @@ -27,7 +28,8 @@ def call(JobConfiguration config) { String outPath = pathToJUnitReport.getParent() createDir(outPath) - String command = 'oscript_modules/bin/vrunner syntax-check --ibconnection "/F./build/ib"' + String vrunnerPath = VRunner.getVRunnerPath(); + String command = "$vrunnerPath syntax-check --ibconnection \"/F./build/ib\"" // Временно убрал передачу параметра. // См. https://github.com/vanessa-opensource/vanessa-runner/issues/361 From f8020afa68a4dbf11ca1c3ac00097b761188cee9 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 1 Nov 2021 17:45:57 +0300 Subject: [PATCH 73/99] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B4=D0=B5=D1=80?= =?UTF-8?q?=D0=B6=D0=BA=D0=B0=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=B8=D0=B7=20=D0=B8=D1=81=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=84?= =?UTF-8?q?=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + resources/globalConfiguration.json | 2 ++ resources/schema.json | 11 +++++++++- .../configuration/ConfigurationReader.groovy | 21 +++++++++++++++--- .../configuration/InitInfobaseMethod.groovy | 16 ++++++++++++++ .../configuration/InitInfobaseOptions.groovy | 12 +++++++++- .../configuration/JobConfiguration.groovy | 18 +++++++++++++-- .../library/configuration/SourceFormat.groovy | 17 +------------- .../jenkins/library/steps/EdtValidate.groovy | 21 +++++++++++++----- .../library/steps/InitFromFiles.groovy | 22 ++++++++++++++----- .../groovy/jobConfigurationTest.groovy | 1 + .../resources/jobConfiguration.json | 5 ++++- vars/initFromStorage.groovy | 4 ++++ vars/pipeline1C.groovy | 7 +++--- 14 files changed, 118 insertions(+), 40 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/configuration/InitInfobaseMethod.groovy diff --git a/.gitignore b/.gitignore index 2e4da7e..f58cab4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/ .gradle/ build/ +bin/ *.iml diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index e0a5223..f4886a4 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -3,6 +3,7 @@ "v8version": "8.3", "srcDir": "src/cf", "sourceFormat": "designer", + "defaultBranch": "main", "secrets": { "storagePath": "UNKNOWN_ID", "storage": "UNKNOWN_ID" @@ -16,6 +17,7 @@ "smoke": false }, "initInfobase": { + "initMethod": "fromStorage", "runMigration": true, "additionalInitializationSteps": [] }, diff --git a/resources/schema.json b/resources/schema.json index a88fa04..58f5579 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -8,13 +8,17 @@ }, "srcDir" : { "type" : "string", - "description" : "Путь к корневому каталогу с исходниками конфигурации" + "description" : "Путь к корневому каталогу с исходниками конфигурации, в случае хранения исходников в формате EDT, необходимо указать путь к проекту" }, "sourceFormat" : { "type" : "string", "description" : "Формат исходников конфигурации", "enum" : [ "edt", "designer" ] }, + "defaultBranch" : { + "type" : "string", + "description" : "Имя ветки по умолчанию" + }, "secrets" : { "type" : "object", "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:Secrets", @@ -66,6 +70,11 @@ "id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:InitInfobaseOptions", "description" : "Настройки шага инициализации ИБ", "properties" : { + "initMethod" : { + "type" : "string", + "description" : "\n Способ инициализации информационной базы.\n Поддерживается три варианта:\n * fromStorage - инициализация информационной базы из хранилища конфигурации;\n * fromSource - инициализация информационной базы из исходников конфигурации;\n * defaultBranchFromStorage - инициализация основной ветки из хранилища конфигурации, остальных - из исходников конфигурации.\n По умолчанию содержит значение \"fromStorage\".", + "enum" : [ "fromStorage", "fromSource", "defaultBranchFromStorage" ] + }, "runMigration" : { "type" : "boolean", "description" : "Запустить миграцию ИБ" diff --git a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy index 7b44dc1..09776bd 100644 --- a/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/ConfigurationReader.groovy @@ -3,16 +3,31 @@ package ru.pulsar.jenkins.library.configuration import com.cloudbees.groovy.cps.NonCPS import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.ObjectMapper -import org.apache.commons.beanutils.BeanUtils +import org.apache.commons.beanutils.BeanUtilsBean +import org.apache.commons.beanutils.ConvertUtilsBean import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.ioc.ContextRegistry class ConfigurationReader implements Serializable { private static ObjectMapper mapper + private static BeanUtilsBean beanUtilsBean; + static { mapper = new ObjectMapper() mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + + beanUtilsBean = new BeanUtilsBean(new ConvertUtilsBean() { + @Override + @NonCPS + Object convert(String value, Class clazz) { + if (clazz.isEnum()) { + return Enum.valueOf(clazz, value); + } else { + return super.convert(value, clazz); + } + } + }); } private static final String DEFAULT_CONFIGURATION_RESOURCE = 'globalConfiguration.json' @@ -57,13 +72,13 @@ class ConfigurationReader implements Serializable { @NonCPS private static void mergeObjects(T baseObject, T objectToMerge, Set nonMergeableSettings) { - BeanUtils.describe(objectToMerge).entrySet().stream() + beanUtilsBean.describe(objectToMerge).entrySet().stream() .filter({ e -> e.getValue() != null }) .filter({ e -> e.getKey() != "class" }) .filter({ e -> e.getKey() != "metaClass" }) .filter({ e -> !nonMergeableSettings.contains(e.getKey()) }) .forEach { e -> - BeanUtils.setProperty(baseObject, e.getKey(), e.getValue()); + beanUtilsBean.setProperty(baseObject, e.getKey(), e.getValue()); } nonMergeableSettings.forEach({ key -> diff --git a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseMethod.groovy b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseMethod.groovy new file mode 100644 index 0000000..c13be07 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseMethod.groovy @@ -0,0 +1,16 @@ +package ru.pulsar.jenkins.library.configuration + +import com.fasterxml.jackson.annotation.JsonProperty + +enum InitInfobaseMethod { + + @JsonProperty("fromStorage") + FROM_STORAGE, + + @JsonProperty("fromSource") + FROM_SOURCE, + + @JsonProperty("defaultBranchFromStorage") + DEFAULT_BRANCH_FROM_STORAGE + +} diff --git a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy index 6350339..d36a3bf 100644 --- a/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/InitInfobaseOptions.groovy @@ -7,6 +7,15 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription @JsonIgnoreProperties(ignoreUnknown = true) class InitInfobaseOptions implements Serializable { + @JsonPropertyDescription(""" + Способ инициализации информационной базы. + Поддерживается три варианта: + * fromStorage - инициализация информационной базы из хранилища конфигурации; + * fromSource - инициализация информационной базы из исходников конфигурации; + * defaultBranchFromStorage - инициализация основной ветки из хранилища конфигурации, остальных - из исходников конфигурации. + По умолчанию содержит значение "fromStorage".""") + InitInfobaseMethod initMethod = InitInfobaseMethod.FROM_STORAGE; + @JsonPropertyDescription("Запустить миграцию ИБ") boolean runMigration = true @@ -20,7 +29,8 @@ class InitInfobaseOptions implements Serializable { @NonCPS String toString() { return "InitInfobaseOptions{" + - "runMigration=" + runMigration + + "initMethod=" + initMethod + + ", runMigration=" + runMigration + ", additionalInitializationSteps=" + additionalInitializationSteps + '}'; } diff --git a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy index 67a08f2..f623035 100644 --- a/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/JobConfiguration.groovy @@ -1,9 +1,12 @@ package ru.pulsar.jenkins.library.configuration import com.cloudbees.groovy.cps.NonCPS +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonPropertyDescription +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.ioc.ContextRegistry @JsonIgnoreProperties(ignoreUnknown = true) class JobConfiguration implements Serializable { @@ -20,6 +23,9 @@ class JobConfiguration implements Serializable { @JsonPropertyDescription("Включение этапов сборок") StageFlags stageFlags; + @JsonPropertyDescription("Имя ветки по умолчанию. Значение по умолчанию - main.") + String defaultBranch + @JsonPropertyDescription("Идентификаторы сохраненных секретов") Secrets secrets; @@ -53,7 +59,8 @@ class JobConfiguration implements Serializable { return "JobConfiguration{" + "v8version='" + v8version + '\'' + ", srcDir='" + srcDir + '\'' + - ", sourceFormat='" + sourceFormat + + ", sourceFormat=" + sourceFormat + + ", defaultBranch=" + defaultBranch + ", stageFlags=" + stageFlags + ", secrets=" + secrets + ", initInfobaseOptions=" + initInfobaseOptions + @@ -66,6 +73,13 @@ class JobConfiguration implements Serializable { } boolean infobaseFromFiles(){ - return sourceFormat.EDT + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + def env = steps.env(); + String branchName = env.BRANCH_NAME; + def initMethod = initInfobaseOptions.initMethod + + return sourceFormat == SourceFormat.EDT || + (initMethod == InitInfobaseMethod.FROM_SOURCE) || + (initMethod == InitInfobaseMethod.DEFAULT_BRANCH_FROM_STORAGE && branchName != defaultBranch) } } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy b/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy index 32e2cfb..5f11f95 100644 --- a/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/SourceFormat.groovy @@ -1,27 +1,12 @@ package ru.pulsar.jenkins.library.configuration -import com.cloudbees.groovy.cps.NonCPS -import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -@JsonIgnoreProperties(ignoreUnknown = true) -public enum SourceFormat{ +enum SourceFormat { @JsonProperty("edt") EDT, @JsonProperty("designer") DESIGNER - @Override - @NonCPS - String toString() { - return "SourceFormat{" + - "edt='" + EDT + - "designer='" + DESIGNER + - '}'; - } - boolean infobaseFromFiles(){ - return EDT - } - } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy index 410872e..65f84b4 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy @@ -2,6 +2,7 @@ package ru.pulsar.jenkins.library.steps import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.configuration.SourceFormat import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger @@ -26,25 +27,33 @@ class EdtValidate implements Serializable { return } - steps.unstash(DesignerToEdtFormatTransformation.WORKSPACE_ZIP_STASH) - steps.unzip(DesignerToEdtFormatTransformation.WORKSPACE, DesignerToEdtFormatTransformation.WORKSPACE_ZIP) - def env = steps.env(); - def resultFile = "$env.WORKSPACE/$RESULT_FILE" - def workspaceLocation = "$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE" + String workspaceLocation = "$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE" + String projectList; + if (config.sourceFormat == SourceFormat.DESIGNER) { + steps.unstash(DesignerToEdtFormatTransformation.WORKSPACE_ZIP_STASH) + steps.unzip(DesignerToEdtFormatTransformation.WORKSPACE, DesignerToEdtFormatTransformation.WORKSPACE_ZIP) + + projectList = "--project-name-list $DesignerToEdtFormatTransformation.PROJECT_NAME" + } else { + projectList = "--project-list '$config.srcDir'" + } + + def resultFile = "$env.WORKSPACE/$RESULT_FILE" steps.createDir(new File(resultFile).getParent()) Logger.println("Выполнение валидации EDT") - def ringCommand = "ring edt workspace validate --workspace-location '$workspaceLocation' --file '$resultFile' --project-name-list $DesignerToEdtFormatTransformation.PROJECT_NAME" + def ringCommand = "ring edt workspace validate --workspace-location '$workspaceLocation' --file '$resultFile' $projectList" def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru'] steps.withEnv(ringOpts) { steps.catchError { steps.cmd(ringCommand) } } + steps.archiveArtifacts("$DesignerToEdtFormatTransformation.WORKSPACE/.metadata/.log") steps.archiveArtifacts(RESULT_FILE) steps.stash(RESULT_STASH, RESULT_FILE) diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy index 2cbe59f..7f56ecb 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy @@ -2,8 +2,10 @@ package ru.pulsar.jenkins.library.steps import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.configuration.SourceFormat import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger +import ru.pulsar.jenkins.library.utils.VRunner class InitFromFiles implements Serializable { @@ -23,17 +25,25 @@ class InitFromFiles implements Serializable { return } + steps.installLocalDependencies(); + Logger.println("Распаковка файлов") - - def env = steps.env(); - def srcDir = "$env.WORKSPACE/$EdtToDesignerFormatTransformation.CONFIGURATION_DIR" + String srcDir; - steps.unstash(EdtToDesignerFormatTransformation.CONFIGURATION_ZIP_STASH) - steps.unzip(srcDir, EdtToDesignerFormatTransformation.CONFIGURATION_ZIP) + if (config.sourceFormat == SourceFormat.EDT) { + 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; + } Logger.println("Выполнение загрузки конфигурации из файлов") - def initCommand = "oscript_modules/bin/vrunner init-dev --src $srcDir --ibconnection \"/F./build/ib\"" + String vrunnerPath = VRunner.getVRunnerPath(); + def initCommand = "$vrunnerPath init-dev --src $srcDir --ibconnection \"/F./build/ib\"" steps.cmd(initCommand) } } diff --git a/test/integration/groovy/jobConfigurationTest.groovy b/test/integration/groovy/jobConfigurationTest.groovy index bffef3f..e3ded0b 100644 --- a/test/integration/groovy/jobConfigurationTest.groovy +++ b/test/integration/groovy/jobConfigurationTest.groovy @@ -73,5 +73,6 @@ class jobConfigurationTest { def run = rule.buildAndAssertSuccess(workflowJob) rule.assertLogContains("v8version='8.3.12.1500'", run) rule.assertLogContains("sonarScannerToolName='sonar-scanner'", run) + rule.assertLogContains("initMethod=FROM_SOURCE", run) } } \ No newline at end of file diff --git a/test/integration/resources/jobConfiguration.json b/test/integration/resources/jobConfiguration.json index b776078..e027b9f 100644 --- a/test/integration/resources/jobConfiguration.json +++ b/test/integration/resources/jobConfiguration.json @@ -1,3 +1,6 @@ { - "v8version": "8.3.12.1500" + "v8version": "8.3.12.1500", + "initInfobase": { + "initMethod": "fromSource" + } } \ No newline at end of file diff --git a/vars/initFromStorage.groovy b/vars/initFromStorage.groovy index b4f9a87..fb8cd69 100644 --- a/vars/initFromStorage.groovy +++ b/vars/initFromStorage.groovy @@ -4,6 +4,10 @@ import ru.pulsar.jenkins.library.utils.VersionParser def call(JobConfiguration jobConfiguration) { + printLocation() + + installLocalDependencies(); + def storageVersion = VersionParser.storage() def storageVersionParameter = storageVersion == "" ? "" : "--storage-ver $storageVersion" diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 60e0154..c0372ab 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -1,6 +1,7 @@ /* groovylint-disable NestedBlockDepth */ import groovy.transform.Field import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.configuration.SourceFormat import java.util.concurrent.TimeUnit @@ -55,7 +56,7 @@ void call() { } when { beforeAgent true - expression { config.infobaseFromFiles() } + expression { config.stageFlags.needInfobase() && config.sourceFormat == SourceFormat.EDT } } steps { edtToDesignerFormatTransformation config @@ -66,8 +67,6 @@ void call() { steps { printLocation() - installLocalDependencies() - createDir('build/out') script { @@ -115,7 +114,7 @@ void call() { expression { config.sourceFormat.DESIGNER && config.stageFlags.edtValidate} } steps { - edtTransform config + designerToEdtFormatTransformation config } } } From 648d33598f4a3262ad046fd81681b0a154ec9972 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 1 Nov 2021 18:19:38 +0300 Subject: [PATCH 74/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D0=B0=D1=82=D0=B0=20=D0=B8=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy b/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy index c9764e8..bac8532 100644 --- a/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy +++ b/src/ru/pulsar/jenkins/library/steps/SonarScanner.groovy @@ -2,6 +2,7 @@ package ru.pulsar.jenkins.library.steps import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.configuration.SourceFormat import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger import ru.pulsar.jenkins.library.utils.VersionParser @@ -13,7 +14,7 @@ class SonarScanner implements Serializable { SonarScanner(JobConfiguration config) { this.config = config - if (config.sourceFormat.EDT){ + if (config.sourceFormat == SourceFormat.EDT){ this.rootFile = "$config.srcDir/src/Configuration/Configuration.mdo" } else { this.rootFile = "$config.srcDir/Configuration.xml" @@ -43,10 +44,10 @@ class SonarScanner implements Serializable { String sonarCommand = "$sonarScannerBinary -Dsonar.branch.name=$env.BRANCH_NAME" - String configurationVersion = "" - if (config.sourceFormat.EDT) { + String configurationVersion + if (config.sourceFormat == SourceFormat.EDT) { configurationVersion = VersionParser.edt(rootFile) - }else { + } else { configurationVersion = VersionParser.configuration(rootFile) } From ec03278f057425560fc5c444b037ad9e1073709f Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 2 Nov 2021 18:05:04 +0300 Subject: [PATCH 75/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE=D0=B1=D1=80=D0=B0=D1=89?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=20SourceFormat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../library/steps/EdtToDesignerFormatTransformation.groovy | 3 ++- vars/pipeline1C.groovy | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f58cab4..5f3fff7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ .gradle/ build/ bin/ +lib/ *.iml diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index 7d3b7bd..365ac92 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -3,6 +3,7 @@ package ru.pulsar.jenkins.library.steps import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.configuration.SourceFormat import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Constants import ru.pulsar.jenkins.library.utils.Logger @@ -25,7 +26,7 @@ class EdtToDesignerFormatTransformation implements Serializable { Logger.printLocation() - if (!config.sourceFormat.EDT) { + if (config.sourceFormat != SourceFormat.EDT) { Logger.println("SRC is not in EDT format. No transform is needed.") return } diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index c0372ab..6aed2b6 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -111,7 +111,7 @@ void call() { } when { beforeAgent true - expression { config.sourceFormat.DESIGNER && config.stageFlags.edtValidate} + expression { config.sourceFormat == SourceFormat.DESIGNER && config.stageFlags.edtValidate} } steps { designerToEdtFormatTransformation config From ad6d1d5d7875db85f8a1bb8bf6e47f7085ee8c1e Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 2 Nov 2021 18:10:06 +0300 Subject: [PATCH 76/99] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=B4?= =?UTF-8?q?=D0=B2=D0=BE=D0=B9=D0=BD=D0=BE=D0=B9=20printLocation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 6aed2b6..c9f5b43 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -65,8 +65,6 @@ void call() { stage('Создание ИБ') { steps { - printLocation() - createDir('build/out') script { From 907692ee9be4a5e910f8ae6559dc1f0728329c48 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 2 Nov 2021 20:32:36 +0300 Subject: [PATCH 77/99] =?UTF-8?q?=D0=9A=D0=B0=D0=BD=D0=BE=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=83=D1=82=D0=B5=D0=B9=20=D0=BA=20=D0=BF=D1=80=D0=BE=D0=B5?= =?UTF-8?q?=D0=BA=D1=82=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/steps/EdtToDesignerFormatTransformation.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index 365ac92..b87745a 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -34,7 +34,7 @@ class EdtToDesignerFormatTransformation implements Serializable { def env = steps.env(); def srcDir = config.srcDir - def projectDir = "$env.WORKSPACE/$srcDir" + def projectDir = new File("$env.WORKSPACE/$srcDir").getCanonicalPath() def workspaceDir = "$env.WORKSPACE/$WORKSPACE" def configurationRoot = "$env.WORKSPACE/$CONFIGURATION_DIR" From 792dbf3cdfbb950aa250a19d2e3b3b4546c51031 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 2 Nov 2021 20:50:05 +0300 Subject: [PATCH 78/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BF=D0=B0=D1=80=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D1=80=D0=BE=D0=B2=20=D0=BC=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/steps/EdtToDesignerFormatTransformation.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index b87745a..871f89f 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -43,7 +43,7 @@ class EdtToDesignerFormatTransformation implements Serializable { Logger.println("Конвертация исходников из формата EDT в формат Конфигуратора") - def ringCommand = "ring edt workspace export --configuration-files '$configurationRoot' --project $projectDir --workspace-location '$workspaceDir'" + def ringCommand = "ring edt workspace export --workspace-location '$workspaceDir' --project '$projectDir' --configuration-files '$configurationRoot'" def ringOpts =[Constants.DEFAULT_RING_OPTS] steps.withEnv(ringOpts) { From 3a532ad3658c42f1a0ea94f0a367b237d778b1fb Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 3 Nov 2021 17:21:22 +0300 Subject: [PATCH 79/99] =?UTF-8?q?=D0=AF=D0=B2=D0=BD=D0=BE=D0=B5=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=D0=BE=D1=80=D0=BA=D1=81?= =?UTF-8?q?=D0=BF=D0=B5=D0=B9=D1=81=D0=B0=20=D0=B8=20=D0=B2=D1=8B=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=B7=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/IStepExecutor.groovy | 6 ++++++ .../jenkins/library/StepExecutor.groovy | 19 +++++++++++++++++++ .../EdtToDesignerFormatTransformation.groovy | 3 +++ 3 files changed, 28 insertions(+) diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index c8d36c7..c2bb441 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -33,8 +33,14 @@ interface IStepExecutor { EnvironmentAction env() + def dir(String path, Closure body) + void createDir(String path) + void deleteDir() + + void deleteDir(String path) + def withEnv(List strings, Closure body) def archiveArtifacts(String path) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 8bd9348..602d662 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -79,6 +79,25 @@ class StepExecutor implements IStepExecutor { steps.createDir(path) } + @Override + def dir(String path, Closure body) { + steps.dir(path) { + body() + } + } + + @Override + void deleteDir() { + steps.deleteDir() + } + + @Override + void deleteDir(String path) { + steps.dir(path) { + steps.deleteDir() + } + } + @Override def withEnv(List strings, Closure body) { steps.withEnv(strings) { diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index 871f89f..f97ef15 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -38,6 +38,9 @@ class EdtToDesignerFormatTransformation implements Serializable { def workspaceDir = "$env.WORKSPACE/$WORKSPACE" def configurationRoot = "$env.WORKSPACE/$CONFIGURATION_DIR" + steps.deleteDir(workspaceDir) + steps.deleteDir(configurationRoot) + steps.createDir(workspaceDir) steps.createDir(configurationRoot) From 6dc9bb759fd156d16957e0fdcc8505923f8fe205 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Wed, 3 Nov 2021 18:03:35 +0300 Subject: [PATCH 80/99] =?UTF-8?q?=D0=90=D1=80=D1=85=D0=B8=D0=B2=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B0=20=D0=B2=D0=BE?= =?UTF-8?q?=D1=80=D0=BA=D1=81=D0=BF=D0=B5=D0=B9=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/steps/EdtToDesignerFormatTransformation.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index f97ef15..e257424 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -50,7 +50,10 @@ class EdtToDesignerFormatTransformation implements Serializable { def ringOpts =[Constants.DEFAULT_RING_OPTS] steps.withEnv(ringOpts) { - steps.cmd(ringCommand) + steps.catchError { + steps.cmd(ringCommand) + } + steps.archiveArtifacts("$WORKSPACE/.metadata/.log") } steps.zip(CONFIGURATION_DIR, CONFIGURATION_ZIP) From 8327efc2648635f68cf4078f942064943892d013 Mon Sep 17 00:00:00 2001 From: Tymko Oleg Date: Wed, 3 Nov 2021 23:58:55 +0700 Subject: [PATCH 81/99] =?UTF-8?q?feat:=20#28=20=D0=9F=D0=BE=D0=B4=D0=B4?= =?UTF-8?q?=D0=B5=D0=B6=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BF=D1=80=D0=BE=D0=BF=D1=83=D1=81=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?syntax-check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/globalConfiguration.json | 1 + resources/schema.json | 4 ++++ .../jenkins/library/configuration/SyntaxCheckOptions.groovy | 6 ++++++ vars/syntaxCheck.groovy | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/resources/globalConfiguration.json b/resources/globalConfiguration.json index c2c1ded..852d215 100644 --- a/resources/globalConfiguration.json +++ b/resources/globalConfiguration.json @@ -31,6 +31,7 @@ "syntaxCheck": { "groupErrorsByMetadata": true, "pathToJUnitReport": "./build/out/jUnit/syntax.xml", + "exceptionFile": "./tools/syntax-check-exception-file.txt", "checkModes": [ "-ThinClient", "-WebClient", diff --git a/resources/schema.json b/resources/schema.json index 7a61217..b14f2e6 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -127,6 +127,10 @@ "type" : "string" } }, + "exceptionFile" : { + "type" : "string", + "description" : "Путь к файлу с указанием пропускаемых ошибок.\n Формат файла: в каждой строке файла указан текст пропускаемого исключения или его часть\n Кодировка: UTF-8\n " + }, "vrunnerSettings" : { "type" : "string", "description" : "Путь к конфигурационному файлу vanessa-runner.\n По умолчанию содержит значение \"./tools/vrunner.json\".\n " diff --git a/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy b/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy index 6edbf9b..ded2357 100644 --- a/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/SyntaxCheckOptions.groovy @@ -20,6 +20,12 @@ class SyntaxCheckOptions implements Serializable { @JsonPropertyDescription("Режимы проверки конфигурации") String[] checkModes + @JsonPropertyDescription("""Путь к файлу с указанием пропускаемых ошибок. + Формат файла: в каждой строке файла указан текст пропускаемого исключения или его часть + Кодировка: UTF-8 + """) + String exceptionFile = "./tools/syntax-check-exception-file.txt" + @JsonPropertyDescription("""Путь к конфигурационному файлу vanessa-runner. По умолчанию содержит значение "./tools/vrunner.json". """) diff --git a/vars/syntaxCheck.groovy b/vars/syntaxCheck.groovy index 393a511..8c119b0 100644 --- a/vars/syntaxCheck.groovy +++ b/vars/syntaxCheck.groovy @@ -51,6 +51,10 @@ def call(JobConfiguration config) { command += " --mode $checkModes" } + if (!options.exceptionFile.empty && fileExists(options.exceptionFile)) { + command += " --exception-file $options.exceptionFile" + } + // Запуск синтакс-проверки cmd(command, true) From d2eea9591c848ec8b8213d68f431e88ebf2ecdfa Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Thu, 4 Nov 2021 11:24:48 +0300 Subject: [PATCH 82/99] Update README.md --- README.md | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 37e6b6f..37115f4 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,20 @@ 1. Для шага подготовки требуется любой агент с меткой `agent`. 1. Для запуска шага анализа SonarQube требуется агент с меткой `sonar`. -1. Для запуска шага валидации EDT требуется агент с меткой `edt` (для собственно валидации) и агент с меткой `oscript` (для трансформации результатов с помощью библиотеки [stebi](https://github.com/Stepa86/stebi)). +1. Для запуска шагов, работающих с EDT (валидация, трансформация формата исходников) требуется агент с меткой `edt` и агент с меткой `oscript` (для трансформации результатов с помощью библиотеки [stebi](https://github.com/Stepa86/stebi)). 1. Для запуска шагов, работающих с 1С (подготовка, синтаксический контроль и т.д.) требуется агент с меткой, совпадающей со значением в поле `v8version` файла конфигурации. -1. В качестве ИБ используется файловая база, создаваемая в `./build/ib` на основании конфигурации из хранилища без пользователей. При необходимости вы можете создать пользователей на фазе инициализации ИБ. -1. Stage "Дымовые тесты" пока пустой. -1. Запуск `vrunner` на текущий момент происходит из локального каталога `oscript_modules`. Предполагается наличие в корне репозитория файла `packagedef`, в котором бы была указана зависимость от `vanessa-runner` +1. В качестве ИБ используется файловая база, создаваемая в каталоге `./build/ib`. При необходимости вы можете создать пользователей на фазе инициализации ИБ. +1. Шаг "Дымовые тесты" пока пустой. ## Возможности -1. Все шаги можно запустить на базе docker-образов из форка репозитория onec-docker. См. [памятку по слоям и последовательности сборки](https://github.com/firstBitSemenovskaya/onec-docker/blob/feature/first-bit/Layers.md) -1. Подготовка информационной базы по версии из хранилища конфигурации. +1. Все шаги можно запустить на базе docker-образов из форка репозитория onec-docker. См. [памятку по слоям и последовательности сборки](https://github.com/firstBitSemenovskaya/onec-docker/blob/feature/first-bit/Layers.md). +1. Поддержка как формата выгрузки из Конфигуратора, так и формата EDT. +1. Подготовка информационной базы по версии из хранилища конфигурации, из исходных файлов конфигурации, комбинированный режим (основная ветка - из хранилища, остальные - из исходников). 1. Запуск ИБ в режиме выполнения обработчиков обновления БСП. 1. Дополнительные шаги инициализации данных в ИБ. -1. Трансформация кода из формата конфигуратора в формат EDT (только если включен шаг `edtValidate`). +1. Трансформация кода из формата конфигуратора в формат EDT. +1. Трансформация кода из формата EDT в формат конфигуратора. 1. Запуск BDD сценариев с сохранением результатов в формате Allure. 1. Запуск синтаксического контроля средствами конфигуратора и сохранение результатов в виде отчета jUnit. 1. Запуск валидации проекта средствами EDT и конвертация отчета в формате generic issues. @@ -99,23 +100,34 @@ pipeline1C() В библиотеке применяется принцип "соглашения по конфигурации" (convention over configuration): конфигурационный файл содержит ряд настроек "по умолчанию". При соблюдении определенных правил структуры репозитория можно сократить -количество переопределений конфигурационного файла до минимума. +количество переопределений конфигурационного файла до минимума. Ниже представлены имеющиеся соглашения и способы их переопределения. * Общее: - * В качестве маски версии платформы используется строка "8.3". - * Исходники конфигурации ожидаются в каталоге `src/cf`. - * TODO: Имена "секретов" (jenkins credentials) по умолчанию высчитываются как `GROUP_REPO_KEY`, где `GROUP` и `REPO` - это группа проектов и имя проектов (например, `firstBitSemenovskaya` и `jenkins-lib`), а `KEY` - ключ секрета: - * `STORAGE_PATH` - путь к хранилищу конфигурации; - * `STORAGE_USER` - параметры авторизации в хранилище вида "username with password". - * Все "шаги" по умолчанию выключены. + * В качестве маски версии платформы используется строка "8.3" (`v8version`). + * Исходники конфигурации ожидаются в каталоге `src/cf` (`srcDir`). + * Формат исходников - выгрузка из Конфигуратора (`sourceFormat`). + * Ветка по умолчанию (для комбинированного режима загрузки конфигурации) - "main" (`defaultBranch`). + * TODO: Имена "секретов" (jenkins credentials, `secrets`) по умолчанию высчитываются как `GROUP_REPO_KEY`, где `GROUP` и `REPO` - это группа проектов и имя проектов (например, `firstBitSemenovskaya` и `jenkins-lib`), а `KEY` - ключ секрета: + * `STORAGE_PATH` - путь к хранилищу конфигурации (`secrets` -> `storagePath`); + * `STORAGE_USER` - параметры авторизации в хранилище вида "username with password" (`secrets` -> `storage`). + * Все "шаги" по умолчанию выключены (`stages`). * Результаты в формате `allure` ожидаются в каталоге `build/out/allure` или его подкаталогах. * Инициализация: - * Если включен шаг `initSteps`, то будет выполняться запуск ИБ с целью запуска обработчиков обновления из БСП. (`initInfobase` -> `runMigration`) + * Информационная база инициализируется только в том случае, если в сборочной линии включены шаги, работающие с базой (например, `bdd` или `syntaxCheck`). + * Информационная база инициализируется конфигурацией из хранилища конфигурации (`initInfobase` -> `initMethod`). + * После загрузки конфигурации в ИБ будет выполняться запуск ИБ с целью запуска обработчиков обновления из БСП (`initInfobase` -> `runMigration`). * Если в настройках шага инициализации не заполнен массив дополнительных шагов миграции (`initInfobase` -> `additionalInitializationSteps`), но в каталоге `tools` присутствуют файлы с именами, удовлетворяющими шаблону `vrunner.init*.json`, то автоматически выполняется запуск `vrunner vanessa` с передачей найденных файлов в качестве значения настроек (параметр `--settings`) в порядке лексиграфической сортировки имен файлов. * BDD: * Если в конфигурационном файле проекта не заполнена настройка `bdd` -> `vrunnerSteps`, то автоматически выполняется запуск `vrunner vanessa --settings tools/vrunner.json`. * Синтаксический контроль: - * Если в репозитории существует файл `tools/vrunner.json`, то синтаксический контроль конфигурации с помощью конфигуратора будет выполняться с передачей файла в параметры запуска `vrunner syntax-check --settings tools/vrunner.json`. - * TODO: Значение параметра `--mode` из конфигурационного файла vrunner имеют приоритет над `syntaxCheck` -> `checkModes`. Значение из `jobConfiguration.json` передается только в том случае, если параметр отсутствует в конфигурационном файле `vrunner`. + * Если в репозитории существует файл `tools/vrunner.json`, то синтаксический контроль конфигурации с помощью конфигуратора будет выполняться с передачей файла в параметры запуска `vrunner syntax-check --settings tools/vrunner.json` (`syntaxCheck` -> `vrunnerSettings`). + * Применяется группировка ошибок по метаданным (`syntaxCheck` -> `groupErrorsByMetadata`). + * Выгрузка результатов в формат `jUnit` осуществляется в файл `./build/out/jUnit/syntax.xml` (`syntaxCheck` -> `pathToJUnitReport`). + * Если в репозитории существует файл `./tools/syntax-check-exception-file.txt`, то команде запука синтаксического контроля конфигурации данный файл будет передаваться как файл с исключениями сообщений об ошибках (параметр `--exception-file`) (`syntaxCheck` -> `exceptionFile`). + * Конфигурационный файл по умолчанию уже содержит ряд "режимов проверки" для синтаксического контроля конфигурации (`syntaxCheck` -> `checkModes`). * Трансформация результатов валидации EDT: - * По умолчанию из результатов анализа исключаются замечания, сработавшие на модулях с включенным запретом редактирования (желтый куб с замком) + * По умолчанию из результатов анализа исключаются замечания, сработавшие на модулях с включенным запретом редактирования (желтый куб с замком) (параметры `resultsTransform` -> `removeSupport` и `resultsTransform` -> `supportLevel`). +* Анализ SonarQube: + * Предполагается наличие единственной настройки `SonarQube installation` (`sonarqube` -> `sonarQubeInstallation`). + * Используется `sonar-scanner` из переменной окружения `PATH` (`sonarqube` -> `useSonarScannerFromPath`). + * Если использование `sonar-scanner` из переменной окружения `PATH` выключено, предполагается наличие настроенного глобального инструмента `SonarQube Scanner` с идентификатором инструмента `sonar-scanner` (`sonarqube` -> `sonarScannerToolName`). From 2a3c49b570e3593b0994947967c9059864cd7703 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Thu, 4 Nov 2021 11:27:23 +0300 Subject: [PATCH 83/99] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 37115f4..07a9f3e 100644 --- a/README.md +++ b/README.md @@ -130,4 +130,6 @@ pipeline1C() * Анализ SonarQube: * Предполагается наличие единственной настройки `SonarQube installation` (`sonarqube` -> `sonarQubeInstallation`). * Используется `sonar-scanner` из переменной окружения `PATH` (`sonarqube` -> `useSonarScannerFromPath`). - * Если использование `sonar-scanner` из переменной окружения `PATH` выключено, предполагается наличие настроенного глобального инструмента `SonarQube Scanner` с идентификатором инструмента `sonar-scanner` (`sonarqube` -> `sonarScannerToolName`). + * Если использование `sonar-scanner` из переменной окружения `PATH` выключено, предполагается наличие настроенного глобального инструмента `SonarQube Scanner` с идентификатором инструмента `sonar-scanner` (`sonarqube` -> `sonarScannerToolName`). + * Версия из корня конфигурации передается утилите `sonar-scanner` как значение параметра `sonar.projectVersion=$configurationVersion`. + * Если выполнялась валидация EDT, результаты валидации в формате `generic issues` передаются утилите `sonar-scanner` как значение параметра `sonar.externalIssuesReportPaths`. From a1d20e3b71f36709ca4fb8243a6a77d420d9a054 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 4 Nov 2021 15:32:51 +0300 Subject: [PATCH 84/99] =?UTF-8?q?=D0=90=D0=B1=D1=81=D0=BE=D0=BB=D1=8E?= =?UTF-8?q?=D1=82=D0=BD=D1=8B=D0=B9=20=D0=BF=D1=83=D1=82=D1=8C=20=D0=BA=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D1=83=20=D0=B2=20edt=20val?= =?UTF-8?q?idate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy index 65f84b4..ac930d4 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy @@ -38,7 +38,8 @@ class EdtValidate implements Serializable { projectList = "--project-name-list $DesignerToEdtFormatTransformation.PROJECT_NAME" } else { - projectList = "--project-list '$config.srcDir'" + String projectDir = new File("$env.WORKSPACE/$config.srcDir").getCanonicalPath() + projectList = "--project-list '$projectDir'" } def resultFile = "$env.WORKSPACE/$RESULT_FILE" From 9fc54dc240b0b5178cc75adfdc76dbdc9e8febe1 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 4 Nov 2021 15:37:53 +0300 Subject: [PATCH 85/99] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=B0?= =?UTF-8?q?=D0=BD=D0=B4=D1=8B=20=D0=BF=D0=BE=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8E=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/steps/DesignerToEdtFormatTransformation.groovy | 2 +- .../library/steps/EdtToDesignerFormatTransformation.groovy | 3 --- src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy index 56105d3..bfee6f0 100644 --- a/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy @@ -34,7 +34,7 @@ class DesignerToEdtFormatTransformation implements Serializable { def workspaceDir = "$env.WORKSPACE/$WORKSPACE" def configurationRoot = new File(env.WORKSPACE, config.srcDir).getAbsolutePath() - steps.createDir(workspaceDir) + steps.deleteDir(workspaceDir) Logger.println("Конвертация исходников из формата конфигуратора в формат EDT") diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index e257424..eb9f8f8 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -41,9 +41,6 @@ class EdtToDesignerFormatTransformation implements Serializable { steps.deleteDir(workspaceDir) steps.deleteDir(configurationRoot) - steps.createDir(workspaceDir) - steps.createDir(configurationRoot) - Logger.println("Конвертация исходников из формата EDT в формат Конфигуратора") def ringCommand = "ring edt workspace export --workspace-location '$workspaceDir' --project '$projectDir' --configuration-files '$configurationRoot'" diff --git a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy index ac930d4..4f30a22 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy @@ -43,7 +43,6 @@ class EdtValidate implements Serializable { } def resultFile = "$env.WORKSPACE/$RESULT_FILE" - steps.createDir(new File(resultFile).getParent()) Logger.println("Выполнение валидации EDT") From db645664b050b1e27312d47fc337846044879c7b Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 4 Nov 2021 15:38:27 +0300 Subject: [PATCH 86/99] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=20catchErr?= =?UTF-8?q?or=20=D0=BF=D1=80=D0=B8=20=D0=BA=D0=BE=D0=BD=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/steps/EdtToDesignerFormatTransformation.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index eb9f8f8..a925b64 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -47,10 +47,7 @@ class EdtToDesignerFormatTransformation implements Serializable { def ringOpts =[Constants.DEFAULT_RING_OPTS] steps.withEnv(ringOpts) { - steps.catchError { - steps.cmd(ringCommand) - } - steps.archiveArtifacts("$WORKSPACE/.metadata/.log") + steps.cmd(ringCommand) } steps.zip(CONFIGURATION_DIR, CONFIGURATION_ZIP) From a9fc4ad9b5f8ea0fe2ba2bf856c4aaf37a734d65 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 4 Nov 2021 17:21:54 +0300 Subject: [PATCH 87/99] =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=87=D0=B5=D1=82=20sr?= =?UTF-8?q?cDir=20=D0=B4=D0=BB=D1=8F=20stebi=20=D1=81=20=D1=83=D1=87=D0=B5?= =?UTF-8?q?=D1=82=D0=BE=D0=BC=20EDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/steps/ResultsTransformer.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/ResultsTransformer.groovy b/src/ru/pulsar/jenkins/library/steps/ResultsTransformer.groovy index 890466b..22c261a 100644 --- a/src/ru/pulsar/jenkins/library/steps/ResultsTransformer.groovy +++ b/src/ru/pulsar/jenkins/library/steps/ResultsTransformer.groovy @@ -2,9 +2,12 @@ package ru.pulsar.jenkins.library.steps import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.configuration.SourceFormat import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger +import java.nio.file.Paths + class ResultsTransformer implements Serializable { public static final String RESULT_STASH = 'edt-generic-issue' @@ -35,11 +38,12 @@ class ResultsTransformer implements Serializable { def edtValidateFile = "$env.WORKSPACE/$EdtValidate.RESULT_FILE" def genericIssueFile = "$env.WORKSPACE/$RESULT_FILE" - steps.cmd("stebi convert $edtValidateFile $genericIssueFile $config.srcDir") + String srcDir = config.sourceFormat == SourceFormat.DESIGNER ? config.srcDir : Paths.get(config.srcDir, "src") + steps.cmd("stebi convert $edtValidateFile $genericIssueFile $srcDir") if (config.resultsTransformOptions.removeSupport) { def supportLevel = config.resultsTransformOptions.supportLevel - steps.cmd("stebi transform --remove_support $supportLevel --src $config.srcDir $genericIssueFile") + steps.cmd("stebi transform --remove_support $supportLevel --src $srcDir $genericIssueFile") } steps.archiveArtifacts(RESULT_FILE) From 30d0e150df12753e305a71c7363f209b01645f68 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Thu, 4 Nov 2021 17:26:10 +0300 Subject: [PATCH 88/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=20=D1=88=D0=B0=D0=B3=D0=B0=20=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D1=81=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2?= =?UTF-8?q?=D0=BD=D1=83=D1=82=D1=80=D1=8C=20=D1=88=D0=B0=D0=B3=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4=D0=B0=D1=86=D0=B8=D0=B5?= =?UTF-8?q?=D0=B9=20=D0=95=D0=94=D0=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vars/pipeline1C.groovy | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index c9f5b43..7f5222d 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -121,15 +121,28 @@ void call() { stage('Проверка качества') { parallel { stage('EDT контроль') { - agent { - label 'edt' - } when { beforeAgent true expression { config.stageFlags.edtValidate } } - steps { - edtValidate config + stages { + stage('Валидация EDT') { + agent { + label 'edt' + } + steps { + edtValidate config + } + } + + stage('Трансформация результатов') { + agent { + label 'oscript' + } + steps { + transform config + } + } } } @@ -176,19 +189,6 @@ void call() { } } - stage('Трансформация результатов') { - agent { - label 'oscript' - } - when { - beforeAgent true - expression { config.stageFlags.edtValidate } - } - steps { - transform config - } - } - stage('SonarQube') { agent { label 'sonar' From f67fc1f76962c265fe5834f25b75b3479ab4e47e Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Fri, 5 Nov 2021 15:50:11 +0300 Subject: [PATCH 89/99] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 07a9f3e..5fec5f8 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ pipeline1C() * Инициализация: * Информационная база инициализируется только в том случае, если в сборочной линии включены шаги, работающие с базой (например, `bdd` или `syntaxCheck`). * Информационная база инициализируется конфигурацией из хранилища конфигурации (`initInfobase` -> `initMethod`). + * Если выбран метод инициализации ИБ из хранилища конфигурации и в каталоге исходников есть файл `VERSION` (артефакт от работы утилиты `gitsync`), то из хранилища будет загружена версия конфигурации с номером из файла `VERSION`. * После загрузки конфигурации в ИБ будет выполняться запуск ИБ с целью запуска обработчиков обновления из БСП (`initInfobase` -> `runMigration`). * Если в настройках шага инициализации не заполнен массив дополнительных шагов миграции (`initInfobase` -> `additionalInitializationSteps`), но в каталоге `tools` присутствуют файлы с именами, удовлетворяющими шаблону `vrunner.init*.json`, то автоматически выполняется запуск `vrunner vanessa` с передачей найденных файлов в качестве значения настроек (параметр `--settings`) в порядке лексиграфической сортировки имен файлов. * BDD: From a8f2c0a1b474766f44b1f11617471c465ab9ca79 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Sat, 6 Nov 2021 12:42:42 +0300 Subject: [PATCH 90/99] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5fec5f8..3bae29b 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,8 @@ pipeline1C() * Информационная база инициализируется только в том случае, если в сборочной линии включены шаги, работающие с базой (например, `bdd` или `syntaxCheck`). * Информационная база инициализируется конфигурацией из хранилища конфигурации (`initInfobase` -> `initMethod`). * Если выбран метод инициализации ИБ из хранилища конфигурации и в каталоге исходников есть файл `VERSION` (артефакт от работы утилиты `gitsync`), то из хранилища будет загружена версия конфигурации с номером из файла `VERSION`. +* Первичный запуск информационной базы: + * Если информационная база нужна для запуска в режиме "Предприятие" (например, для шагов `bdd` или `smoke`), то будет запущен шаг "Миграция ИБ". * После загрузки конфигурации в ИБ будет выполняться запуск ИБ с целью запуска обработчиков обновления из БСП (`initInfobase` -> `runMigration`). * Если в настройках шага инициализации не заполнен массив дополнительных шагов миграции (`initInfobase` -> `additionalInitializationSteps`), но в каталоге `tools` присутствуют файлы с именами, удовлетворяющими шаблону `vrunner.init*.json`, то автоматически выполняется запуск `vrunner vanessa` с передачей найденных файлов в качестве значения настроек (параметр `--settings`) в порядке лексиграфической сортировки имен файлов. * BDD: From e4b212741e9ef68fe876b3f0966033fd98dc608e Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Sat, 6 Nov 2021 14:26:28 +0300 Subject: [PATCH 91/99] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3bae29b..054225c 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,8 @@ pipeline1C() * `STORAGE_PATH` - путь к хранилищу конфигурации (`secrets` -> `storagePath`); * `STORAGE_USER` - параметры авторизации в хранилище вида "username with password" (`secrets` -> `storage`). * Все "шаги" по умолчанию выключены (`stages`). + * Если в корне репозитория существует файл `packagedef`, то в шагах, работающих с информационной базой, будет выполнена попытка установки локальных зависимостей средствами `opm`. + * Если после установки локальных зависимостей в каталоге `oscript_modules/bin` сушествует файл `vrunner`, то для выполнения команд работы с информационной базой будет использоваться он, а не глобально установленный `vrunner` из `PATH`. * Результаты в формате `allure` ожидаются в каталоге `build/out/allure` или его подкаталогах. * Инициализация: * Информационная база инициализируется только в том случае, если в сборочной линии включены шаги, работающие с базой (например, `bdd` или `syntaxCheck`). From 80141227598c167e28839bcafb880b7c383038bc Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 13:32:00 +0300 Subject: [PATCH 92/99] =?UTF-8?q?Fix=20#23,=20Fix=20#29.=20=D0=92=D0=BE?= =?UTF-8?q?=D0=B7=D0=B2=D1=80=D0=B0=D1=82=20=D0=BF=D1=83=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B8,=20=D0=B5=D1=81?= =?UTF-8?q?=D0=BB=D0=B8=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=BD=D0=B5=20=D1=81?= =?UTF-8?q?=D1=83=D1=89=D0=B5=D1=81=D1=82=D0=B2=D1=83=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/utils/VersionParser.groovy | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy b/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy index 5880f33..7183967 100644 --- a/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy +++ b/src/ru/pulsar/jenkins/library/utils/VersionParser.groovy @@ -10,26 +10,26 @@ class VersionParser implements Serializable { final static VERSION_REGEXP = ~/(?i)(.*)<\/version>/ static String configuration(rootFile = 'src/cf/Configuration.xml') { - - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - - def configurationText = steps.readFile(rootFile, 'UTF-8'); - return version(configurationText, VERSION_REGEXP) + return extractVersionFromFile(rootFile, VERSION_REGEXP) } static String edt(rootFile = 'src/Configuration/Configuration.mdo') { - - IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - - def configurationText = steps.readFile(rootFile, 'UTF-8'); - return version(configurationText, VERSION_REGEXP) + return extractVersionFromFile(rootFile, VERSION_REGEXP) } static String storage(versionFile = 'src/cf/VERSION') { + return extractVersionFromFile(versionFile, VERSION_REGEXP) + } + + private static String extractVersionFromFile(String filePath, Pattern regexp) { IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - def storageVersionText = steps.readFile(versionFile, 'UTF-8') - return version(storageVersionText, VERSION_REGEXP) + if (!steps.fileExists(filePath)) { + return "" + } + + def configurationText = steps.readFile(filePath, 'UTF-8'); + return version(configurationText, regexp) } @NonCPS From a94909ff6e649ab3ea7a7bfbc31f804292d25a5c Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 13:44:26 +0300 Subject: [PATCH 93/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B8=D0=B7=20=D1=85=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=BB=D0=B8=D1=89=D0=B0=20=D0=B2=20=D0=BE=D1=82?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BA=D0=BB=D0=B0?= =?UTF-8?q?=D1=81=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/IStepExecutor.groovy | 3 ++ .../jenkins/library/StepExecutor.groovy | 8 +++ .../library/steps/InitFromStorage.groovy | 50 +++++++++++++++++++ vars/initFromStorage.groovy | 30 +++-------- 4 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index c2bb441..53af9f4 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -1,5 +1,6 @@ package ru.pulsar.jenkins.library +import org.jenkinsci.plugins.credentialsbinding.MultiBinding import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction @@ -29,6 +30,8 @@ interface IStepExecutor { void tool(String toolName) + def withCredentials(List bindings, Closure body) + void withSonarQubeEnv(String installationName, Closure body) EnvironmentAction env() diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 602d662..f61b12b 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,5 +1,6 @@ package ru.pulsar.jenkins.library +import org.jenkinsci.plugins.credentialsbinding.MultiBinding import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction import ru.yandex.qatools.allure.jenkins.config.ResultsConfig @@ -69,6 +70,13 @@ class StepExecutor implements IStepExecutor { } } + @Override + def withCredentials(List bindings, Closure body) { + steps.withCredentials(bindings) { + body() + } + } + @Override EnvironmentAction env() { return steps.env diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy new file mode 100644 index 0000000..48537d1 --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy @@ -0,0 +1,50 @@ +package ru.pulsar.jenkins.library.steps + +import org.jenkinsci.plugins.credentialsbinding.impl.StringBinding +import org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding +import ru.pulsar.jenkins.library.IStepExecutor +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.Logger +import ru.pulsar.jenkins.library.utils.VRunner +import ru.pulsar.jenkins.library.utils.VersionParser + +class InitFromStorage implements Serializable { + + private final JobConfiguration config; + + InitFromStorage(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + if (config.infobaseFromFiles()) { + Logger.println("init infoBase from storage is disabled") + return + } + + steps.installLocalDependencies(); + + def storageVersion = VersionParser.storage() + def storageVersionParameter = storageVersion == "" ? "" : "--storage-ver $storageVersion" + + steps.withCredentials(Arrays.asList( + new UsernamePasswordMultiBinding( + 'STORAGE_USR', + 'STORAGE_PSW', + config.secrets.storage + ), + new StringBinding( + 'STORAGE_PATH', + config.secrets.storagePath + ) + )) { + String vrunnerPath = VRunner.getVRunnerPath(); + steps.cmd "$vrunnerPath init-dev --storage --storage-name $STORAGE_PATH --storage-user $STORAGE_USR --storage-pwd $STORAGE_PSW $storageVersionParameter --ibconnection \"/F./build/ib\"" + } + } +} diff --git a/vars/initFromStorage.groovy b/vars/initFromStorage.groovy index fb8cd69..3349381 100644 --- a/vars/initFromStorage.groovy +++ b/vars/initFromStorage.groovy @@ -1,28 +1,10 @@ import ru.pulsar.jenkins.library.configuration.JobConfiguration -import ru.pulsar.jenkins.library.utils.VRunner -import ru.pulsar.jenkins.library.utils.VersionParser +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.InitFromStorage -def call(JobConfiguration jobConfiguration) { +def call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) - printLocation() - - installLocalDependencies(); - - def storageVersion = VersionParser.storage() - def storageVersionParameter = storageVersion == "" ? "" : "--storage-ver $storageVersion" - - withCredentials([ - usernamePassword( - credentialsId: jobConfiguration.secrets.storage, - passwordVariable: 'STORAGE_PSW', - usernameVariable: 'STORAGE_USR' - ), - string( - credentialsId: jobConfiguration.secrets.storagePath, - variable: 'STORAGE_PATH' - ) - ]) { - String vrunnerPath = VRunner.getVRunnerPath(); - cmd "$vrunnerPath init-dev --storage --storage-name $STORAGE_PATH --storage-user $STORAGE_USR --storage-pwd $STORAGE_PSW $storageVersionParameter --ibconnection \"/F./build/ib\"" - } + def initFromStorage = new InitFromStorage(config) + initFromStorage.run() } \ No newline at end of file From 63c230e8ce740a6311664c5d55569473bf2a3f31 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 17:01:00 +0300 Subject: [PATCH 94/99] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=BE=D1=81=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=B2-=D0=BA=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D1=88=D0=B5=D0=BB=D0=BE=D0=B2=20=D0=B2=20Steps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/IStepExecutor.groovy | 7 +++++-- .../jenkins/library/StepExecutor.groovy | 13 +++++++++++-- .../library/steps/InitFromStorage.groovy | 19 +++++++++---------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index 53af9f4..243763b 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -1,6 +1,5 @@ package ru.pulsar.jenkins.library -import org.jenkinsci.plugins.credentialsbinding.MultiBinding import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction @@ -30,7 +29,11 @@ interface IStepExecutor { void tool(String toolName) - def withCredentials(List bindings, Closure body) + def withCredentials(List bindings, Closure body) + + def string(String credentialsId, String variable) + + def usernamePassword(String credentialsId, String usernameVariable, String passwordVariable) void withSonarQubeEnv(String installationName, Closure body) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index f61b12b..21c5a58 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -1,6 +1,5 @@ package ru.pulsar.jenkins.library -import org.jenkinsci.plugins.credentialsbinding.MultiBinding import org.jenkinsci.plugins.pipeline.utility.steps.fs.FileWrapper import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction import ru.yandex.qatools.allure.jenkins.config.ResultsConfig @@ -71,12 +70,22 @@ class StepExecutor implements IStepExecutor { } @Override - def withCredentials(List bindings, Closure body) { + def withCredentials(List bindings, Closure body) { steps.withCredentials(bindings) { body() } } + @Override + def string(String credentialsId, String variable) { + return steps.string(credentialsId: credentialsId, variable: variable) + } + + @Override + def usernamePassword(String credentialsId, String usernameVariable, String passwordVariable) { + return steps.string(credentialsId: credentialsId, usernameVariable: usernameVariable, passwordVariable: passwordVariable) + } + @Override EnvironmentAction env() { return steps.env diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy index 48537d1..13b5112 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy @@ -1,7 +1,6 @@ package ru.pulsar.jenkins.library.steps -import org.jenkinsci.plugins.credentialsbinding.impl.StringBinding -import org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding + import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry @@ -32,17 +31,17 @@ class InitFromStorage implements Serializable { def storageVersion = VersionParser.storage() def storageVersionParameter = storageVersion == "" ? "" : "--storage-ver $storageVersion" - steps.withCredentials(Arrays.asList( - new UsernamePasswordMultiBinding( + steps.withCredentials([ + steps.usernamePassword( + config.secrets.storage, 'STORAGE_USR', - 'STORAGE_PSW', - config.secrets.storage + 'STORAGE_PSW' ), - new StringBinding( - 'STORAGE_PATH', - config.secrets.storagePath + steps.string( + config.secrets.storagePath, + 'STORAGE_PATH' ) - )) { + ]) { String vrunnerPath = VRunner.getVRunnerPath(); steps.cmd "$vrunnerPath init-dev --storage --storage-name $STORAGE_PATH --storage-user $STORAGE_USR --storage-pwd $STORAGE_PSW $storageVersionParameter --ibconnection \"/F./build/ib\"" } From 34fd6d1e55b6398ad361169e707ee07989c03acd Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 17:22:59 +0300 Subject: [PATCH 95/99] =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=87=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8=20credential=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20repo?= =?UTF-8?q?=20slug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/configuration/Secrets.groovy | 2 + .../library/steps/InitFromStorage.groovy | 41 +++++++++++++++---- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy b/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy index 0ee17f0..51941df 100644 --- a/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy +++ b/src/ru/pulsar/jenkins/library/configuration/Secrets.groovy @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription @JsonIgnoreProperties(ignoreUnknown = true) class Secrets implements Serializable { + public static final String UNKNOWN_ID = "UNKNOWN_ID" + @JsonPropertyDescription("Путь к хранилищу конфигурации") String storagePath diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy index 13b5112..007df69 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy @@ -1,16 +1,22 @@ package ru.pulsar.jenkins.library.steps - +import com.cloudbees.groovy.cps.NonCPS +import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.configuration.Secrets import ru.pulsar.jenkins.library.ioc.ContextRegistry import ru.pulsar.jenkins.library.utils.Logger import ru.pulsar.jenkins.library.utils.VRunner import ru.pulsar.jenkins.library.utils.VersionParser +import static ru.pulsar.jenkins.library.configuration.Secrets.UNKNOWN_ID + class InitFromStorage implements Serializable { - private final JobConfiguration config; + final static REPO_SLUG_REGEXP = ~/(?m)^(?:[^:\/?#\n]+:)?(?:\/+[^\/?#\n]*)?\/?([^?\n]*)/ + + private final JobConfiguration config InitFromStorage(JobConfiguration config) { this.config = config @@ -26,24 +32,43 @@ class InitFromStorage implements Serializable { return } - steps.installLocalDependencies(); + steps.installLocalDependencies() - def storageVersion = VersionParser.storage() - def storageVersionParameter = storageVersion == "" ? "" : "--storage-ver $storageVersion" + String storageVersion = VersionParser.storage() + String storageVersionParameter = storageVersion == "" ? "" : "--storage-ver $storageVersion" + + EnvironmentAction env = steps.env(); + String repoSlug = computeRepoSlug(env.GIT_URL) + + Secrets secrets = config.secrets + + String storageCredentials = secrets.storage == UNKNOWN_ID ? repoSlug + "_STORAGE_USER" : secrets.storage + String storagePath = secrets.storagePath == UNKNOWN_ID ? repoSlug + "_STORAGE_PATH" : secrets.storagePath steps.withCredentials([ steps.usernamePassword( - config.secrets.storage, + storageCredentials, 'STORAGE_USR', 'STORAGE_PSW' ), steps.string( - config.secrets.storagePath, + storagePath, 'STORAGE_PATH' ) ]) { - String vrunnerPath = VRunner.getVRunnerPath(); + String vrunnerPath = VRunner.getVRunnerPath() steps.cmd "$vrunnerPath init-dev --storage --storage-name $STORAGE_PATH --storage-user $STORAGE_USR --storage-pwd $STORAGE_PSW $storageVersionParameter --ibconnection \"/F./build/ib\"" } } + + @NonCPS + private static String computeRepoSlug(String text) { + def matcher = text =~ REPO_SLUG_REGEXP + String repoSlug = matcher != null && matcher.getCount() == 1 ? matcher[0][1] : "" + if (repoSlug.endsWith(".git")) { + repoSlug = repoSlug[0..-5] + } + repoSlug = repoSlug.replace('/', '_') + return repoSlug + } } From 99c9b9b3b9ef767443160e897ae2882fcd461af5 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 17:43:23 +0300 Subject: [PATCH 96/99] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 054225c..0c3b1d1 100644 --- a/README.md +++ b/README.md @@ -107,9 +107,9 @@ pipeline1C() * Исходники конфигурации ожидаются в каталоге `src/cf` (`srcDir`). * Формат исходников - выгрузка из Конфигуратора (`sourceFormat`). * Ветка по умолчанию (для комбинированного режима загрузки конфигурации) - "main" (`defaultBranch`). - * TODO: Имена "секретов" (jenkins credentials, `secrets`) по умолчанию высчитываются как `GROUP_REPO_KEY`, где `GROUP` и `REPO` - это группа проектов и имя проектов (например, `firstBitSemenovskaya` и `jenkins-lib`), а `KEY` - ключ секрета: - * `STORAGE_PATH` - путь к хранилищу конфигурации (`secrets` -> `storagePath`); - * `STORAGE_USER` - параметры авторизации в хранилище вида "username with password" (`secrets` -> `storage`). + * Имена "секретов" (jenkins credentials, `secrets`) по умолчанию высчитываются из пути к git-репозиторию (без учета домена, с заменой `/` на `_`) с прибавлением ключа секрета. Например, для репозитория https://github.com/firstBitSemenovskaya/jenkins-lib секрет с адресом хранилища будет выглядеть как `firstBitSemenovskaya_jenkins-lib_STORAGE_PATH`. Ключи секретов: + * `STORAGE_PATH` - путь к хранилищу конфигурации (для `secrets` -> `storagePath`); + * `STORAGE_USER` - параметры авторизации в хранилище вида "username with password" (для `secrets` -> `storage`). * Все "шаги" по умолчанию выключены (`stages`). * Если в корне репозитория существует файл `packagedef`, то в шагах, работающих с информационной базой, будет выполнена попытка установки локальных зависимостей средствами `opm`. * Если после установки локальных зависимостей в каталоге `oscript_modules/bin` сушествует файл `vrunner`, то для выполнения команд работы с информационной базой будет использоваться он, а не глобально установленный `vrunner` из `PATH`. From 4e233c3a8ed6484a42c071b61bbb914cbb4b9df8 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 17:45:06 +0300 Subject: [PATCH 97/99] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D1=83=D1=81=D0=BA=D0=B0=D0=B5=D0=BC=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D1=81=D1=82=D0=B5=D0=BF=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D1=8B=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BD-=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D0=BE=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ru/pulsar/jenkins/library/StepExecutor.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index 21c5a58..c5b6368 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -83,7 +83,7 @@ class StepExecutor implements IStepExecutor { @Override def usernamePassword(String credentialsId, String usernameVariable, String passwordVariable) { - return steps.string(credentialsId: credentialsId, usernameVariable: usernameVariable, passwordVariable: passwordVariable) + return steps.usernamePassword(credentialsId: credentialsId, usernameVariable: usernameVariable, passwordVariable: passwordVariable) } @Override From 2f724efee4a73dd022bbacce81bfd2235357c361 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 17:48:17 +0300 Subject: [PATCH 98/99] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=D0=B8=20=D1=81=D0=B5=D0=BA=D1=80=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B2=20vrunner=20init-dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pulsar/jenkins/library/steps/InitFromStorage.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy index 007df69..aad6d60 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy @@ -48,16 +48,16 @@ class InitFromStorage implements Serializable { steps.withCredentials([ steps.usernamePassword( storageCredentials, - 'STORAGE_USR', - 'STORAGE_PSW' + 'RUNNER_STORAGE_USER', + 'RUNNER_STORAGE_PWD' ), steps.string( storagePath, - 'STORAGE_PATH' + 'RUNNER_STORAGE_NAME' ) ]) { String vrunnerPath = VRunner.getVRunnerPath() - steps.cmd "$vrunnerPath init-dev --storage --storage-name $STORAGE_PATH --storage-user $STORAGE_USR --storage-pwd $STORAGE_PSW $storageVersionParameter --ibconnection \"/F./build/ib\"" + steps.cmd "$vrunnerPath init-dev --storage $storageVersionParameter --ibconnection \"/F./build/ib\"" } } From df5e4b766da9bfd13e477491351a15d07ff5ac63 Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Mon, 8 Nov 2021 20:29:24 +0300 Subject: [PATCH 99/99] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D1=87=D0=B0=20=D1=84=D0=BB=D0=B0=D0=B3=D0=B0=20--nocacheuse=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20VRunner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ src/ru/pulsar/jenkins/library/steps/Bdd.groovy | 2 +- .../pulsar/jenkins/library/steps/InitFromFiles.groovy | 2 +- .../jenkins/library/steps/InitFromStorage.groovy | 2 +- .../pulsar/jenkins/library/steps/InitInfobase.groovy | 6 +++--- src/ru/pulsar/jenkins/library/utils/VRunner.groovy | 10 ++++++++++ vars/syntaxCheck.groovy | 2 +- 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 5f3fff7..3bb6fce 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ bin/ lib/ *.iml +.classpath +.project +.settings/ diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy index 33940e9..454b4c4 100644 --- a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -34,7 +34,7 @@ class Bdd implements Serializable { config.bddOptions.vrunnerSteps.each { Logger.println("Шаг запуска сценариев командой ${it}") String vrunnerPath = VRunner.getVRunnerPath(); - steps.cmd("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"") + VRunner.exec("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"") } } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy index 7f56ecb..a8ce35d 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitFromFiles.groovy @@ -44,6 +44,6 @@ class InitFromFiles implements Serializable { Logger.println("Выполнение загрузки конфигурации из файлов") String vrunnerPath = VRunner.getVRunnerPath(); def initCommand = "$vrunnerPath init-dev --src $srcDir --ibconnection \"/F./build/ib\"" - steps.cmd(initCommand) + VRunner.exec(initCommand) } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy index aad6d60..6ed2b39 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitFromStorage.groovy @@ -57,7 +57,7 @@ class InitFromStorage implements Serializable { ) ]) { String vrunnerPath = VRunner.getVRunnerPath() - steps.cmd "$vrunnerPath init-dev --storage $storageVersionParameter --ibconnection \"/F./build/ib\"" + VRunner.exec "$vrunnerPath init-dev --storage $storageVersionParameter --ibconnection \"/F./build/ib\"" } } diff --git a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy index 4518a35..f85c9ea 100644 --- a/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy +++ b/src/ru/pulsar/jenkins/library/steps/InitInfobase.groovy @@ -37,7 +37,7 @@ class InitInfobase implements Serializable { // Запуск миграции steps.catchError { - steps.cmd(vrunnerPath + ' run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') + VRunner.exec(vrunnerPath + ' run --command "ЗапуститьОбновлениеИнформационнойБазы;ЗавершитьРаботуСистемы;" --execute \\$runnerRoot/epf/ЗакрытьПредприятие.epf --ibconnection "/F./build/ib"') } } else { Logger.println("Шаг миграции ИБ выключен") @@ -49,12 +49,12 @@ class InitInfobase implements Serializable { files = files.sort new OrderBy( { it.name }) files.each { Logger.println("Первичная инициализация файлом ${it.path}") - steps.cmd("$vrunnerPath vanessa --settings ${it.path} --ibconnection \"/F./build/ib\"") + VRunner.exec("$vrunnerPath vanessa --settings ${it.path} --ibconnection \"/F./build/ib\"") } } else { config.initInfobaseOptions.additionalInitializationSteps.each { Logger.println("Первичная инициализация командой ${it}") - steps.cmd("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"") + VRunner.exec("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"") } } } diff --git a/src/ru/pulsar/jenkins/library/utils/VRunner.groovy b/src/ru/pulsar/jenkins/library/utils/VRunner.groovy index 53fd98d..d9b48ab 100644 --- a/src/ru/pulsar/jenkins/library/utils/VRunner.groovy +++ b/src/ru/pulsar/jenkins/library/utils/VRunner.groovy @@ -5,6 +5,8 @@ import ru.pulsar.jenkins.library.ioc.ContextRegistry class VRunner { + static final String DEFAULT_VRUNNER_OPTS = "RUNNER_NOCACHEUSE=1" + static String getVRunnerPath() { IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() @@ -17,4 +19,12 @@ class VRunner { return vrunnerPath; } + + static int exec(String command, boolean returnStatus = false) { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + steps.withEnv([DEFAULT_VRUNNER_OPTS]) { + return steps.cmd(command, returnStatus) + } as int + } } diff --git a/vars/syntaxCheck.groovy b/vars/syntaxCheck.groovy index 8c119b0..636b837 100644 --- a/vars/syntaxCheck.groovy +++ b/vars/syntaxCheck.groovy @@ -56,7 +56,7 @@ def call(JobConfiguration config) { } // Запуск синтакс-проверки - cmd(command, true) + VRunner.exec(command, true) junit allowEmptyResults: true, testResults: FileUtils.getLocalPath(pathToJUnitReport)