mirror of
https://github.com/firstBitMarksistskaya/jenkins-lib.git
synced 2025-02-08 14:29:15 +02:00
Трансформация edt-validate в generic issue
This commit is contained in:
parent
aa8f96de70
commit
fca4fe4154
@ -31,4 +31,8 @@ interface IStepExecutor {
|
||||
def withEnv(List<String> strings, Closure body)
|
||||
|
||||
def archiveArtifacts(String path)
|
||||
|
||||
def stash(String name, String includes)
|
||||
|
||||
def unstash(String name)
|
||||
}
|
@ -78,4 +78,14 @@ class StepExecutor implements IStepExecutor {
|
||||
def archiveArtifacts(String path) {
|
||||
steps.archiveArtifacts path
|
||||
}
|
||||
|
||||
@Override
|
||||
def stash(String name, String includes) {
|
||||
steps.stash name: name, includes: includes
|
||||
}
|
||||
|
||||
@Override
|
||||
def unstash(String name) {
|
||||
steps.unstash name
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class EdtValidate implements Serializable {
|
||||
Logger.printLocation()
|
||||
|
||||
if (!config.stageFlags.edtValidate) {
|
||||
steps.echo("EDT validate step is disabled")
|
||||
Logger.println("EDT validate step is disabled")
|
||||
return
|
||||
}
|
||||
|
||||
@ -54,5 +54,6 @@ class EdtValidate implements Serializable {
|
||||
}
|
||||
|
||||
steps.archiveArtifacts(resultFileRelative)
|
||||
steps.stash('edt-validate', resultFileRelative)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
package ru.pulsar.jenkins.library.steps
|
||||
|
||||
import ru.pulsar.jenkins.library.IStepExecutor
|
||||
import ru.pulsar.jenkins.library.configuration.JobConfiguration
|
||||
import ru.pulsar.jenkins.library.ioc.ContextRegistry
|
||||
import ru.pulsar.jenkins.library.utils.Logger
|
||||
|
||||
class ResultsTransformer implements Serializable {
|
||||
|
||||
private final JobConfiguration config;
|
||||
private final String rootDir
|
||||
|
||||
ResultsTransformer(JobConfiguration config, String rootDir = 'src/cf') {
|
||||
this.config = config
|
||||
this.rootDir = rootDir
|
||||
}
|
||||
|
||||
def run() {
|
||||
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()
|
||||
|
||||
Logger.printLocation()
|
||||
|
||||
if (!config.stageFlags.sonarqube) {
|
||||
Logger.println("No transform is needed.")
|
||||
return
|
||||
}
|
||||
|
||||
def env = steps.env();
|
||||
|
||||
if (!config.stageFlags.edtValidate) {
|
||||
Logger.println("EDT validation is disabled. No transform is needed.")
|
||||
return
|
||||
}
|
||||
|
||||
steps.unstash('edt-validate')
|
||||
|
||||
Logger.println("Конвертация результата EDT в Generic Issue")
|
||||
|
||||
def genericIssueRelative = "build/out/edt-generic-issue.json"
|
||||
def edtValidateFile = "$env.WORKSPACE/build/out/edt-validate.xml"
|
||||
def genericIssueFile = "$env.WORKSPACE/$genericIssueRelative"
|
||||
|
||||
steps.cmd("stebi convert $edtValidateFile $genericIssueFile $rootDir")
|
||||
|
||||
steps.archiveArtifacts(genericIssueRelative)
|
||||
steps.stash('edt-generic-issue', genericIssueRelative)
|
||||
}
|
||||
}
|
@ -44,6 +44,11 @@ class SonarScanner implements Serializable {
|
||||
sonarCommand += " -Dsonar.projectVersion=$configurationVersion"
|
||||
}
|
||||
|
||||
if (config.stageFlags.edtValidate) {
|
||||
steps.unstash("edt-generic-issue")
|
||||
sonarCommand += " -Dsonar.externalIssuesReportPaths=build/out/edt-generic-issue.json"
|
||||
}
|
||||
|
||||
def sonarQubeInstallation = config.sonarQubeOptions.sonarQubeInstallation
|
||||
if (sonarQubeInstallation == '') {
|
||||
sonarQubeInstallation = null
|
||||
|
@ -35,15 +35,6 @@ void call() {
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarQube') {
|
||||
agent {
|
||||
label 'sonar'
|
||||
}
|
||||
steps {
|
||||
sonarScanner config
|
||||
}
|
||||
}
|
||||
|
||||
stage('1C') {
|
||||
agent {
|
||||
label agent1C
|
||||
@ -89,6 +80,24 @@ void call() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Трансформация результатов') {
|
||||
agent {
|
||||
label 'oscript'
|
||||
}
|
||||
steps {
|
||||
transform config
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarQube') {
|
||||
agent {
|
||||
label 'sonar'
|
||||
}
|
||||
steps {
|
||||
sonarScanner config
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
vars/transform.groovy
Normal file
10
vars/transform.groovy
Normal file
@ -0,0 +1,10 @@
|
||||
import ru.pulsar.jenkins.library.configuration.JobConfiguration
|
||||
import ru.pulsar.jenkins.library.ioc.ContextRegistry
|
||||
import ru.pulsar.jenkins.library.steps.ResultsTransformer
|
||||
|
||||
def call(JobConfiguration config) {
|
||||
ContextRegistry.registerDefaultContext(this)
|
||||
|
||||
def transformer = new ResultsTransformer(config)
|
||||
transformer.run()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user