You've already forked vanessa-usher
mirror of
https://github.com/silverbulleters/vanessa-usher.git
synced 2026-06-21 01:29:42 +02:00
Resolve USHER-47
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
"gitsync" : false,
|
||||
"edtTransform" : false,
|
||||
"prepareBase" : false,
|
||||
"checkExtensions" : false,
|
||||
"syntaxCheck" : false,
|
||||
"smoke" : false,
|
||||
"tdd" : false,
|
||||
@@ -56,6 +57,15 @@
|
||||
},
|
||||
"extensions" : [ ]
|
||||
},
|
||||
"checkExtensions" : {
|
||||
"timeout" : 40,
|
||||
"repo" : {
|
||||
"path" : "",
|
||||
"auth" : "",
|
||||
"empty" : false
|
||||
},
|
||||
"extensions" : ""
|
||||
},
|
||||
"syntaxCheck" : {
|
||||
"timeout" : 100,
|
||||
"allurePath" : "./out/syntaxCheck/allure",
|
||||
|
||||
+25
-1
@@ -99,6 +99,10 @@
|
||||
"type" : "boolean",
|
||||
"description" : "Подготовить информационную базу"
|
||||
},
|
||||
"checkExtensions" : {
|
||||
"type" : "boolean",
|
||||
"description" : "Проверить возможность применимости расширений"
|
||||
},
|
||||
"syntaxCheck" : {
|
||||
"type" : "boolean",
|
||||
"description" : "Проверить конфигурацию с помощью синтакс-проверки"
|
||||
@@ -236,6 +240,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"checkExtensions" : {
|
||||
"type" : "object",
|
||||
"id" : "urn:jsonschema:org:silverbulleters:usher:config:stage:CheckExtensionsOptional",
|
||||
"description" : "Настройки этапа применимости расширения для использования в конкретной информационной базе конфигурации 1С",
|
||||
"properties" : {
|
||||
"timeout" : {
|
||||
"type" : "integer",
|
||||
"description" : "Таймаут времени работы таймаута"
|
||||
},
|
||||
"repo" : {
|
||||
"type" : "object",
|
||||
"$ref" : "urn:jsonschema:org:silverbulleters:usher:config:additional:Repo",
|
||||
"description" : "Настройки подключения к хранилищу конфигурации 1С"
|
||||
},
|
||||
"extensions" : {
|
||||
"type" : "string",
|
||||
"description" : "Выполнить проверку для указанного расширения с учетом всех ранее загружаемых расширений. Если имя расширения не указано, то проверяются все расширения в порядке загрузки."
|
||||
}
|
||||
}
|
||||
},
|
||||
"syntaxCheck" : {
|
||||
"type" : "object",
|
||||
"id" : "urn:jsonschema:org:silverbulleters:usher:config:stage:SyntaxCheckOptional",
|
||||
@@ -355,7 +379,7 @@
|
||||
},
|
||||
"vanessasettings" : {
|
||||
"type" : "string",
|
||||
"description" : "путь к файлу настроек фреймворка тестирования ./tools/JSON/vanessaConf.json"
|
||||
"description" : "Путь к файлу настроек фреймворка тестирования ./tools/JSON/vanessaConf.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.silverbulleters.usher.config.additional.MatrixTesting
|
||||
import org.silverbulleters.usher.config.additional.NotificationOptional
|
||||
import org.silverbulleters.usher.config.stage.BddOptional
|
||||
import org.silverbulleters.usher.config.stage.BuildOptional
|
||||
import org.silverbulleters.usher.config.stage.CheckExtensionsOptional
|
||||
import org.silverbulleters.usher.config.stage.EdtTransformOptional
|
||||
import org.silverbulleters.usher.config.stage.GitsyncOptional
|
||||
import org.silverbulleters.usher.config.stage.PrepareBaseOptional
|
||||
@@ -73,6 +74,10 @@ class PipelineConfiguration implements Serializable {
|
||||
@JsonProperty("preparebase")
|
||||
PrepareBaseOptional prepareBaseOptional = new PrepareBaseOptional()
|
||||
|
||||
@JsonPropertyDescription("Настройки этапа применимости расширения для использования в конкретной информационной базе конфигурации 1С")
|
||||
@JsonProperty("checkExtensions")
|
||||
CheckExtensionsOptional checkExtensionsOptional = new CheckExtensionsOptional()
|
||||
|
||||
@JsonPropertyDescription("Настройки этапа синтакс-проверки конфигурации 1С")
|
||||
@JsonProperty("syntaxCheck")
|
||||
SyntaxCheckOptional syntaxCheckOptional = new SyntaxCheckOptional()
|
||||
|
||||
@@ -24,6 +24,9 @@ class Stages {
|
||||
@JsonPropertyDescription("Подготовить информационную базу")
|
||||
boolean prepareBase = false
|
||||
|
||||
@JsonPropertyDescription("Проверить возможность применимости расширений")
|
||||
boolean checkExtensions = false
|
||||
|
||||
@JsonPropertyDescription("Проверить конфигурацию с помощью синтакс-проверки")
|
||||
boolean syntaxCheck = false
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Vanessa-Usher
|
||||
* Copyright (C) 2019-2022 SilverBulleters, LLC - All Rights Reserved.
|
||||
* Unauthorized copying of this file in any way is strictly prohibited.
|
||||
* Proprietary and confidential.
|
||||
*/
|
||||
package org.silverbulleters.usher.config.stage
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription
|
||||
import org.silverbulleters.usher.config.additional.Repo
|
||||
|
||||
/**
|
||||
* Настройки этапа проверки применимости расширений
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
class CheckExtensionsOptional extends BaseOptional {
|
||||
@JsonPropertyDescription("Настройки подключения к хранилищу конфигурации 1С")
|
||||
Repo repo = new Repo()
|
||||
|
||||
@JsonPropertyDescription("Выполнить проверку для указанного расширения с учетом всех ранее загружаемых расширений. Если имя расширения не указано, то проверяются все расширения в порядке загрузки.")
|
||||
String extensions = ''
|
||||
|
||||
CheckExtensionsOptional() {
|
||||
name = "Check extensions"
|
||||
id = 'check-extensions'
|
||||
timeout = 40
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,11 @@ class PipelineState {
|
||||
*/
|
||||
PrepareBaseState prepareBase = new PrepareBaseState()
|
||||
|
||||
/**
|
||||
* Состояние проверки применимости расширений
|
||||
*/
|
||||
BaseTestingState checkExtensions = new BaseTestingState()
|
||||
|
||||
/**
|
||||
* Состояние синтакс-проверки
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ package org.silverbulleters.usher.wrapper
|
||||
import org.silverbulleters.usher.config.PipelineConfiguration
|
||||
import org.silverbulleters.usher.config.additional.ExtensionSource
|
||||
import org.silverbulleters.usher.config.stage.BddOptional
|
||||
import org.silverbulleters.usher.config.stage.CheckExtensionsOptional
|
||||
import org.silverbulleters.usher.config.stage.PrepareBaseOptional
|
||||
import org.silverbulleters.usher.config.stage.SmokeOptional
|
||||
import org.silverbulleters.usher.config.stage.SyntaxCheckOptional
|
||||
@@ -211,7 +212,6 @@ class VRunner {
|
||||
return command.join(" ")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Запустить дымовое тестирование
|
||||
* @param config конфигурация
|
||||
@@ -297,4 +297,33 @@ class VRunner {
|
||||
return command.join(" ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Выполнить проверку применимости расширений
|
||||
* @param config
|
||||
* @param optional
|
||||
*/
|
||||
static def checkCanApplyExtensions(PipelineConfiguration config, CheckExtensionsOptional optional) {
|
||||
def command = [
|
||||
"vrunner",
|
||||
"designer",
|
||||
"--v8version", config.v8Version,
|
||||
"%credentialID%",
|
||||
"--ibconnection", Common.getConnectionString(config),
|
||||
"--nocacheuse",
|
||||
"%credentialStorageID%",
|
||||
"--storage-name", optional.repo.path
|
||||
]
|
||||
|
||||
command += "--additional \"/CheckCanApplyConfigurationExtensions"
|
||||
|
||||
|
||||
if (!optional.extensions.isEmpty()) {
|
||||
command += "-Extension ${optional.extensions}\""
|
||||
}
|
||||
else {
|
||||
command += "\""
|
||||
}
|
||||
|
||||
return command.join(" ")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ class ConfigurationReaderTest {
|
||||
assertThat(stages).isNotNull()
|
||||
assertThat(stages.isGitsync()).isFalse()
|
||||
assertThat(stages.isPrepareBase()).isFalse()
|
||||
assertThat(stages.isCheckExtensions()).isFalse()
|
||||
assertThat(stages.isSyntaxCheck()).isFalse()
|
||||
assertThat(stages.isSmoke()).isFalse()
|
||||
assertThat(stages.isTdd()).isFalse()
|
||||
|
||||
@@ -62,6 +62,17 @@ void call(String pathToConfig, String nodeForRead = '') {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Check Extensions') {
|
||||
when { expression { config.stages.checkExtensions } }
|
||||
options {
|
||||
timeout(time: config.checkExtensionsOptional.timeout, unit: TimeUnit.MINUTES)
|
||||
}
|
||||
|
||||
steps {
|
||||
script { checkExtensions(config, config.checkExtensionsOptional, state) }
|
||||
}
|
||||
}
|
||||
|
||||
stage('Syntax check') {
|
||||
when { expression { config.stages.syntaxCheck } }
|
||||
options {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Vanessa-Usher
|
||||
* Copyright (C) 2019-2022 SilverBulleters, LLC - All Rights Reserved.
|
||||
* Unauthorized copying of this file in any way is strictly prohibited.
|
||||
* Proprietary and confidential.
|
||||
*/
|
||||
import groovy.transform.Field
|
||||
import org.silverbulleters.usher.config.PipelineConfiguration
|
||||
import org.silverbulleters.usher.config.stage.CheckExtensionsOptional
|
||||
import org.silverbulleters.usher.state.PipelineState
|
||||
import org.silverbulleters.usher.wrapper.VRunner
|
||||
|
||||
|
||||
@Field
|
||||
PipelineConfiguration config
|
||||
|
||||
@Field
|
||||
PipelineState state
|
||||
|
||||
@Field
|
||||
CheckExtensionsOptional stageOptional
|
||||
|
||||
@Field
|
||||
Map result = [
|
||||
"junit" : [],
|
||||
"allure": [],
|
||||
"error": false
|
||||
]
|
||||
|
||||
/**
|
||||
* Выполнить проверку применимости расширения для использования в конкретной информационной базе
|
||||
* @param config конфигурацию
|
||||
* @param stageOptional дополнительные параметры
|
||||
* @param state состояние конвейера
|
||||
*/
|
||||
void call(PipelineConfiguration config, CheckExtensionsOptional stageOptional, PipelineState state) {
|
||||
this.config = config
|
||||
this.state = state
|
||||
this.stageOptional = stageOptional
|
||||
|
||||
catchError(message: 'Ошибка во время выполнения проверки применимости расширений', buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
check()
|
||||
}
|
||||
|
||||
testResultsHelper.archiveTestResults(
|
||||
name: stageOptional.name,
|
||||
junit: result.junit,
|
||||
allure: result.allure,
|
||||
stashes: state.checkExtensions.stashes
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
private def check() {
|
||||
def auth = config.defaultInfobase.auth
|
||||
if (credentialHelper.authIsPresent(auth)) {
|
||||
withCredentials([usernamePassword(credentialsId: auth, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
def credential = credentialHelper.getAuthString()
|
||||
CheckExtension(credential)
|
||||
}
|
||||
} else {
|
||||
CheckExtension()
|
||||
}
|
||||
}
|
||||
|
||||
private def CheckExtension(credential = '') {
|
||||
|
||||
CheckExtensionByOptional(credential)
|
||||
|
||||
}
|
||||
|
||||
private def CheckExtensionByOptional(String credential) {
|
||||
|
||||
def command = VRunner.checkCanApplyExtensions(
|
||||
config,
|
||||
stageOptional
|
||||
)
|
||||
|
||||
command = command.replace("%credentialID%", credential)
|
||||
|
||||
auth = stageOptional.getRepo().getAuth()
|
||||
|
||||
withCredentials([usernamePassword(credentialsId: auth, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
def credentialRepo = credentialHelper.getAuthRepoString()
|
||||
command = command.replace("%credentialStorageID%", credentialRepo)
|
||||
try {
|
||||
cmdRun(command)
|
||||
} catch (exception) {
|
||||
result.error = true
|
||||
logger.info(exception.getMessage())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user