I want to be able to manually reset the reference build to a newer version. We mark our build as unstable if the quality gates from warningsng and codecoverage are failed. But sometimes we cannot immediately fix these issues and want to reset the reference build to one that is marked as unstable.

       

      We use the freestyle project for our jobs.

       

      Currently I work around this by manually rebuilding after changing the config to also select unstable builds.

       

      Below example config:

       

      <io.jenkins.plugins.forensics.reference.SimpleReferenceRecorder plugin="forensics-api@2.4.0">
            <jenkins plugin="plugin-util-api@4.1.0"/>
            <referenceJob/>
            <requiredResult>
              <name>SUCCESS</name>
              <ordinal>0</ordinal>
              <color>BLUE</color>
              <completeBuild>true</completeBuild>
            </requiredResult>
          </io.jenkins.plugins.forensics.reference.SimpleReferenceRecorder>
      <io.jenkins.plugins.analysis.core.steps.IssuesRecorder plugin="warnings-ng@11.2.2">
            <analysisTools>
              <io.jenkins.plugins.analysis.warnings.CheckStyle>
                <id/>
                <name/>
                <jenkins plugin="plugin-util-api@4.1.0"/>
                <pattern>**/target/checkstyle-result.xml</pattern>
                <reportEncoding/>
                <skipSymbolicLinks>false</skipSymbolicLinks>
              </io.jenkins.plugins.analysis.warnings.CheckStyle>
              <io.jenkins.plugins.analysis.warnings.SpotBugs>
                <id/>
                <name/>
                <jenkins plugin="plugin-util-api@4.1.0"/>
                <pattern>**/target/spotbugsXml.xml</pattern>
                <reportEncoding/>
                <skipSymbolicLinks>false</skipSymbolicLinks>
                <useRankAsPriority>true</useRankAsPriority>
              </io.jenkins.plugins.analysis.warnings.SpotBugs>
              <io.jenkins.plugins.analysis.warnings.Pmd>
                <id/>
                <name/>
                <jenkins plugin="plugin-util-api@4.1.0"/>
                <pattern>**/target/pmd.xml</pattern>
                <reportEncoding/>
                <skipSymbolicLinks>false</skipSymbolicLinks>
              </io.jenkins.plugins.analysis.warnings.Pmd>
              <io.jenkins.plugins.analysis.warnings.Cpd>
                <id/>
                <name/>
                <jenkins plugin="plugin-util-api@4.1.0"/>
                <pattern>**/target/cpd.xml</pattern>
                <reportEncoding/>
                <skipSymbolicLinks>false</skipSymbolicLinks>
                <highThreshold>50</highThreshold>
                <normalThreshold>25</normalThreshold>
              </io.jenkins.plugins.analysis.warnings.Cpd>
              <io.jenkins.plugins.analysis.warnings.Java>
                <id/>
                <name/>
                <jenkins plugin="plugin-util-api@4.1.0"/>
                <pattern/>
                <reportEncoding/>
                <skipSymbolicLinks>false</skipSymbolicLinks>
              </io.jenkins.plugins.analysis.warnings.Java>
            </analysisTools>
            <sourceCodeEncoding/>
            <sourceDirectories/>
            <sourceCodeRetention>EVERY_BUILD</sourceCodeRetention>
            <ignoreQualityGate>true</ignoreQualityGate>
            <failOnError>false</failOnError>
            <healthy>0</healthy>
            <unhealthy>0</unhealthy>
            <minimumSeverity plugin="analysis-model-api@12.1.0">
              <name>LOW</name>
            </minimumSeverity>
            <filters/>
            <isEnabledForFailure>false</isEnabledForFailure>
            <isAggregatingResults>true</isAggregatingResults>
            <quiet>false</quiet>
            <isBlameDisabled>false</isBlameDisabled>
            <skipPublishingChecks>true</skipPublishingChecks>
            <checksAnnotationScope>NEW</checksAnnotationScope>
            <skipPostProcessing>false</skipPostProcessing>
            <qualityGates>
              <io.jenkins.plugins.analysis.core.util.WarningsQualityGate>
                <threshold>1.0</threshold>
                <criticality>UNSTABLE</criticality>
                <type>NEW</type>
              </io.jenkins.plugins.analysis.core.util.WarningsQualityGate>
            </qualityGates>
            <trendChartType>AGGREGATION_TOOLS</trendChartType>
            <scm/>
          </io.jenkins.plugins.analysis.core.steps.IssuesRecorder> 
          <io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder plugin="coverage@1.13.0">
            <tools class="java.util.ImmutableCollections$List12" resolves-to="java.util.CollSer" serialization="custom">
              <java.util.CollSer>
                <default>
                  <tag>1</tag>
                </default>
                <int>1</int>
                <io.jenkins.plugins.coverage.metrics.steps.CoverageTool>
                  <jenkins plugin="plugin-util-api@4.1.0"/>
                  <pattern/>
                  <parser>JACOCO</parser>
                </io.jenkins.plugins.coverage.metrics.steps.CoverageTool>
              </java.util.CollSer>
            </tools>
            <qualityGates class="java.util.ImmutableCollections$List12" resolves-to="java.util.CollSer" serialization="custom">
              <java.util.CollSer>
                <default>
                  <tag>1</tag>
                </default>
                <int>2</int>
                <io.jenkins.plugins.coverage.metrics.steps.CoverageQualityGate>
                  <threshold>0.0</threshold>
                  <criticality>UNSTABLE</criticality>
                  <metric>BRANCH</metric>
                  <baseline>PROJECT_DELTA</baseline>
                </io.jenkins.plugins.coverage.metrics.steps.CoverageQualityGate>
                <io.jenkins.plugins.coverage.metrics.steps.CoverageQualityGate>
                  <threshold>0.0</threshold>
                  <criticality>UNSTABLE</criticality>
                  <metric>LINE</metric>
                  <baseline>PROJECT_DELTA</baseline>
                </io.jenkins.plugins.coverage.metrics.steps.CoverageQualityGate>
              </java.util.CollSer>
            </qualityGates>
            <id/>
            <name/>
            <skipPublishingChecks>false</skipPublishingChecks>
            <checksName>Code Coverage</checksName>
            <checksAnnotationScope>MODIFIED_LINES</checksAnnotationScope>
            <ignoreParsingErrors>false</ignoreParsingErrors>
            <failOnError>false</failOnError>
            <enabledForFailure>false</enabledForFailure>
            <skipSymbolicLinks>false</skipSymbolicLinks>
            <scm/>
            <sourceCodeEncoding/>
            <sourceDirectories/>
            <sourceCodeRetention>LAST_BUILD</sourceCodeRetention>
          </io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder> 

       

          [JENKINS-72951] Reset the reference build

          Ulli Hafner added a comment -

          For the warnings plugin there is already an action available to reset the reference build. But this option does not help in your case as you are ignoring the quality gate result anyway.

          Maybe it makes sense to implement something that has been requested in JENKINS-56178.

          Is it required to have different reference builds for the warnings and the coverage? Or would they use the same?

          Ulli Hafner added a comment - For the warnings plugin there is already an action available to reset the reference build. But this option does not help in your case as you are ignoring the quality gate result anyway. Maybe it makes sense to implement something that has been requested in JENKINS-56178 . Is it required to have different reference builds for the warnings and the coverage? Or would they use the same?

          Ben Maes added a comment -

          I would use the same for both. In my use case it is not useful to reset them apart from each other.

          Ben Maes added a comment - I would use the same for both. In my use case it is not useful to reset them apart from each other.

            Unassigned Unassigned
            khazr Ben Maes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: