diff --git a/src/ru/pulsar/jenkins/library/steps/Cmd.groovy b/src/ru/pulsar/jenkins/library/steps/Cmd.groovy index 15ea4395..ead109c3 100644 --- a/src/ru/pulsar/jenkins/library/steps/Cmd.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Cmd.groovy @@ -22,7 +22,7 @@ class Cmd implements Serializable { def returnValue if (returnStatus & returnStdout) { - return "returnStatus and returnStdout are not supported at the same time" + steps.error("returnStatus and returnStdout are not supported at the same time") } if (steps.isUnix()) { diff --git a/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy index e6f62561..f678d0cf 100644 --- a/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy @@ -4,7 +4,6 @@ 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.Constants import ru.pulsar.jenkins.library.utils.EDT import ru.pulsar.jenkins.library.utils.FileUtils import ru.pulsar.jenkins.library.utils.Logger @@ -45,10 +44,7 @@ class DesignerToEdtFormatTransformation implements Serializable { def ringCommand = "ring $edtVersionForRing workspace import --configuration-files \"$configurationRoot\" --project-name $PROJECT_NAME --workspace-location \"$workspaceDir\"" - def ringOpts = [Constants.DEFAULT_RING_OPTS] - steps.withEnv(ringOpts) { - steps.ringCommand(ringCommand) - } + steps.ringCommand(ringCommand) steps.zip(WORKSPACE, WORKSPACE_ZIP) steps.stash(WORKSPACE_ZIP_STASH, WORKSPACE_ZIP) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy index 315d7974..2dfa3908 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtToDesignerFormatTransformation.groovy @@ -5,7 +5,6 @@ import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.configuration.SourceFormat import ru.pulsar.jenkins.library.ioc.ContextRegistry -import ru.pulsar.jenkins.library.utils.Constants import ru.pulsar.jenkins.library.utils.EDT import ru.pulsar.jenkins.library.utils.FileUtils import ru.pulsar.jenkins.library.utils.Logger @@ -48,10 +47,7 @@ class EdtToDesignerFormatTransformation implements Serializable { def ringCommand = "ring $edtVersionForRing workspace export --workspace-location \"$workspaceDir\" --project \"$projectDir\" --configuration-files \"$configurationRoot\"" - def ringOpts = [Constants.DEFAULT_RING_OPTS] - steps.withEnv(ringOpts) { - steps.ringCommand(ringCommand) - } + steps.ringCommand(ringCommand) steps.zip(CONFIGURATION_DIR, CONFIGURATION_ZIP) steps.stash(CONFIGURATION_ZIP_STASH, CONFIGURATION_ZIP) diff --git a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy index 1c225fbb..f766b9e0 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy @@ -4,7 +4,6 @@ import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.configuration.SourceFormat import ru.pulsar.jenkins.library.ioc.ContextRegistry -import ru.pulsar.jenkins.library.utils.Constants import ru.pulsar.jenkins.library.utils.EDT import ru.pulsar.jenkins.library.utils.FileUtils import ru.pulsar.jenkins.library.utils.Logger @@ -52,11 +51,8 @@ class EdtValidate implements Serializable { Logger.println("Выполнение валидации EDT") def ringCommand = "ring $edtVersionForRing workspace validate --workspace-location \"$workspaceLocation\" --file \"$resultFile\" $projectList" - def ringOpts = [Constants.DEFAULT_RING_OPTS] - steps.withEnv(ringOpts) { - steps.catchError { - steps.ringCommand(ringCommand) - } + steps.catchError { + steps.ringCommand(ringCommand) } steps.archiveArtifacts("$DesignerToEdtFormatTransformation.WORKSPACE/.metadata/.log") diff --git a/src/ru/pulsar/jenkins/library/steps/RingCommand.groovy b/src/ru/pulsar/jenkins/library/steps/RingCommand.groovy index d58c777d..53617302 100644 --- a/src/ru/pulsar/jenkins/library/steps/RingCommand.groovy +++ b/src/ru/pulsar/jenkins/library/steps/RingCommand.groovy @@ -2,21 +2,29 @@ package ru.pulsar.jenkins.library.steps import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.ioc.ContextRegistry +import ru.pulsar.jenkins.library.utils.Constants class RingCommand implements Serializable { - private String script; + private String script + private boolean returnStatus + private boolean returnStdout RingCommand(String script) { this.script = script + this.returnStatus = false + this.returnStdout = true }; def run() { IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() - String ringMessage = steps.cmd(script, false, true) - if (ringMessage.contains("error")) { - steps.error(ringMessage) + def ringOpts = [Constants.DEFAULT_RING_OPTS] + steps.withEnv(ringOpts) { + String ringMessage = steps.cmd(script, returnStatus, returnStdout) + if (ringMessage.contains("error")) { + steps.error(ringMessage) + } } } }