Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanovEV committed Jan 17, 2024
1 parent 8aac6e0 commit 624a3ba
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 2 deletions.
5 changes: 4 additions & 1 deletion resources/globalConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"edtToDesignerFormatTransformation": 60,
"edtValidate": 240,
"initInfoBase": 60,
"loadExtintions": 60,
"resultTransformation": 10,
"sonarqube": 90,
"syntaxCheck": 240,
Expand All @@ -37,7 +38,9 @@
"initInfobase": {
"initMethod": "fromStorage",
"runMigration": true,
"additionalInitializationSteps": []
"additionalInitializationSteps": [],
"loadExtintionsByDefault": true,
"extintions": []
},
"bdd": {
"vrunnerSteps": [
Expand Down
32 changes: 32 additions & 0 deletions resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
"type" : "integer",
"description" : "Таймаут шага инициализации информационной базы, в минутах.\n По умолчанию содержит значение 60.\n "
},
"loadExtintions" : {
"type" : "integer",
"description" : "Таймаут шага загрузки расширений в базу, в минутах.\n По умолчанию содержит значение 60.\n "
},
"zipInfoBase" : {
"type" : "integer",
"description" : "Таймаут шага архивирования информационной базы, в минутах.\n По умолчанию содержит значение 60.\n "
Expand Down Expand Up @@ -155,6 +159,34 @@
"description" : "Дополнительные шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.first.json\")\n ",
"items" : {
"type" : "string"
},
"extintions" : {
"type" : "array",
"description" : "Массив расширений для загрузки в конфигурацию.",
"items" : {
"type" : "object",
"id": "urn:jsonschema:ru:pulsar:jenkins:library:configuration:InitInfoBaseOptions:extintions:exception",
"description" : "Информация о расширении для загрузки",
"properties" : {
"name": {
"type": "string",
"description": "Имя расширения с которым оно грузится в конфигурацию"
},
"initMethod": {
"type" : "string",
"description" : "\n Способ инициализации расширения.\n Поддерживается два варианта:\n * fromSource - инициализация расширения из исходников;\n * fromInternet - скачивание скомпилированного cfe по ссылке.",
"enum" : ["fromSource", "fromInternet" ]
},
"path": {
"type": "string",
"description": "Хранит в себе путь к расширению.\n * В случае если выбран initMethod <fromSource> - указывается путь к исходникам расширения.\n * В случае если выбран initMethod <fromInternet> - указывается ссылка на cfe-файл"
},
"sourceFormat" : {
"type" : "string",
"description" : "Формат исходников конфигурации",
"enum" : [ "edt", "designer" ]
},
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,30 @@ class ConfigurationReader implements Serializable {

@NonCPS
private static void mergeInitInfoBaseOptions(InitInfoBaseOptions baseObject, InitInfoBaseOptions objectToMerge) {
if (objectToMerge == null || objectToMerge.additionalInitializationSteps == null) {
if (objectToMerge == null) {
return
}
mergeInitInfoBaseAdditionalInitializationSteps(baseObject, objectToMerge)
mergeInitInfoBaseExtintions(baseObject, objectToMerge)
}

@NonCPS
private static void mergeInitInfoBaseAdditionalInitializationSteps(InitInfoBaseOptions baseObject, InitInfoBaseOptions objectToMerge) {
if (objectToMerge.additionalInitializationSteps == null) {
return
}
baseObject.additionalInitializationSteps = objectToMerge.additionalInitializationSteps.clone()
}


@NonCPS
private static void mergeInitInfoBaseExtintions(InitInfoBaseOptions baseObject, InitInfoBaseOptions objectToMerge) {
if (objectToMerge.extintions == null) {
return
}
baseObject.extintions = objectToMerge.extintions.clone()
}

@NonCPS
private static void mergeBddOptions(BddOptions baseObject, BddOptions objectToMerge) {
if (objectToMerge == null || objectToMerge.vrunnerSteps == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ class JobConfiguration implements Serializable {
(initMethod == InitInfoBaseMethod.DEFAULT_BRANCH_FROM_STORAGE && branchName != defaultBranch)
}

boolean needLoadExtintions() {
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()
def env = steps.env();
String branchName = env.BRANCH_NAME;
def extintions = initInfoBaseOptions.extintions

return extintions.length != 0
}

String v8AgentLabel() {
return v8version
}
Expand Down
48 changes: 48 additions & 0 deletions src/ru/pulsar/jenkins/library/steps/loadExtintions.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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
import ru.pulsar.jenkins.library.utils.Logger
import ru.pulsar.jenkins.library.utils.VRunner

class loadExtintions implements Serializable {

private final JobConfiguration config;

loadExtintions(JobConfiguration config) {
this.config = config
}

def run() {
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()

Logger.printLocation()

List<String> logosConfig = ["LOGOS_CONFIG=$config.logosConfig"]
steps.withEnv(logosConfig) {

String vrunnerPath = VRunner.getVRunnerPath();

steps.catchError {

config.initInfoBaseOptions.extintions.each {
Logger.println("Установим расширение ${it.name}")

// 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;
// }

// VRunner.exec("$vrunnerPath ${it} --ibconnection \"/F./build/ib\"")
}
}
}
}
}
10 changes: 10 additions & 0 deletions vars/loadExtintions.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ru.pulsar.jenkins.library.configuration.JobConfiguration
import ru.pulsar.jenkins.library.ioc.ContextRegistry
import ru.pulsar.jenkins.library.steps.loadExtintions

def call(JobConfiguration config) {
ContextRegistry.registerDefaultContext(this)

def loadExtintions = new loadExtintions(config)
loadExtintions.run()
}
12 changes: 12 additions & 0 deletions vars/pipeline1C.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ void call() {
}
}

stage('Загрузка расширений в конфигурацию'){
when {
beforeAgent true
expression { config.needExtintions() }
}
steps {
timeout(time: config.timeoutOptions.loadExtintions, unit: TimeUnit.MINUTES) {
loadExtintions config
}
}
}

stage('Архивация ИБ') {
steps {
timeout(time: config.timeoutOptions.zipInfoBase, unit: TimeUnit.MINUTES) {
Expand Down

0 comments on commit 624a3ba

Please sign in to comment.