1
0
mirror of https://github.com/firstBitMarksistskaya/jenkins-lib.git synced 2025-08-25 20:09:25 +02:00

mv syntaxCheck to separate class, add publish to allure

This commit is contained in:
Dima
2025-01-17 13:18:50 +03:00
parent 89e104feec
commit 161a4f58b9
6 changed files with 135 additions and 70 deletions

View File

@@ -1,64 +1,12 @@
import hudson.FilePath
import ru.pulsar.jenkins.library.configuration.JobConfiguration
import ru.pulsar.jenkins.library.ioc.ContextRegistry
import ru.pulsar.jenkins.library.utils.FileUtils
import ru.pulsar.jenkins.library.utils.VRunner
import ru.pulsar.jenkins.library.steps.SyntaxCheck
def call(JobConfiguration config) {
ContextRegistry.registerDefaultContext(this)
// TODO: Вынести в отдельный класс по аналогии с SonarScanner
def syntaxCheck = new SyntaxCheck(config)
syntaxCheck.run()
printLocation()
if (!config.stageFlags.syntaxCheck) {
echo("Syntax-check step is disabled")
return
}
def options = config.syntaxCheckOptions
installLocalDependencies()
unzipInfobase()
FilePath pathToJUnitReport = FileUtils.getFilePath("$env.WORKSPACE/$options.pathToJUnitReport")
String outPath = pathToJUnitReport.getParent()
createDir(outPath)
String vrunnerPath = VRunner.getVRunnerPath();
String command = "$vrunnerPath syntax-check --ibconnection \"/F./build/ib\""
// Временно убрал передачу параметра.
// См. https://github.com/vanessa-opensource/vanessa-runner/issues/361
// command += " --workspace $env.WORKSPACE"
if (options.groupErrorsByMetadata) {
command += ' --groupbymetadata'
}
command += " --junitpath $pathToJUnitReport";
FilePath vrunnerSettings = FileUtils.getFilePath("$env.WORKSPACE/$options.vrunnerSettings")
if (vrunnerSettings.exists()) {
command += " --settings $vrunnerSettings";
}
if (!options.exceptionFile.empty && fileExists(options.exceptionFile)) {
command += " --exception-file $options.exceptionFile"
}
if (options.checkModes.length > 0) {
def checkModes = options.checkModes.join(" ")
command += " --mode $checkModes"
}
// Запуск синтакс-проверки
VRunner.exec(command, true)
junit allowEmptyResults: true, testResults: FileUtils.getLocalPath(pathToJUnitReport)
archiveArtifacts FileUtils.getLocalPath(pathToJUnitReport)
}