diff --git a/src/ru/pulsar/jenkins/library/steps/CoverageCleanup.groovy b/src/ru/pulsar/jenkins/library/steps/CoverageCleanup.groovy new file mode 100644 index 00000000..e53dbdae --- /dev/null +++ b/src/ru/pulsar/jenkins/library/steps/CoverageCleanup.groovy @@ -0,0 +1,31 @@ +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 CoverageCleanup implements Serializable { + + private final JobConfiguration config; + + private String encoding = 'UTF-8' + + CoverageCleanup(JobConfiguration config) { + this.config = config + } + + def run() { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + Logger.printLocation() + + if (steps.isUnix()) { + def command = "pkill Coverage41C && pkill dbgs" + steps.sh(command, false, false, encoding) + } else { + def command = "taskkill /IM Coverage41C /F & taskkill /IM dbgs /F" + steps.sh(command, false, false, encoding) + } + } +} diff --git a/vars/coverageCleanup.groovy b/vars/coverageCleanup.groovy new file mode 100644 index 00000000..34991c13 --- /dev/null +++ b/vars/coverageCleanup.groovy @@ -0,0 +1,11 @@ +import ru.pulsar.jenkins.library.configuration.JobConfiguration +import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.steps.CoverageCleanup + +def call(JobConfiguration config) { + ContextRegistry.registerDefaultContext(this) + + def coverageCleanup = new CoverageCleanup(config); + coverageCleanup.run() + +} \ No newline at end of file diff --git a/vars/pipeline1C.groovy b/vars/pipeline1C.groovy index 867e3830..ac36a19d 100644 --- a/vars/pipeline1C.groovy +++ b/vars/pipeline1C.groovy @@ -325,6 +325,11 @@ void call() { yaxunit config } } + post('yaxunit-coverage-cleanup') { + always { + coverageCleanup config + } + } } } }