mirror of
https://github.com/firstBitMarksistskaya/jenkins-lib.git
synced 2025-02-07 14:18:35 +02:00
refactoring and fixes
This commit is contained in:
parent
f17c9ae4b7
commit
e711f86749
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1,3 @@
|
||||
*.groovy eol=lf
|
||||
*.md eol=lf
|
||||
*.os eol=lf
|
||||
|
3
resources/dbgs.os
Normal file
3
resources/dbgs.os
Normal file
@ -0,0 +1,3 @@
|
||||
#Использовать v8find
|
||||
|
||||
Сообщить(Платформа1С.ПутьКDBGS(АргументыКоманднойСтроки[0]));
|
@ -87,10 +87,10 @@
|
||||
"publishToAllureReport": false,
|
||||
"publishToJUnitReport": true,
|
||||
"coverage": false,
|
||||
"dbgsPort": 1551
|
||||
"dbgsPort": 1550
|
||||
},
|
||||
"coverage": {
|
||||
"dbgsPath": "dbgs",
|
||||
"dbgsPath": "",
|
||||
"coverage41CPath": "Coverage41C"
|
||||
},
|
||||
"yaxunit": {
|
||||
@ -99,7 +99,7 @@
|
||||
"publishToAllureReport": false,
|
||||
"publishToJUnitReport": true,
|
||||
"coverage": false,
|
||||
"dbgsPort": 1552
|
||||
"dbgsPort": 1550
|
||||
},
|
||||
"resultsTransform": {
|
||||
"transformer": "stebi",
|
||||
|
@ -30,11 +30,13 @@
|
||||
"properties" : {
|
||||
"coverage" : {
|
||||
"type" : "boolean",
|
||||
"description" : "Выполнять замер покрытия"
|
||||
"description" : "Выполнять замер покрытия",
|
||||
"default" : "false"
|
||||
},
|
||||
"dbgsPort" : {
|
||||
"type" : "integer",
|
||||
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия"
|
||||
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия",
|
||||
"default" : "1550"
|
||||
},
|
||||
"vrunnerSteps" : {
|
||||
"description" : "Шаги, запускаемые через vrunner.\n В каждой строке передается отдельная команда \n vrunner и ее аргументы (например, \"vanessa --settings ./tools/vrunner.json\").\n По умолчанию содержит одну команду \"vanessa --settings ./tools/vrunner.json\".\n ",
|
||||
@ -55,7 +57,7 @@
|
||||
},
|
||||
"dbgsPath" : {
|
||||
"type" : "string",
|
||||
"description" : "Путь к исполняемому файлу dbgs.\n По умолчанию ищется в PATH.\n "
|
||||
"description" : "Путь к исполняемому файлу dbgs.\n По умолчанию ищется с помощью v8find для указанной версии платформы (v8version).\n "
|
||||
}
|
||||
},
|
||||
"description" : "Настройки замеров покрытия"
|
||||
@ -247,11 +249,13 @@
|
||||
"properties" : {
|
||||
"coverage" : {
|
||||
"type" : "boolean",
|
||||
"description" : "Выполнять замер покрытия"
|
||||
"description" : "Выполнять замер покрытия",
|
||||
"default" : "false"
|
||||
},
|
||||
"dbgsPort" : {
|
||||
"type" : "integer",
|
||||
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия"
|
||||
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия",
|
||||
"default" : "1550"
|
||||
},
|
||||
"publishToAllureReport" : {
|
||||
"type" : "boolean",
|
||||
@ -464,11 +468,13 @@
|
||||
},
|
||||
"coverage" : {
|
||||
"type" : "boolean",
|
||||
"description" : "Выполнять замер покрытия"
|
||||
"description" : "Выполнять замер покрытия",
|
||||
"default" : "false"
|
||||
},
|
||||
"dbgsPort" : {
|
||||
"type" : "integer",
|
||||
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия"
|
||||
"description" : "Порт, на котором будет запущен сервер отладки для замера покрытия",
|
||||
"default" : "1550"
|
||||
},
|
||||
"publishToAllureReport" : {
|
||||
"type" : "boolean",
|
||||
|
@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription
|
||||
class GlobalCoverageOptions implements Serializable {
|
||||
|
||||
@JsonPropertyDescription('''Путь к исполняемому файлу dbgs.
|
||||
По умолчанию ищется в PATH.
|
||||
По умолчанию ищется с помощью v8find для указанной версии платформы (v8version).
|
||||
''')
|
||||
String dbgsPath
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
package ru.pulsar.jenkins.library.configuration
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription
|
||||
|
||||
class StepCoverageOptions implements Serializable {
|
||||
|
||||
@JsonPropertyDescription("Выполнять замер покрытия")
|
||||
@JsonProperty(defaultValue = "false")
|
||||
Boolean coverage = false
|
||||
|
||||
@JsonPropertyDescription("Порт, на котором будет запущен сервер отладки для замера покрытия")
|
||||
@JsonProperty(defaultValue = "1550")
|
||||
Integer dbgsPort = 1550
|
||||
|
||||
}
|
||||
|
@ -34,16 +34,17 @@ class WithCoverage implements Serializable {
|
||||
}
|
||||
|
||||
body()
|
||||
} catch (Exception e) {
|
||||
throw new Exception("При выполнении блока произошла ошибка: ${e}")
|
||||
} finally {
|
||||
if (coverageOptions.coverage) {
|
||||
CoverageUtils.stopCoverage(steps, config, context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (coverageOptions.coverage) {
|
||||
steps.stash(stage.getCoverageStashName(), stage.getCoverageStashPath(), true)
|
||||
if (coverageOptions.coverage) {
|
||||
steps.stash(stage.getCoverageStashName(), stage.getCoverageStashPath(), true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -49,9 +49,11 @@ class CoverageUtils {
|
||||
|
||||
def coverageOpts = config.coverageOptions
|
||||
|
||||
steps.start("${coverageOpts.dbgsPath} --addr=127.0.0.1 --port=$coverageContext.port")
|
||||
steps.start("${coverageOpts.coverage41CPath} start -i DefAlias -u http://127.0.0.1:$coverageContext.port -P $workspaceDir -s $srcDir -o ${stage.getCoverageStashPath()}")
|
||||
steps.cmd("${coverageOpts.coverage41CPath} check -i DefAlias -u http://127.0.0.1:$coverageContext.port")
|
||||
String dbgsPath = findDbgs(steps, config)
|
||||
|
||||
steps.start("${dbgsPath} --addr=127.0.0.1 --port=${coverageContext.port}")
|
||||
steps.start("${coverageOpts.coverage41CPath} start -i DefAlias -u http://127.0.0.1:${coverageContext.port} -P $workspaceDir -s $srcDir -o ${stage.getCoverageStashPath()}")
|
||||
steps.cmd("${coverageOpts.coverage41CPath} check -i DefAlias -u http://127.0.0.1:${coverageContext.port}")
|
||||
|
||||
def newDbgsPids = getPIDs("dbgs")
|
||||
def newCoverage41CPids = getPIDs("Coverage41C")
|
||||
@ -74,4 +76,23 @@ class CoverageUtils {
|
||||
steps.cmd("${coverageOpts.coverage41CPath} stop -i DefAlias -u http://127.0.0.1:$coverageContext.port")
|
||||
}
|
||||
|
||||
static String findDbgs(IStepExecutor steps, JobConfiguration config) {
|
||||
|
||||
String dbgsPath = config.coverageOptions.dbgsPath
|
||||
if (dbgsPath.isEmpty()) {
|
||||
def osResourcePath = steps.libraryResource "dbgs.os"
|
||||
final osResultPath = "build/dbgs.os"
|
||||
steps.writeFile(osResultPath, osResourcePath, 'UTF-8')
|
||||
|
||||
dbgsPath = steps.cmd("oscript ${osResultPath} ${config.v8version}", false, true)
|
||||
}
|
||||
|
||||
if (dbgsPath.isEmpty()) {
|
||||
steps.error("Не удалось найти путь к dbgs")
|
||||
}
|
||||
|
||||
return dbgsPath.strip()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user