This is an automated email from the ASF dual-hosted git repository. dpavlov pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
commit 1c14ecacf3d5d47fcecdfc7a0b4ffd02178b19ca Author: Dmitriy Pavlov <[email protected]> AuthorDate: Mon Jul 29 18:45:10 2019 +0300 Show tests with duration > 1 minute in RunAll: Filtering history by scale factor: Dummy limitation for a number of checks to be done - Fixes #138. Signed-off-by: Dmitriy Pavlov <[email protected]> --- .../ignite/ci/tcbot/issue/IssueDetector.java | 2 + .../ignite/ci/web/rest/GetChainResultsAsHtml.java | 1 + .../ci/web/rest/build/GetBuildTestFailures.java | 1 + .../rest/tracked/GetTrackedBranchTestResults.java | 23 ++++-- ignite-tc-helper-web/src/main/webapp/current.html | 46 +++++++---- .../ci/tcbot/chain/BuildChainProcessorTest.java | 6 +- .../ci/tcbot/chain/TrackedBranchProcessorTest.java | 2 +- .../tcbot/common/conf/IParameterValueSpec.java | 5 +- .../tcbot/engine/chain/BuildChainProcessor.java | 95 ++++++++++++++++++---- .../ignite/tcbot/engine/pr/PrChainsProcessor.java | 4 +- .../tracked/IDetailedStatusForTrackedBranch.java | 5 +- .../tracked/TrackedBranchChainsProcessor.java | 34 +++++++- 12 files changed, 169 insertions(+), 55 deletions(-) diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java index d65449d..2a33891 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/issue/IssueDetector.java @@ -578,6 +578,7 @@ public class IssueDetector { SyncMode.RELOAD_QUEUED, false, null, + null, DisplayMode.None, null, -1); @@ -590,6 +591,7 @@ public class IssueDetector { SyncMode.RELOAD_QUEUED, false, null, + null, DisplayMode.OnlyFailures, null, -1); diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java index 16cad16..25623b6 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java @@ -82,6 +82,7 @@ public class GetChainResultsAsHtml { false, failRateBranch, SyncMode.RELOAD_QUEUED, + null, null); DsChainUi status = new DsChainUi(srvCode, tcIgn.serverCode(), ctx.branchName()); diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java index c016bf3..2b38122 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java @@ -132,6 +132,7 @@ public class GetBuildTestFailures { false, failRateBranch, syncMode, + null, null); DsChainUi chainStatus = new DsChainUi(srvCode, tcIgnited.serverCode(), ctx.branchName()); diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java index 0458eb2..1ff6d7c 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java @@ -67,12 +67,14 @@ public class GetTrackedBranchTestResults { @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs, @Nullable @QueryParam("trustedTests") Boolean trustedTests, @Nullable @QueryParam("tagSelected") String tagSelected, + @Nullable @QueryParam("tagForHistSelected") String tagForHistSelected, @Nullable @QueryParam("displayMode") String displayMode, @Nullable @QueryParam("sortOption") String sortOption, @Nullable @QueryParam("count") Integer mergeCnt, @Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) { - return new UpdateInfo().copyFrom(getTestFailsResultsNoSync(branchOrNull, checkAllLogs, trustedTests, tagSelected, - displayMode, sortOption, mergeCnt, showTestLongerThan)); + return new UpdateInfo().copyFrom( + getTestFailsResultsNoSync(branchOrNull, checkAllLogs, trustedTests, tagSelected, tagForHistSelected, + displayMode, sortOption, mergeCnt, showTestLongerThan)); } @GET @@ -82,11 +84,13 @@ public class GetTrackedBranchTestResults { @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs, @Nullable @QueryParam("trustedTests") Boolean trustedTests, @Nullable @QueryParam("tagSelected") String tagSelected, + @Nullable @QueryParam("tagForHistSelected") String tagForHistSelected, @Nullable @QueryParam("displayMode") String displayMode, @Nullable @QueryParam("sortOption") String sortOption, @Nullable @QueryParam("count") Integer mergeCnt, @Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) { - return getTestFailsResultsNoSync(branchOrNull, checkAllLogs, trustedTests, tagSelected, displayMode, sortOption, mergeCnt, showTestLongerThan).toString(); + return getTestFailsResultsNoSync(branchOrNull, checkAllLogs, trustedTests, tagSelected, tagForHistSelected, + displayMode, sortOption, mergeCnt, showTestLongerThan).toString(); } @GET @@ -96,11 +100,13 @@ public class GetTrackedBranchTestResults { @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs, @Nullable @QueryParam("trustedTests") Boolean trustedTests, @Nullable @QueryParam("tagSelected") String tagSelected, + @Nullable @QueryParam("tagForHistSelected") String tagForHistSelected, @Nullable @QueryParam("displayMode") String displayMode, @Nullable @QueryParam("sortOption") String sortOption, @Nullable @QueryParam("count") Integer mergeCnt, @Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) { - return latestBuildResults(branch, checkAllLogs, trustedTests, tagSelected, SyncMode.NONE, displayMode, sortOption, mergeCnt, showTestLongerThan); + return latestBuildResults(branch, checkAllLogs, trustedTests, tagSelected, tagForHistSelected, + SyncMode.NONE, displayMode, sortOption, mergeCnt, showTestLongerThan); } @GET @@ -111,11 +117,13 @@ public class GetTrackedBranchTestResults { @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs, @Nullable @QueryParam("trustedTests") Boolean trustedTests, @Nullable @QueryParam("tagSelected") String tagSelected, + @Nullable @QueryParam("tagForHistSelected") String tagForHistSelected, @Nullable @QueryParam("displayMode") String displayMode, @Nullable @QueryParam("sortOption") String sortOption, @Nullable @QueryParam("count") Integer mergeCnt, @Nullable @QueryParam("showTestLongerThan") Integer showTestLongerThan) { - return latestBuildResults(branch, checkAllLogs, trustedTests, tagSelected, SyncMode.RELOAD_QUEUED, displayMode, sortOption, mergeCnt, showTestLongerThan); + return latestBuildResults(branch, checkAllLogs, trustedTests, tagSelected, tagForHistSelected, + SyncMode.RELOAD_QUEUED, displayMode, sortOption, mergeCnt, showTestLongerThan); } @NotNull private DsSummaryUi latestBuildResults( @@ -123,6 +131,7 @@ public class GetTrackedBranchTestResults { @Nullable Boolean checkAllLogs, @Nullable Boolean trustedTests, @Nullable String tagSelected, + @Nullable String tagForHistSelected, @Nonnull SyncMode mode, @Nullable String displayMode, @Nullable String sortOption, @@ -138,7 +147,7 @@ public class GetTrackedBranchTestResults { return injector.getInstance(IDetailedStatusForTrackedBranch.class) .getTrackedBranchTestFailures(branch, checkAllLogs, actualMergeBuilds, creds, mode, - Boolean.TRUE.equals(trustedTests), tagSelected, + Boolean.TRUE.equals(trustedTests), tagSelected, tagForHistSelected, DisplayMode.parseStringValue(displayMode), SortOption.parseStringValue(sortOption), maxDurationSec); @@ -180,7 +189,7 @@ public class GetTrackedBranchTestResults { return injector.getInstance(TrackedBranchChainsProcessor.class) .getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit, creds, mode, - false, null, DisplayMode.OnlyFailures, null, -1); + false, null, null, DisplayMode.OnlyFailures, null, -1); } /** diff --git a/ignite-tc-helper-web/src/main/webapp/current.html b/ignite-tc-helper-web/src/main/webapp/current.html index 43dcb39..ac78792 100644 --- a/ignite-tc-helper-web/src/main/webapp/current.html +++ b/ignite-tc-helper-web/src/main/webapp/current.html @@ -61,6 +61,9 @@ function showQueryForm() { data: { tagSelected: '', tagsPresent: [""], + tagForHistSelected: '', + tagsForHistPresent: [""], + displayMode: 'Failures', sortOption: 'FailureRate', //count of builds to merge @@ -69,14 +72,11 @@ function showQueryForm() { checkAllLogs: false, hideFlakyFailures: false, - absMinFailRate: 0, - absMaxFailRate: 100, - failRateRange: [min, max], - showTestLongerThan: '', - tagForHistorySelected: '', - tagsForHistoryPresent: [] + absMinFailRate: 0, + absMaxFailRate: 100, + failRateRange: [min, max] }, methods: { formChanged: function () { @@ -118,10 +118,10 @@ function showQueryForm() { if (showTestLongerThan != null) gVue.$data.showTestLongerThan = showTestLongerThan; - let tagForHistorySelected = findGetParameter("tagForHistorySelected"); - if (tagForHistorySelected != null) { - gVue.$data.tagsForHistoryPresent.push(tagForHistorySelected); - gVue.$data.tagForHistorySelected = tagForHistorySelected; + let tagForHistSelected = findGetParameter("tagForHistSelected"); + if (tagForHistSelected != null) { + gVue.$data.tagsForHistPresent.push(tagForHistSelected); + gVue.$data.tagForHistSelected = tagForHistSelected; } genLink(); @@ -177,8 +177,8 @@ function parmsForRest() { curReqParms += "&hideFlakyFailures=" + gVue.$data.hideFlakyFailures; - if (gVue.$data.tagForHistorySelected != null) - curReqParms += "&tagForHistorySelected=" + gVue.$data.tagForHistorySelected; + if (gVue.$data.tagForHistSelected != null) + curReqParms += "&tagForHistSelected=" + gVue.$data.tagForHistSelected; if (gVue.$data.showTestLongerThan != null) curReqParms += "&showTestLongerThan=" + gVue.$data.showTestLongerThan; @@ -267,7 +267,7 @@ function loadPartialData() { function showData(result) { let setOfTags = new Set(gVue.$data.tagsPresent); - let setOfHistTags = new Set(gVue.$data.tagForHistorySelected); + let setOfHistTags = new Set(gVue.$data.tagForHistSelected); for (let i = 0; i < result.servers.length; i++) { let chain = result.servers[i]; @@ -286,7 +286,7 @@ function showData(result) { } gVue.$data.tagsPresent = Array.from(setOfTags); - gVue.$data.tagsForHistoryPresent = Array.from(setOfHistTags); + gVue.$data.tagsForHistPresent = Array.from(setOfHistTags); //var txtUrl = "rest/tracked/results/txt" + parmsForRest(); @@ -311,7 +311,7 @@ function showData(result) { <table> <tr> <td> - <span>Tag filter: </span> + <span title="Tag filter for displaying suites">Tag filter: </span> <select v-model="tagSelected" @change="formChanged"> <option disabled value="">Please select one</option> @@ -319,6 +319,16 @@ function showData(result) { {{ option }} </option> </select> + + <span title="Tag filter for filtering history of suites">History tag filter: </span> + <select v-model="tagForHistSelected" @change="formChanged"> + <option disabled value="">Please select one</option> + + <option v-for="option in tagsForHistPresent" v-bind:value="option"> + {{ option }} + </option> + </select> + <br> <span>Display Mode: </span> <select v-model="displayMode" @change="formChanged"> <option value="Failures">Show failures only</option> @@ -329,14 +339,14 @@ function showData(result) { <option value="FailureRate">Failure Rate</option> <option value="SuiteDuration">Suite Duration</option> </select> - <br> <span>Merge Builds: </span> <input v-model.number="count" type="number" @change="formChanged"> - <span title="Show trusted tests count">Trusted tests: </span> + + <br> <span title="Show trusted tests count">Trusted tests: </span> <input type="checkbox" v-model="trustedTests" @change="formChanged"> <span title="Download and parse all logs">Check logs: </span> <input type="checkbox" v-model="checkAllLogs" @change="formChanged"> - <br> + <span>Show test longer than, seconds: </span> <input v-model.number="showTestLongerThan" type="number" @change="formChanged"> </td> diff --git a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessorTest.java b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessorTest.java index c79bcd7..e942af9 100644 --- a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessorTest.java +++ b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessorTest.java @@ -87,7 +87,7 @@ public class BuildChainProcessorTest { FullChainRunCtx ctx = bcp.loadFullChainContext(tcIgnited, entry, - LatestRebuildMode.ALL, ProcessLogsMode.SUITE_NOT_COMPLETE, false, ITeamcity.DEFAULT, SyncMode.NONE, null); + LatestRebuildMode.ALL, ProcessLogsMode.SUITE_NOT_COMPLETE, false, ITeamcity.DEFAULT, SyncMode.NONE, null, null); List<MultBuildRunCtx> suites = ctx.failedChildSuites().collect(Collectors.toList()); assertTrue(!suites.isEmpty()); @@ -123,7 +123,7 @@ public class BuildChainProcessorTest { FullChainRunCtx ctx2 = bcp.loadFullChainContext(tcIgnited, entry, - LatestRebuildMode.ALL, ProcessLogsMode.SUITE_NOT_COMPLETE, false, ITeamcity.DEFAULT, SyncMode.NONE, null); + LatestRebuildMode.ALL, ProcessLogsMode.SUITE_NOT_COMPLETE, false, ITeamcity.DEFAULT, SyncMode.NONE, null, null); List<MultBuildRunCtx> suites2 = ctx2.failedChildSuites().collect(Collectors.toList()); assertTrue(!suites2.isEmpty()); @@ -153,7 +153,7 @@ public class BuildChainProcessorTest { FullChainRunCtx ctx = bcp.loadFullChainContext(tcIgnitedMock(builds), entry, - LatestRebuildMode.LATEST, ProcessLogsMode.SUITE_NOT_COMPLETE, false, ITeamcity.DEFAULT, SyncMode.NONE, null); + LatestRebuildMode.LATEST, ProcessLogsMode.SUITE_NOT_COMPLETE, false, ITeamcity.DEFAULT, SyncMode.NONE, null, null); List<MultBuildRunCtx> suites = ctx.failedChildSuites().collect(Collectors.toList()); assertTrue(!suites.isEmpty()); diff --git a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/TrackedBranchProcessorTest.java b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/TrackedBranchProcessorTest.java index c1f83fc..0720d39 100644 --- a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/TrackedBranchProcessorTest.java +++ b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/TrackedBranchProcessorTest.java @@ -121,7 +121,7 @@ public class TrackedBranchProcessorTest { false, 1, mock, SyncMode.RELOAD_QUEUED, - false, null, DisplayMode.OnlyFailures, null, + false, null, null, DisplayMode.OnlyFailures, null, -1); Gson gson = new GsonBuilder().setPrettyPrinting().create(); diff --git a/tcbot-common/src/main/java/org/apache/ignite/tcbot/common/conf/IParameterValueSpec.java b/tcbot-common/src/main/java/org/apache/ignite/tcbot/common/conf/IParameterValueSpec.java index 187c7e5..0c8a04c 100644 --- a/tcbot-common/src/main/java/org/apache/ignite/tcbot/common/conf/IParameterValueSpec.java +++ b/tcbot-common/src/main/java/org/apache/ignite/tcbot/common/conf/IParameterValueSpec.java @@ -21,5 +21,8 @@ public interface IParameterValueSpec { String value(); - String label(); + /** + * @return label or tag, which should be applied to this + */ + public String label(); } diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/BuildChainProcessor.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/BuildChainProcessor.java index f4f38e3..e1f68b8 100644 --- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/BuildChainProcessor.java +++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/BuildChainProcessor.java @@ -21,7 +21,6 @@ import com.google.common.base.Preconditions; import com.google.common.util.concurrent.Futures; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; @@ -139,6 +138,7 @@ public class BuildChainProcessor { * @param failRateBranch Fail rate branch. * @param mode background data update mode. * @param sortOption how to sort suites in context, default is by failure rate (most often - first). + * @param requireParamVal Require exact parameters value presence in the build. */ @AutoProfiling public FullChainRunCtx loadFullChainContext( @@ -149,7 +149,8 @@ public class BuildChainProcessor { boolean includeScheduledInfo, @Nullable String failRateBranch, SyncMode mode, - @Nullable SortOption sortOption) { + @Nullable SortOption sortOption, + @Nullable Map<Integer, Integer> requireParamVal) { if (entryPoints.isEmpty()) return new FullChainRunCtx(Build.createFakeStub()); @@ -167,7 +168,8 @@ public class BuildChainProcessor { includeLatestRebuild, builds, mode, - tcIgn); + tcIgn, + requireParamVal); freshRebuilds.put(k, futures); } @@ -315,7 +317,8 @@ public class BuildChainProcessor { LatestRebuildMode includeLatestRebuild, Map<Integer, Future<FatBuildCompacted>> allBuildsMap, SyncMode syncMode, - ITeamcityIgnited tcIgn) { + ITeamcityIgnited tcIgn, + @Nullable Map<Integer, Integer> requireParamVal) { if (includeLatestRebuild == LatestRebuildMode.NONE || builds.isEmpty()) return completed(builds); @@ -330,28 +333,84 @@ public class BuildChainProcessor { final String branch = freshBuild.branchName(compactor); final String buildTypeId = freshBuild.buildTypeId(compactor); - Stream<BuildRefCompacted> hist = tcIgn.getAllBuildsCompacted(buildTypeId, branch) + List<BuildRefCompacted> recentHist = tcIgn.getAllBuildsCompacted(buildTypeId, branch) .stream() .filter(bref -> !bref.isCancelled(compactor)) - .filter(bref -> bref.isFinished(compactor)); + .filter(bref -> bref.isFinished(compactor)) + .sorted(Comparator.comparing(BuildRefCompacted::id).reversed()) + .collect(Collectors.toList()); + + List<Future<FatBuildCompacted>> res = new ArrayList<>(); + + int reqCnt; + if (includeLatestRebuild == LatestRebuildMode.LATEST) + reqCnt = 1; + else if (includeLatestRebuild == LatestRebuildMode.ALL) + reqCnt = cntLimit; + else + throw new UnsupportedOperationException("invalid mode " + includeLatestRebuild); + + int checked = 0; + for (BuildRefCompacted ref : recentHist) { + Future<FatBuildCompacted> fut = null; + if (requireParamVal != null && !requireParamVal.isEmpty()) { + Integer buildId = ref.id(); + FatBuildCompacted fatBuild = + allBuildsMap.containsKey(buildId) + ? FutureUtil.getResult(allBuildsMap.get(buildId)) + : tcIgn.getFatBuild(buildId, syncMode); + + boolean include = fatBuild != null && hasAnyParameterValue(requireParamVal, fatBuild); + + if (include) { + CompletableFuture<FatBuildCompacted> completableFut = CompletableFuture.completedFuture(fatBuild); + allBuildsMap.put(buildId, completableFut); + fut = completableFut; + } + + checked++; + + //dirty hack to avoid checking all (long) history of builds + if (checked > reqCnt * 3) + break; // required number of builds not found + } + else + fut = getOrLoadBuild(ref.id(), syncMode, allBuildsMap, tcIgn); - if (includeLatestRebuild == LatestRebuildMode.LATEST) { - BuildRefCompacted recentRef = hist.max(Comparator.comparing(BuildRefCompacted::id)) - .orElse(freshBuild); + if (fut != null) { + res.add(fut); - return Collections.singletonList( - getOrLoadBuild(recentRef.id(), syncMode, allBuildsMap, tcIgn)); + if (res.size() >= reqCnt) + return res; + } } - if (includeLatestRebuild == LatestRebuildMode.ALL) { - return hist - .sorted(Comparator.comparing(BuildRefCompacted::id).reversed()) - .limit(cntLimit) - .map(bref -> getOrLoadBuild(bref.id(), syncMode, allBuildsMap, tcIgn)) - .collect(Collectors.toList()); + if (res.isEmpty()) + return completed(builds); + + return res; + } + + /** + * @param requireParamVal Required parameter value(s). + * @param fatBuild Fat build to check. + */ + private boolean hasAnyParameterValue(@Nonnull Map<Integer, Integer> requireParamVal, FatBuildCompacted fatBuild) { + ParametersCompacted parameters = fatBuild.parameters(); + + if (parameters == null) + return false; + + Set<Map.Entry<Integer, Integer>> entries = requireParamVal.entrySet(); + for (Map.Entry<Integer, Integer> next : entries) { + Integer key = next.getKey(); + + int valId = parameters.findPropertyStringId(key); + if (Objects.equals(next.getValue(), valId)) + return true; } - throw new UnsupportedOperationException("invalid mode " + includeLatestRebuild); + return false; } @SuppressWarnings("WeakerAccess") diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/pr/PrChainsProcessor.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/pr/PrChainsProcessor.java index 740f5bc..0f084e7 100644 --- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/pr/PrChainsProcessor.java +++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/pr/PrChainsProcessor.java @@ -150,7 +150,7 @@ public class PrChainsProcessor { buildResMergeCnt == 1, baseBranchForTc, mode, - null); + null, null); DsChainUi chainStatus = new DsChainUi(srvCodeOrAlias, tcIgnited.serverCode(), branchForTc); @@ -275,7 +275,7 @@ public class PrChainsProcessor { false, baseBranch, syncMode, - null); + null, null); if (ctx.isFakeStub()) return null; diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/IDetailedStatusForTrackedBranch.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/IDetailedStatusForTrackedBranch.java index 5621432..4edad4a 100644 --- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/IDetailedStatusForTrackedBranch.java +++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/IDetailedStatusForTrackedBranch.java @@ -34,6 +34,7 @@ public interface IDetailedStatusForTrackedBranch { * @param syncMode Sync mode. * @param calcTrustedTests Calculate trusted tests count. * @param tagSelected Selected tag based filter. If null or empty all data is returned. + * @param tagForHistSelected Selected tag for filtering history (applicable to reruns and history stripe). * @param displayMode Suites and tests display mode. Default - failures only. * @param sortOption Sort mode * @param maxDurationSec Show test as failed if duration is greater than provided seconds count. @@ -46,8 +47,10 @@ public interface IDetailedStatusForTrackedBranch { SyncMode syncMode, boolean calcTrustedTests, @Nullable String tagSelected, + @Nullable String tagForHistSelected, @Nullable DisplayMode displayMode, - @Nullable SortOption sortOption, int maxDurationSec); + @Nullable SortOption sortOption, + int maxDurationSec); // * @param baseTrackedBranch Branch tracked branch in Bot, has a priority if both TC & Bot branches (baseBranchForTcParm) present. } diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/TrackedBranchChainsProcessor.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/TrackedBranchChainsProcessor.java index 7bf1aba..56d266a 100644 --- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/TrackedBranchChainsProcessor.java +++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/tracked/TrackedBranchChainsProcessor.java @@ -16,12 +16,17 @@ */ package org.apache.ignite.tcbot.engine.tracked; +import com.google.common.base.Strings; +import java.util.Collection; import java.util.Comparator; +import java.util.HashMap; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; +import org.apache.ignite.tcbot.common.conf.IBuildParameterSpec; +import org.apache.ignite.tcbot.common.conf.IParameterValueSpec; import org.apache.ignite.tcbot.common.conf.ITcServerConfig; import org.apache.ignite.tcbot.common.interceptor.AutoProfiling; import org.apache.ignite.tcbot.engine.chain.BuildChainProcessor; @@ -69,6 +74,7 @@ public class TrackedBranchChainsProcessor implements IDetailedStatusForTrackedBr SyncMode syncMode, boolean calcTrustedTests, @Nullable String tagSelected, + @Nullable String tagForHistSelected, @Nullable DisplayMode displayMode, @Nullable SortOption sortOption, int maxDurationSec) { @@ -83,16 +89,35 @@ public class TrackedBranchChainsProcessor implements IDetailedStatusForTrackedBr tracked.chainsStream() .filter(chainTracked -> tcIgnitedProv.hasAccess(chainTracked.serverCode(), creds)) .map(chainTracked -> { - final String srvCode = chainTracked.serverCode(); + final String srvCodeOrAlias = chainTracked.serverCode(); final String branchForTc = chainTracked.tcBranch(); //branch is tracked, so fail rate should be taken from this branch data (otherwise it is specified). final String baseBranchTc = chainTracked.tcBaseBranch().orElse(branchForTc); - ITeamcityIgnited tcIgnited = tcIgnitedProv.server(srvCode, creds); + ITeamcityIgnited tcIgnited = tcIgnitedProv.server(srvCodeOrAlias, creds); - DsChainUi chainStatus = new DsChainUi(srvCode, + java.util.Map<Integer, Integer> requireParamVal = new HashMap<>(); + + if(!Strings.isNullOrEmpty(tagForHistSelected)) { + ITcServerConfig cfg = tcBotCfg.getTeamcityConfig(srvCodeOrAlias); + Collection<? extends IBuildParameterSpec> specs = cfg.filteringParameters(); + for (IBuildParameterSpec buildParameterSpec : specs) { + Collection<? extends IParameterValueSpec> selection = buildParameterSpec.selection(); + for (IParameterValueSpec valueSpec : selection) { + if(tagForHistSelected.equals(valueSpec.label()) + && !Strings.isNullOrEmpty(valueSpec.value())) { + + requireParamVal.put( + compactor.getStringId(buildParameterSpec.name()), + compactor.getStringId(valueSpec.value())); + } + } + } + } + + DsChainUi chainStatus = new DsChainUi(srvCodeOrAlias, tcIgnited.serverCode(), branchForTc); @@ -120,7 +145,8 @@ public class TrackedBranchChainsProcessor implements IDetailedStatusForTrackedBr includeScheduled, baseBranchTc, syncMode, - sortOption + sortOption, + requireParamVal ); int cnt = (int)ctx.getRunningUpdates().count();
