From f9613207cf77e870778f02ab4a138ccacff9b90c Mon Sep 17 00:00:00 2001 From: Dima Date: Fri, 29 Nov 2024 18:37:32 +0300 Subject: [PATCH] fix coverage paths --- src/ru/pulsar/jenkins/library/steps/Bdd.groovy | 2 +- src/ru/pulsar/jenkins/library/steps/Coverable.groovy | 3 --- src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy | 8 ++++---- src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy | 2 +- src/ru/pulsar/jenkins/library/steps/Yaxunit.groovy | 2 +- src/ru/pulsar/jenkins/library/utils/CoverageUtils.groovy | 8 ++++---- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy index 9a6cf4ee..2cd7de32 100644 --- a/src/ru/pulsar/jenkins/library/steps/Bdd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Bdd.groovy @@ -48,7 +48,7 @@ class Bdd implements Serializable, Coverable { steps.lock(coverageContext.lockableResource) { if (coverageContext != null) { - CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir) + CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this) } config.bddOptions.vrunnerSteps.each { diff --git a/src/ru/pulsar/jenkins/library/steps/Coverable.groovy b/src/ru/pulsar/jenkins/library/steps/Coverable.groovy index 49c05cd5..54271bb8 100644 --- a/src/ru/pulsar/jenkins/library/steps/Coverable.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Coverable.groovy @@ -1,10 +1,7 @@ package ru.pulsar.jenkins.library.steps -import ru.pulsar.jenkins.library.configuration.StepCoverageOptions - interface Coverable { - String getCoverageStashPath(); String getCoveragePidsPath(); diff --git a/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy b/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy index 4fac658e..d0ec31f4 100644 --- a/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy +++ b/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy @@ -16,7 +16,7 @@ class GetExtensions implements Serializable { public static final String EXTENSIONS_STASH = 'extensions' public static final String EXTENSIONS_OUT_DIR = 'build/out/cfe' - private final JobConfiguration config; + private final JobConfiguration config GetExtensions(JobConfiguration config) { this.config = config @@ -29,9 +29,9 @@ class GetExtensions implements Serializable { def env = steps.env() - steps.installLocalDependencies(); + steps.installLocalDependencies() - String vrunnerPath = initVRunnerPath(); + String vrunnerPath = initVRunnerPath() Logger.println("Сборка расширений") @@ -88,7 +88,7 @@ class GetExtensions implements Serializable { private void extractConvertedExtensions(String sourceDirName, IStepExecutor steps) { if (config.sourceFormat == SourceFormat.EDT) { - // usntash and unzip the edt to designer format transformation + // unstash and unzip the edt to designer format transformation steps.unstash(EdtToDesignerFormatTransformation.EXTENSION_ZIP_STASH) steps.unzip(sourceDirName, EdtToDesignerFormatTransformation.EXTENSION_ZIP) } diff --git a/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy b/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy index 82f77d00..aeab4e5d 100644 --- a/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy +++ b/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy @@ -112,7 +112,7 @@ class SmokeTest implements Serializable, Coverable { steps.lock(coverageContext.lockableResource) { if (coverageContext != null) { - CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir) + CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this) } steps.withEnv(logosConfig) { diff --git a/src/ru/pulsar/jenkins/library/steps/Yaxunit.groovy b/src/ru/pulsar/jenkins/library/steps/Yaxunit.groovy index 1cddcbf4..624fe20c 100644 --- a/src/ru/pulsar/jenkins/library/steps/Yaxunit.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Yaxunit.groovy @@ -74,7 +74,7 @@ class Yaxunit implements Serializable, Coverable { steps.lock(coverageContext.lockableResource) { if (coverageContext != null) { - CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir) + CoverageUtils.startCoverage(steps, coverageOpts, coverageContext, workspaceDir, srcDir, this) } // Выполняем команды diff --git a/src/ru/pulsar/jenkins/library/utils/CoverageUtils.groovy b/src/ru/pulsar/jenkins/library/utils/CoverageUtils.groovy index 8287b6b9..68590db7 100644 --- a/src/ru/pulsar/jenkins/library/utils/CoverageUtils.groovy +++ b/src/ru/pulsar/jenkins/library/utils/CoverageUtils.groovy @@ -7,8 +7,8 @@ import ru.pulsar.jenkins.library.configuration.GlobalCoverageOptions import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.configuration.StepCoverageOptions import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.Coverable import ru.pulsar.jenkins.library.steps.CoverageContext -import ru.pulsar.jenkins.library.steps.Yaxunit class CoverageUtils { static ArrayList getPIDs(String name) { @@ -43,9 +43,9 @@ class CoverageUtils { } - static void startCoverage(IStepExecutor steps, GlobalCoverageOptions coverageOpts, CoverageContext coverageContext, FilePath workspaceDir, String srcDir) { + static void startCoverage(IStepExecutor steps, GlobalCoverageOptions coverageOpts, CoverageContext coverageContext, FilePath workspaceDir, String srcDir, Coverable coverable) { 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 $Yaxunit.COVERAGE_STASH_PATH") + steps.start("${coverageOpts.coverage41CPath} start -i DefAlias -u http://127.0.0.1:$coverageContext.port -P $workspaceDir -s $srcDir -o ${coverable.getCoverageStashPath()}") steps.cmd("${coverageOpts.coverage41CPath} check -i DefAlias -u http://127.0.0.1:$coverageContext.port") def newDbgsPids = getPIDs("dbgs") @@ -57,7 +57,7 @@ class CoverageUtils { newDbgsPids.addAll(newCoverage41CPids) def pids = newDbgsPids.join(" ") - steps.writeFile(Yaxunit.COVERAGE_PIDS_PATH, pids, 'UTF-8') + steps.writeFile(coverable.getCoveragePidsPath(), pids, 'UTF-8') Logger.println("Coverage PIDs for cleanup: $pids") }