mirror of
https://github.com/firstBitMarksistskaya/jenkins-lib.git
synced 2025-03-19 21:37:49 +02:00
Запуск синтаксического контроля
This commit is contained in:
parent
40fc1b4cc8
commit
66ac4b10c9
@ -9,5 +9,23 @@
|
|||||||
"sonarQubeInstallation": "",
|
"sonarQubeInstallation": "",
|
||||||
"useSonarScannerFromPath": true,
|
"useSonarScannerFromPath": true,
|
||||||
"sonarScannerToolName": "sonar-scanner"
|
"sonarScannerToolName": "sonar-scanner"
|
||||||
|
},
|
||||||
|
"syntaxCheck": {
|
||||||
|
"enabled": false,
|
||||||
|
"groupErrorsByMetadata": true,
|
||||||
|
"pathToJUnitReport": "./build/out/jUnit/syntax.xml",
|
||||||
|
"checkModes": [
|
||||||
|
"-ThinClient",
|
||||||
|
"-WebClient",
|
||||||
|
"-Server",
|
||||||
|
"-ExtendedModulesCheck",
|
||||||
|
"-IncorrectReferences",
|
||||||
|
"-UnreferenceProcedures",
|
||||||
|
"-HandlersExistence",
|
||||||
|
"-EmptyHandlers",
|
||||||
|
"-CheckUseModality",
|
||||||
|
"-CheckUseSynchronousCalls",
|
||||||
|
"-DistributiveModules"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,32 @@
|
|||||||
"description" : "Имя настроенной утилиты sonar-scanner.\nПрименяется, если useSonarScannerFromPath установлено в false."
|
"description" : "Имя настроенной утилиты sonar-scanner.\nПрименяется, если useSonarScannerFromPath установлено в false."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"syntaxCheck" : {
|
||||||
|
"type" : "object",
|
||||||
|
"id" : "urn:jsonschema:ru:pulsar:jenkins:library:configuration:SyntaxCheckOptions",
|
||||||
|
"description" : "Настройки синтаксического контроля",
|
||||||
|
"properties" : {
|
||||||
|
"enabled" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"description" : "Синтаксический контроль включен"
|
||||||
|
},
|
||||||
|
"pathToJUnitReport" : {
|
||||||
|
"type" : "string",
|
||||||
|
"description" : "Путь к файлу отчета jUnit"
|
||||||
|
},
|
||||||
|
"groupErrorsByMetadata" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"description" : "Группировать выявленные ошибки по объектам метаданных"
|
||||||
|
},
|
||||||
|
"checkModes" : {
|
||||||
|
"type" : "array",
|
||||||
|
"description" : "Режимы проверки конфигурации",
|
||||||
|
"items" : {
|
||||||
|
"type" : "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,7 +34,8 @@ class ConfigurationReader implements Serializable {
|
|||||||
) {
|
) {
|
||||||
def nonMergeableSettings = Arrays.asList(
|
def nonMergeableSettings = Arrays.asList(
|
||||||
"secrets",
|
"secrets",
|
||||||
"sonarQubeOptions"
|
"sonarQubeOptions",
|
||||||
|
"syntaxCheckOptions"
|
||||||
).toSet()
|
).toSet()
|
||||||
|
|
||||||
mergeObjects(baseConfiguration, configurationToMerge, nonMergeableSettings)
|
mergeObjects(baseConfiguration, configurationToMerge, nonMergeableSettings)
|
||||||
|
@ -17,6 +17,10 @@ class JobConfiguration implements Serializable {
|
|||||||
@JsonPropertyDescription("Настройки анализа SonarQube")
|
@JsonPropertyDescription("Настройки анализа SonarQube")
|
||||||
SonarQubeOptions sonarQubeOptions;
|
SonarQubeOptions sonarQubeOptions;
|
||||||
|
|
||||||
|
@JsonProperty("syntaxCheck")
|
||||||
|
@JsonPropertyDescription("Настройки синтаксического контроля")
|
||||||
|
SyntaxCheckOptions syntaxCheckOptions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonCPS
|
@NonCPS
|
||||||
String toString() {
|
String toString() {
|
||||||
@ -24,6 +28,7 @@ class JobConfiguration implements Serializable {
|
|||||||
"v8version='" + v8version + '\'' +
|
"v8version='" + v8version + '\'' +
|
||||||
", secrets=" + secrets +
|
", secrets=" + secrets +
|
||||||
", sonarQubeOptions=" + sonarQubeOptions +
|
", sonarQubeOptions=" + sonarQubeOptions +
|
||||||
|
", syntaxCheckOptions=" + syntaxCheckOptions +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package ru.pulsar.jenkins.library.configuration
|
||||||
|
|
||||||
|
import com.cloudbees.groovy.cps.NonCPS
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||||
|
import com.fasterxml.jackson.annotation.JsonPropertyDescription
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
class SyntaxCheckOptions implements Serializable {
|
||||||
|
|
||||||
|
@JsonPropertyDescription("Синтаксический контроль включен")
|
||||||
|
boolean enabled
|
||||||
|
|
||||||
|
@JsonPropertyDescription("Путь к файлу отчета jUnit")
|
||||||
|
String pathToJUnitReport
|
||||||
|
|
||||||
|
@JsonPropertyDescription("Группировать выявленные ошибки по объектам метаданных")
|
||||||
|
boolean groupErrorsByMetadata;
|
||||||
|
|
||||||
|
@JsonPropertyDescription("Режимы проверки конфигурации")
|
||||||
|
String[] checkModes;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NonCPS
|
||||||
|
String toString() {
|
||||||
|
return "SyntaxCheckOptions{" +
|
||||||
|
"enabled=" + enabled +
|
||||||
|
", pathToJUnitReport='" + pathToJUnitReport + '\'' +
|
||||||
|
", groupErrorsByMetadata=" + groupErrorsByMetadata +
|
||||||
|
", checkModes=" + checkModes +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -36,6 +36,7 @@ class ConfigurationReaderTest {
|
|||||||
.hasFieldOrPropertyWithValue("storage", "1234")
|
.hasFieldOrPropertyWithValue("storage", "1234")
|
||||||
.hasFieldOrPropertyWithValue("storagePath", "UNKNOWN_ID")
|
.hasFieldOrPropertyWithValue("storagePath", "UNKNOWN_ID")
|
||||||
;
|
;
|
||||||
|
assertThat(jobConfiguration.getSyntaxCheckOptions().getCheckModes()).hasSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,5 +2,9 @@
|
|||||||
"v8version": "8.3.14.1944",
|
"v8version": "8.3.14.1944",
|
||||||
"secrets": {
|
"secrets": {
|
||||||
"storage": "1234"
|
"storage": "1234"
|
||||||
|
},
|
||||||
|
"syntaxCheck": {
|
||||||
|
"enabled": true,
|
||||||
|
"checkModes": ["-ThinClient"]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -69,16 +69,7 @@ void call() {
|
|||||||
parallel {
|
parallel {
|
||||||
stage('Синтаксический контроль') {
|
stage('Синтаксический контроль') {
|
||||||
steps {
|
steps {
|
||||||
printLocation()
|
syntaxCheck config
|
||||||
|
|
||||||
installLocalDependencies()
|
|
||||||
|
|
||||||
unzipInfobase()
|
|
||||||
|
|
||||||
// Запуск синтакс-проверки
|
|
||||||
cmd("oscript_modules/bin/vrunner syntax-check --settings tools/vrunner.json", true)
|
|
||||||
|
|
||||||
junit allowEmptyResults: true, testResults: 'build/out/junitsyntax.xml'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
39
vars/syntaxCheck.groovy
Normal file
39
vars/syntaxCheck.groovy
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import hudson.FilePath
|
||||||
|
import ru.pulsar.jenkins.library.configuration.JobConfiguration
|
||||||
|
import ru.pulsar.jenkins.library.ioc.ContextRegistry
|
||||||
|
|
||||||
|
def call(JobConfiguration config) {
|
||||||
|
|
||||||
|
ContextRegistry.registerDefaultContext(this)
|
||||||
|
|
||||||
|
printLocation()
|
||||||
|
|
||||||
|
def options = config.syntaxCheckOptions
|
||||||
|
if (!options.enabled) {
|
||||||
|
echo("Syntax-check step is disabled")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
installLocalDependencies()
|
||||||
|
|
||||||
|
unzipInfobase()
|
||||||
|
|
||||||
|
def junitPath = new FilePath(new File(options.pathToJUnitReport))
|
||||||
|
junitPath.mkdirs()
|
||||||
|
|
||||||
|
String command = "oscript_modules/bin/vrunner syntax-check --ibconnection \"/F./build/ib\""
|
||||||
|
|
||||||
|
if (options.groupErrorsByMetadata) {
|
||||||
|
command += " --groupbymetadata"
|
||||||
|
}
|
||||||
|
|
||||||
|
command += " --junitpath " + options.pathToJUnitReport;
|
||||||
|
|
||||||
|
command += " --mode " + options.checkModes.join(" ")
|
||||||
|
|
||||||
|
// Запуск синтакс-проверки
|
||||||
|
cmd(command, true)
|
||||||
|
|
||||||
|
junit allowEmptyResults: true, testResults: options.pathToJUnitReport
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user