Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72059

quality gate setting to only set stage to unstable except of whole build

XMLWordPrintable

      It would be nice to have the possibility to set only the stage result to unstable if quality gates are not satisfied. 
      e.g. like possible with the CatchErrorStep
      There it is handled with the following code snippet:

       

      if (buildResult.isWorseThan(Result.SUCCESS)) {
        context.get(Run.class).setResult(buildResult);
      }
      if (stepResult.isWorseThan(Result.SUCCESS)) {
        context.get(FlowNode.class).addOrReplaceAction(new WarningAction(stepResult).withMessage(message));
      } 

      Currently the warning-ng-plugin is using `io.jenkins.plugins.util.PipelineResultHandler`
      which always sets both the build and the stage result.

      public void setResult(final Result result, final String message) {
        run.setResult(result);
        WarningAction existing = flowNode.getPersistentAction(WarningAction.class);
        if (existing == null || existing.getResult().isBetterThan(result)) {
          flowNode.addOrReplaceAction(new WarningAction(result).withMessage(message));
        }
      } 

      In some usecases it would really be helpful to still visualize not met quality gates but not alter the whole build result.

      Or is there any workaround to already get the desired behaviour?

       

            drulli Ulli Hafner
            thebro Kevin Broselge
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: