Skip to content

Commit

Permalink
tailor the code to the current develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ovcharenko-di committed Mar 18, 2024
1 parent 8dc051b commit a7523fb
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 100 deletions.
6 changes: 0 additions & 6 deletions resources/globalConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@
},
"yaxunit": {
"vrunnerSettings": "./tools/vrunner.json",
"extensions": [
{
"name":"YAXUNIT",
"src": "https://github.com/bia-technologies/yaxunit/releases/download/23.05/YAXUNIT-23.05.cfe"
}
],
"configPath": "./tools/yaxunit.json",
"publishToAllureReport": false,
"publishToJUnitReport": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class ConfigurationReader implements Serializable {
mergeObjects(baseConfiguration, configurationToMerge, nonMergeableSettings)
mergeInitInfoBaseOptions(baseConfiguration.initInfoBaseOptions, configurationToMerge.initInfoBaseOptions)
mergeBddOptions(baseConfiguration.bddOptions, configurationToMerge.bddOptions)
mergeYaxunitOptions(baseConfiguration.yaxunitOptions, configurationToMerge.yaxunitOptions)
mergeSyntaxCheckOptions(baseConfiguration.syntaxCheckOptions, configurationToMerge.syntaxCheckOptions)
mergeNotificationsOptions(baseConfiguration.notificationsOptions, configurationToMerge.notificationsOptions)

Expand Down Expand Up @@ -149,14 +148,6 @@ class ConfigurationReader implements Serializable {
baseObject.vrunnerSteps = objectToMerge.vrunnerSteps.clone()
}

@NonCPS
private static void mergeYaxunitOptions(YaxunitOptions baseObject, YaxunitOptions objectToMerge) {
if (objectToMerge == null || objectToMerge.extensions == null) {
return
}
baseObject.extensions = objectToMerge.extensions.clone()
}

@NonCPS
private static void mergeSyntaxCheckOptions(SyntaxCheckOptions baseObject, SyntaxCheckOptions objectToMerge) {
if (objectToMerge == null || objectToMerge.checkModes == null) {
Expand Down
17 changes: 0 additions & 17 deletions src/ru/pulsar/jenkins/library/configuration/Extension.groovy

This file was deleted.

15 changes: 3 additions & 12 deletions src/ru/pulsar/jenkins/library/configuration/YaxunitOptions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ru.pulsar.jenkins.library.configuration

import com.cloudbees.groovy.cps.NonCPS
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonPropertyDescription

@JsonIgnoreProperties(ignoreUnknown = true)
Expand All @@ -13,15 +12,6 @@ class YaxunitOptions implements Serializable {
""")
String vrunnerSettings = "./tools/vrunner.json"

@JsonProperty("extensions")
@JsonPropertyDescription("""Расширения с тестами.
Массив объектов с полями name и src, где
name - имя расширения
src - путь к расширению (к cfe или к исходникам)
По умолчанию содержит один элемент - YAXUNIT версии 23.05.
""")
Extension[] extensions

@JsonPropertyDescription("""Путь к конфигурационному файлу YAXUnit.
По умолчанию содержит значение "./tools/yaxunit.json".
""")
Expand All @@ -40,10 +30,11 @@ class YaxunitOptions implements Serializable {
@Override
@NonCPS
String toString() {
return "YaxunitTestOptions{" +
return "YaxunitOptions{" +
"vrunnerSettings='" + vrunnerSettings + '\'' +
", extensions='" + extensions +
", configPath='" + configPath +
", publishToAllureReport='" + publishToAllureReport +
", publishToJUnitReport='" + publishToJUnitReport +
'}'
}
}
35 changes: 1 addition & 34 deletions src/ru/pulsar/jenkins/library/steps/Yaxunit.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ru.pulsar.jenkins.library.steps

import hudson.FilePath
import ru.pulsar.jenkins.library.IStepExecutor
import ru.pulsar.jenkins.library.configuration.Extension

import ru.pulsar.jenkins.library.configuration.JobConfiguration
import ru.pulsar.jenkins.library.ioc.ContextRegistry
import ru.pulsar.jenkins.library.utils.FileUtils
Expand Down Expand Up @@ -42,34 +42,6 @@ class Yaxunit implements Serializable {
String vrunnerPath = VRunner.getVRunnerPath()
String ibConnection = ' --ibconnection "/F./build/ib"'

def extCommands = []

// Команда загрузки YAXUnit
def loadYaxunitCommand = VRunner.loadExtCommand("yaxunit")
extCommands << loadYaxunitCommand

// Команды сборки расширений с тестами и их загрузки в ИБ
for (Extension extension in options.extensions) {
if (extension.src.endsWith('cfe')) {
// Скачиваем расширение
String pathToExtension = "$env.WORKSPACE/build/out/${extension.name}.cfe"
FilePath localPathToExtension = FileUtils.getFilePath(pathToExtension)
Logger.println("Скачивание расширения $extension.name в $localPathToExtension из ${extension.src}")
localPathToExtension.copyFrom(new URL(extension.src))
} else {
// Команда компиляции в cfe
def compileExtCommand = "$vrunnerPath compileexttocfe --src $extension.src --out build/out/${extension.name}.cfe"
extCommands << compileExtCommand
Logger.println("Команда сборки расширения: $compileExtCommand")
}

// Команда загрузки расширения в ИБ
def loadTestExtCommand = VRunner.loadExtCommand(extension.name)
extCommands << loadTestExtCommand
Logger.println("Команда загрузки расширения: $loadTestExtCommand")

}

// Готовим конфиг для yaxunit
String yaxunitConfigPath = options.configPath
if (!steps.fileExists(yaxunitConfigPath)) {
Expand All @@ -83,20 +55,15 @@ class Yaxunit implements Serializable {

// Переопределяем настройки vrunner
String vrunnerSettings = options.vrunnerSettings
String[] extCommandsWithSettings = extCommands
if (steps.fileExists(vrunnerSettings)) {
String vrunnerSettingsParam = " --settings $vrunnerSettings"

extCommandsWithSettings = extCommands.collect { "$it $vrunnerSettingsParam" }
runTestsCommand += vrunnerSettingsParam

}

// Выполяем команды
steps.withEnv(logosConfig) {
for (extCommand in extCommandsWithSettings) {
VRunner.exec(extCommand, true)
}
VRunner.exec(runTestsCommand, true)
}

Expand Down
22 changes: 0 additions & 22 deletions src/ru/pulsar/jenkins/library/utils/VRunner.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ru.pulsar.jenkins.library.utils

import hudson.FilePath
import ru.pulsar.jenkins.library.IStepExecutor
import ru.pulsar.jenkins.library.ioc.ContextRegistry

Expand Down Expand Up @@ -40,25 +39,4 @@ class VRunner {
return fileContent.contains("\"$settingName\"")
}

static String loadExtCommand(String name) {

IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()

def env = steps.env()
def vrunnerPath = getVRunnerPath()

String pathToExt = "$env.WORKSPACE/build/out/${name}.cfe"
FilePath localPathToExt = FileUtils.getFilePath(pathToExt)

// Команда загрузки расширения
String loadCommand = vrunnerPath + ' run --command "Путь=' + localPathToExt + ';ЗавершитьРаботуСистемы;" --execute '
String executeParameter = '$runnerRoot/epf/ЗагрузитьРасширениеВРежимеПредприятия.epf'
if (steps.isUnix()) {
executeParameter = '\\' + executeParameter
}
loadCommand += executeParameter
loadCommand += ' --ibconnection "/F./build/ib"'

return loadCommand
}
}

0 comments on commit a7523fb

Please sign in to comment.