From 58afecfa97ca00bb553298b976c107de3c30619d Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Tue, 2 Jan 2024 14:29:30 +0100 Subject: [PATCH] Fix reference of old quality gate status. --- .../PullRequestMonitoringPortlet.java | 2 +- .../core/util/WarningsQualityGate.java | 2 +- .../analysis/warnings/steps/StepsITest.java | 55 +------------------ 3 files changed, 4 insertions(+), 55 deletions(-) diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/portlets/PullRequestMonitoringPortlet.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/portlets/PullRequestMonitoringPortlet.java index 856cea2e8b..803604b19d 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/portlets/PullRequestMonitoringPortlet.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/portlets/PullRequestMonitoringPortlet.java @@ -20,9 +20,9 @@ import io.jenkins.plugins.analysis.core.model.AnalysisResult; import io.jenkins.plugins.analysis.core.model.ResultAction; -import io.jenkins.plugins.analysis.core.util.QualityGateStatus; import io.jenkins.plugins.monitoring.MonitorPortlet; import io.jenkins.plugins.monitoring.MonitorPortletFactory; +import io.jenkins.plugins.util.QualityGateStatus; /** * A portlet that can be used for the diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/util/WarningsQualityGate.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/util/WarningsQualityGate.java index e89d895eeb..23ee3aa3fa 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/util/WarningsQualityGate.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/util/WarningsQualityGate.java @@ -82,7 +82,7 @@ public void setUnstable(final boolean unstable) { setCriticality(QualityGateCriticality.FAILURE); } } - + /** * Returns the method that should be used to determine the actual number of issues in the build. * diff --git a/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/StepsITest.java b/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/StepsITest.java index bdfbe7f787..288f3afd08 100644 --- a/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/StepsITest.java +++ b/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/StepsITest.java @@ -160,7 +160,7 @@ private void configureRecorder(final WorkflowJob job, final String fileName) { + " echo '[totalSize=' + result.getTotals().getTotalSize() + ']' \n" + " echo '[newSize=' + result.getTotals().getNewSize() + ']' \n" + " echo '[fixedSize=' + result.getTotals().getFixedSize() + ']' \n" - + " echo '[qualityGate=' + result.getQualityGateStatus() + ']' \n" + + " echo '[qualityGate=' + result.getQualityGateResult() + ']' \n" + " echo '[id=' + result.getId() + ']' \n" + " result.getIssues().each { issue ->\n" + " echo issue.toString()\n" @@ -194,8 +194,7 @@ void shouldSkipBlaming() { job.setDefinition(new CpsFlowDefinition("node {\n" + " stage ('Integration Test') {\n" - + " recordIssues forensicsDisabled: true, skipBlames: true, tool: checkStyle(pattern: '**/" - + "checkstyle1" + "*')\n" + + " recordIssues skipBlames: true, tool: checkStyle(pattern: '**/checkstyle1" + "*')\n" + " }\n" + "}", true)); Run baseline = buildSuccessfully(job); @@ -573,56 +572,6 @@ void shouldFailBuildWhenFailBuildOnErrorsIsSet() { scheduleBuildAndAssertStatus(job, Result.FAILURE); } - /** Runs the JavaDoc parser and enforces quality gates. */ - @Test - @org.jvnet.hudson.test.Issue("JENKINS-58253") - void shouldSupportDeprecatedAttributesInRecord() { - WorkflowJob job = createPipelineWithWorkspaceFilesWithSuffix("javadoc.txt"); - - job.setDefinition(asStage( - "recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), " - + "unstableTotalAll: 6")); - buildWithResult(job, Result.UNSTABLE); - - job.setDefinition(asStage( - "recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), " - + "failedTotalAll: 6")); - buildWithResult(job, Result.FAILURE); - - job.setDefinition(asStage( - "recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), " - + "unstableTotalNormal: 6")); - buildWithResult(job, Result.UNSTABLE); - - job.setDefinition(asStage( - "recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), " - + "failedTotalNormal: 6")); - buildWithResult(job, Result.FAILURE); - } - - /** Runs the JavaDoc parser and enforces quality gates. */ - @Test - @org.jvnet.hudson.test.Issue("JENKINS-58253") - void shouldSupportDeprecatedAttributesInPublish() { - WorkflowJob job = createPipelineWithWorkspaceFilesWithSuffix("javadoc.txt"); - - job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"), - "publishIssues issues:[java], unstableTotalAll: 6")); - buildWithResult(job, Result.UNSTABLE); - - job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"), - "publishIssues issues:[java], failedTotalAll: 6")); - buildWithResult(job, Result.FAILURE); - - job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"), - "publishIssues issues:[java], unstableTotalNormal: 6")); - buildWithResult(job, Result.UNSTABLE); - - job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"), - "publishIssues issues:[java], failedTotalNormal: 6")); - buildWithResult(job, Result.FAILURE); - } - /** * Runs the all Java parsers on three output files: the build should report issues of all tools. The results should * be aggregated into a new action with the specified ID. Since no name is given the default name is used.