You've already forked vanessa-usher
mirror of
https://github.com/silverbulleters/vanessa-usher.git
synced 2026-06-21 01:29:42 +02:00
Merge pull request #18 from KSidelnikov/VU-10629
VU-10629: Загрузка расширений из хранилища, сборка расширений
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
# Изменения версий
|
||||
|
||||
## 2.4.0
|
||||
|
||||
### Новое в версии
|
||||
|
||||
* Добавлена возможность загрузки расширений из хранилища расширения на этапе `prepareBase`
|
||||
* Добавлена сборка расширений на этапе `build`
|
||||
|
||||
### Дополнительно
|
||||
|
||||
* Исправлена ошибка переопределения каталога сборки на этапе `build`
|
||||
* Удалено ошибочное формирование отчетов на этапе `runExternal`
|
||||
* Сборка поставки и расширений переведена на `vanessa-runner`
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Новое в версии
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
val junitVersion = "5.6.1"
|
||||
|
||||
group = "org.github.silverbulleters"
|
||||
version = "2.3.0"
|
||||
version = "2.4.0"
|
||||
|
||||
plugins {
|
||||
java
|
||||
@@ -37,7 +37,7 @@ dependencies {
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8;
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
"repo" : {
|
||||
"path" : "",
|
||||
"auth" : "",
|
||||
"empty" : false
|
||||
"empty" : true
|
||||
},
|
||||
"extensions" : [ ]
|
||||
},
|
||||
@@ -74,7 +74,7 @@
|
||||
"repo" : {
|
||||
"path" : "",
|
||||
"auth" : "",
|
||||
"empty" : false
|
||||
"empty" : true
|
||||
},
|
||||
"extensions" : ""
|
||||
},
|
||||
@@ -119,7 +119,7 @@
|
||||
},
|
||||
"build" : {
|
||||
"timeout" : 100,
|
||||
"distPath" : ".packman/1cv8.cf",
|
||||
"distPath" : "./build",
|
||||
"errorIfJobStatusOfFailure" : false
|
||||
},
|
||||
"yard" : {
|
||||
|
||||
@@ -249,6 +249,11 @@
|
||||
"sourcePath" : {
|
||||
"type" : "string",
|
||||
"description" : "Путь к исходному коду расширения 1С. По умолчанию пустое значение и будет пропущено\n при обновлении информационной базы.\n "
|
||||
},
|
||||
"repo" : {
|
||||
"type" : "object",
|
||||
"$ref" : "urn:jsonschema:org:silverbulleters:usher:config:additional:Repo",
|
||||
"description" : "Настройки подключения к хранилищу расширения конфигурации 1С"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -485,7 +490,7 @@
|
||||
},
|
||||
"distPath" : {
|
||||
"type" : "string",
|
||||
"description" : "Путь к собранной cf на поставке"
|
||||
"description" : "Путь к каталогу сборки (*.cf, *.cfe)"
|
||||
},
|
||||
"errorIfJobStatusOfFailure" : {
|
||||
"type" : "boolean",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Unauthorized copying of this file in any way is strictly prohibited.
|
||||
* Proprietary and confidential.
|
||||
*/
|
||||
package org.silverbulleters.usher;
|
||||
package org.silverbulleters.usher
|
||||
|
||||
/**
|
||||
* Константы проекта
|
||||
@@ -18,7 +18,7 @@ class UsherConstant {
|
||||
/**
|
||||
* Версия проекта
|
||||
*/
|
||||
static final String PROJECT_VERSION = "2.3.0"
|
||||
static final String PROJECT_VERSION = "2.4.0"
|
||||
|
||||
/**
|
||||
* Путь к каталогу с отчетами в формате jUnit
|
||||
|
||||
@@ -25,4 +25,7 @@ class ExtensionSource {
|
||||
""")
|
||||
String sourcePath = ''
|
||||
|
||||
@JsonPropertyDescription("Настройки подключения к хранилищу расширения конфигурации 1С")
|
||||
Repo repo = new Repo()
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ class Repo {
|
||||
String auth = ''
|
||||
|
||||
boolean isEmpty() {
|
||||
return !path.isEmpty()
|
||||
return path.isEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,15 @@ package org.silverbulleters.usher.config.stage
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription
|
||||
import org.silverbulleters.usher.config.additional.ExtensionSource
|
||||
|
||||
/**
|
||||
* Настройки этапа сборки CF на поставке
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
class BuildOptional extends BaseOptional {
|
||||
/* TODO: реализовать смену рабочего каталога packman */
|
||||
@JsonPropertyDescription("Путь к собранной cf на поставке")
|
||||
String distPath = '.packman/1cv8.cf'
|
||||
@JsonPropertyDescription("Путь к каталогу сборки (*.cf, *.cfe)")
|
||||
String distPath = './build'
|
||||
|
||||
@JsonPropertyDescription("Прерывать этап если статус сборки равен FAILURE")
|
||||
boolean errorIfJobStatusOfFailure = false
|
||||
|
||||
@@ -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.BuildOptional
|
||||
import org.silverbulleters.usher.config.stage.RunExternalDataProcessorsOptional
|
||||
import org.silverbulleters.usher.config.stage.CheckExtensionsOptional
|
||||
import org.silverbulleters.usher.config.stage.PrepareBaseOptional
|
||||
@@ -137,6 +138,29 @@ class VRunner {
|
||||
return command.join(" ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Загрузить расширение конфигурации из хранилища 1С
|
||||
* @param config конфигурация
|
||||
* @param source описание расширения
|
||||
* @return строка команды
|
||||
*/
|
||||
static def loadExtRepo(PipelineConfiguration config, ExtensionSource source) {
|
||||
def command = [
|
||||
"vrunner",
|
||||
"loadrepo",
|
||||
"%credentialID%",
|
||||
"--settings", config.vrunnerConfig,
|
||||
"--ibconnection", Common.getConnectionString(config),
|
||||
"%credentialStorageID%",
|
||||
"--v8version", config.v8Version,
|
||||
"--storage-name", source.repo.path,
|
||||
"--extension", source.name,
|
||||
"--nocacheuse"
|
||||
]
|
||||
|
||||
return command.join(" ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Обновить информационную базу
|
||||
* @param config конфигурация
|
||||
@@ -156,6 +180,26 @@ class VRunner {
|
||||
return command.join(" ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Обновить расширение информационной базы
|
||||
* @param config конфигурация
|
||||
* @param source описание расширения
|
||||
* @return строка команды
|
||||
*/
|
||||
static def updateExt(PipelineConfiguration config, ExtensionSource source) {
|
||||
def command = [
|
||||
"vrunner",
|
||||
"updateext",
|
||||
source.name,
|
||||
"%credentialID%",
|
||||
"--settings", config.vrunnerConfig,
|
||||
"--ibconnection", Common.getConnectionString(config),
|
||||
"--v8version", config.v8Version,
|
||||
"--nocacheuse"
|
||||
]
|
||||
return command.join(" ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Запустить "типовое" мигрирование после обновление информационной базы 1С
|
||||
* @param config конфигурация
|
||||
@@ -353,4 +397,46 @@ class VRunner {
|
||||
return command.join(" ")
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Выгрузить файл расширения из конфигурации
|
||||
* @param config конфигурация
|
||||
* @param optional настройки шага
|
||||
* @param source описание расширения
|
||||
* @return строка команды
|
||||
*/
|
||||
static def unloadExt(PipelineConfiguration config, BuildOptional optional, ExtensionSource source) {
|
||||
def command = [
|
||||
"vrunner",
|
||||
"unloadext",
|
||||
"${optional.distPath}/${source.name}.cfe",
|
||||
source.name,
|
||||
"%credentialID%",
|
||||
"--settings", config.vrunnerConfig,
|
||||
"--ibconnection", Common.getConnectionString(config),
|
||||
"--v8version", config.v8Version,
|
||||
"--nocacheuse"
|
||||
]
|
||||
return command.join(" ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Выгрузить файл поставки из конфигурации
|
||||
* @param config конфигурация
|
||||
* @param optional настройки шага
|
||||
* @return строка команды
|
||||
*/
|
||||
static def makeDist(PipelineConfiguration config, BuildOptional optional) {
|
||||
def command = [
|
||||
"vrunner",
|
||||
"make-dist",
|
||||
"${optional.distPath}/1cv8.cf",
|
||||
"%credentialID%",
|
||||
"--settings", config.vrunnerConfig,
|
||||
"--ibconnection", Common.getConnectionString(config),
|
||||
"--v8version", config.v8Version,
|
||||
"--nocacheuse"
|
||||
]
|
||||
return command.join(" ")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
*/
|
||||
import groovy.transform.Field
|
||||
import org.silverbulleters.usher.config.PipelineConfiguration
|
||||
import org.silverbulleters.usher.config.additional.ExtensionSource
|
||||
import org.silverbulleters.usher.config.stage.BuildOptional
|
||||
import org.silverbulleters.usher.state.PipelineState
|
||||
import org.silverbulleters.usher.wrapper.Packman
|
||||
import org.silverbulleters.usher.wrapper.VRunner
|
||||
|
||||
@Field
|
||||
PipelineConfiguration config
|
||||
@@ -49,7 +51,7 @@ private void runBuild() {
|
||||
def auth = config.defaultInfobase.auth
|
||||
if (credentialHelper.authIsPresent(auth)) {
|
||||
withCredentials([usernamePassword(credentialsId: auth, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
def credential = credentialHelper.getCustomAuth("-db-user", "-db-pwd")
|
||||
def credential = credentialHelper.getCustomAuth("--db-user", "--db-pwd")
|
||||
runBuildInternal(credential)
|
||||
}
|
||||
} else {
|
||||
@@ -58,15 +60,27 @@ private void runBuild() {
|
||||
}
|
||||
|
||||
private void runBuildInternal(String credential = '') {
|
||||
def command = Packman.setDatabase(config, credential)
|
||||
cmdRun(command)
|
||||
|
||||
command = Packman.makeCf(config)
|
||||
cmdRun(command)
|
||||
buildConfiguration(credential)
|
||||
config.prepareBaseOptional.extensions.each {source ->
|
||||
buildExtension(source, credential)
|
||||
}
|
||||
}
|
||||
|
||||
private void archiving() {
|
||||
if (fileExists(stageOptional.getDistPath())) {
|
||||
archiveArtifacts stageOptional.getDistPath()
|
||||
def distPath = stageOptional.getDistPath()
|
||||
if (fileExists(distPath)) {
|
||||
archiveArtifacts artifacts: "${distPath}/*.cf,${distPath}/*.cfe"
|
||||
}
|
||||
}
|
||||
|
||||
private void buildConfiguration(String credential) {
|
||||
def command = VRunner.makeDist(config, stageOptional)
|
||||
command = command.replace("%credentialID%", credential)
|
||||
cmdRun(command)
|
||||
}
|
||||
|
||||
private void buildExtension(ExtensionSource source, String credential) {
|
||||
def command = VRunner.unloadExt(config, stageOptional, source)
|
||||
command = command.replace("%credentialID%", credential)
|
||||
cmdRun(command)
|
||||
}
|
||||
@@ -51,7 +51,7 @@ private void prepareBase() {
|
||||
private void prepareBaseInternal(String credential = '') {
|
||||
|
||||
if (stageOptional.template.isEmpty()) {
|
||||
if (stageOptional.repo.isEmpty()) {
|
||||
if (!stageOptional.repo.isEmpty()) {
|
||||
loadRepo(credential)
|
||||
updateDB(credential)
|
||||
} else {
|
||||
@@ -64,14 +64,34 @@ private void prepareBaseInternal(String credential = '') {
|
||||
}
|
||||
|
||||
stageOptional.extensions.each { source ->
|
||||
if (!source.name.empty || !source.sourcePath.empty) {
|
||||
compileExt(source, credential)
|
||||
if (!source.name.empty) {
|
||||
if (!source.repo.isEmpty()) {
|
||||
loadExtRepo(source, credential)
|
||||
} else if (!source.sourcePath.empty) {
|
||||
compileExt(source, credential)
|
||||
}
|
||||
updateExt(source, credential)
|
||||
}
|
||||
}
|
||||
|
||||
migrate(credential)
|
||||
}
|
||||
|
||||
private void loadExtRepo(ExtensionSource source, String credential) {
|
||||
def command = VRunner.loadExtRepo(config, source)
|
||||
|
||||
def auth = source.getRepo().getAuth()
|
||||
def credentialRepo = ''
|
||||
withCredentials([usernamePassword(credentialsId: auth, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
credentialRepo = credentialHelper.getAuthRepoString()
|
||||
}
|
||||
|
||||
command = command.replace("%credentialID%", credential)
|
||||
command = command.replace("%credentialStorageID%", credentialRepo)
|
||||
|
||||
cmdRun(command)
|
||||
}
|
||||
|
||||
private void loadRepo(credential) {
|
||||
def repoVersion = common.getRepoVersion(stageOptional.sourcePath)
|
||||
def command = VRunner.loadRepo(config, stageOptional, repoVersion)
|
||||
@@ -91,6 +111,12 @@ private void updateDB(credential) {
|
||||
cmdRun(command)
|
||||
}
|
||||
|
||||
private void updateExt(ExtensionSource source, String credential) {
|
||||
def command = VRunner.updateExt(config, source)
|
||||
command = command.replace("%credentialID%", credential)
|
||||
cmdRun(command)
|
||||
}
|
||||
|
||||
private void initDevWithTemplate(credential) {
|
||||
def command = VRunner.initDevWithTemplate(config, stageOptional)
|
||||
command = command.replace("%credentialID%", credential)
|
||||
|
||||
@@ -35,10 +35,6 @@ void call(PipelineConfiguration config, RunExternalDataProcessorsOptional stageO
|
||||
testing()
|
||||
}
|
||||
|
||||
catchError(message: 'Ошибка во время архивации отчетов о тестировании', buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
testResultsHelper.packTestResults(config, stageOptional, state.runExternal)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private def testing() {
|
||||
|
||||
Reference in New Issue
Block a user