You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ir...@apache.org on 2020/07/09 20:19:01 UTC

[ignite-teamcity-bot] branch master updated (6fa6ce6 -> 82c3594)

This is an automated email from the ASF dual-hosted git repository.

irakov pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git.


    from 6fa6ce6  Revert "Checkbox 'Delete all files in checkout directory before each snapshot dependency build' added (#161)"
     new 272ad28  Checkbox 'delete all files in checkout directory before each snapshot dependency build' #167
     new b745f63  Increased the number of files to save logs in 2 weeks #168
     new 177bd1e  New tests list doesn't contain ignored and muted tests. Fix visa text. #169
     new 82c3594  Added web link to suite names in new tests list #170

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/ignite/ci/db/Ignite2Configurer.java |  2 +-
 .../apache/ignite/ci/tcbot/TcBotWebAppModule.java  |  2 +
 .../tcbot/visa/TcBotTriggerAndSignOffService.java  |  9 ++-
 .../apache/ignite/ci/web/rest/TriggerBuilds.java   |  5 +-
 .../src/main/webapp/js/testfails-2.2.js            | 27 ++++---
 .../ignite/tcbot/engine/cleaner/Cleaner.java       | 90 ++++++++++++++++------
 .../ignite/tcbot/engine/defect/DefectsStorage.java |  9 ++-
 .../ignite/tcbot/engine/issue/IssuesStorage.java   |  9 ++-
 .../ignite/tcbot/engine/pr/PrChainsProcessor.java  |  4 +-
 .../apache/ignite/tcbot/engine/ui/DsChainUi.java   |  4 +-
 .../tcbot/engine/ui/ShortSuiteNewTestsUi.java      | 12 ++-
 .../apache/ignite/tcignited/build/FatBuildDao.java | 24 +++++-
 .../tcservice/TeamcityServiceConnection.java       |  2 +-
 13 files changed, 145 insertions(+), 54 deletions(-)


[ignite-teamcity-bot] 02/04: Increased the number of files to save logs in 2 weeks #168

Posted by ir...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

irakov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit b745f638c715d232b1c40c10647e285ec2f912e8
Author: sergeyuttsel <ut...@gmail.com>
AuthorDate: Thu Jul 9 23:13:47 2020 +0300

    Increased the number of files to save logs in 2 weeks #168
    
    Signed-off-by: Ivan Rakov <iv...@gmail.com>
---
 .../org/apache/ignite/ci/db/Ignite2Configurer.java |  2 +-
 .../apache/ignite/ci/tcbot/TcBotWebAppModule.java  |  2 +
 .../ignite/tcbot/engine/cleaner/Cleaner.java       | 90 ++++++++++++++++------
 .../ignite/tcbot/engine/defect/DefectsStorage.java |  9 ++-
 .../ignite/tcbot/engine/issue/IssuesStorage.java   |  9 ++-
 .../apache/ignite/tcignited/build/FatBuildDao.java | 24 +++++-
 6 files changed, 103 insertions(+), 33 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java
index 6b0257c..69ddad8 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java
@@ -56,7 +56,7 @@ public class Ignite2Configurer {
         logFilePolicy.setContext(logCtx);
         logFilePolicy.setParent(rollingFa);
         logFilePolicy.setFileNamePattern(new File(logs, "logfile-%d{yyyy-MM-dd_HH}.log").getAbsolutePath());
-        logFilePolicy.setMaxHistory(7);
+        logFilePolicy.setMaxHistory(24*7*2);
         logFilePolicy.start();
 
         final String activeFileName = logFilePolicy.getActiveFileName();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/TcBotWebAppModule.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/TcBotWebAppModule.java
index 969e6b6..29ef04b 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/TcBotWebAppModule.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/TcBotWebAppModule.java
@@ -38,6 +38,7 @@ import org.apache.ignite.tcbot.common.conf.IDataSourcesConfigSupplier;
 import org.apache.ignite.tcbot.common.exeption.ExceptionUtil;
 import org.apache.ignite.tcbot.common.exeption.ServicesStartingException;
 import org.apache.ignite.tcbot.engine.TcBotEngineModule;
+import org.apache.ignite.tcbot.engine.cleaner.Cleaner;
 import org.apache.ignite.tcbot.engine.conf.ITcBotConfig;
 import org.apache.ignite.tcbot.engine.pool.TcUpdatePool;
 import org.apache.ignite.tcbot.notify.TcBotNotificationsModule;
@@ -78,6 +79,7 @@ public class TcBotWebAppModule extends AbstractModule {
         bind(ObserverTask.class).in(new SingletonScope());
         bind(BuildObserver.class).in(new SingletonScope());
         bind(VisasHistoryStorage.class).in(new SingletonScope());
+        bind(Cleaner.class).in(new SingletonScope());
 
         install(new TcBotPersistenceModule());
         install(new TeamcityIgnitedModule());
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/cleaner/Cleaner.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/cleaner/Cleaner.java
index 4c5ac1f..6d14a26 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/cleaner/Cleaner.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/cleaner/Cleaner.java
@@ -18,12 +18,16 @@ package org.apache.ignite.tcbot.engine.cleaner;
 
 import java.io.File;
 import java.time.ZonedDateTime;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
 import javax.inject.Inject;
 import org.apache.ignite.ci.teamcity.ignited.buildcondition.BuildConditionDao;
+import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.tcbot.common.conf.TcBotWorkDir;
 import org.apache.ignite.tcbot.common.interceptor.AutoProfiling;
 import org.apache.ignite.tcbot.common.interceptor.MonitoredTask;
@@ -39,6 +43,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class Cleaner {
+    private final AtomicBoolean init = new AtomicBoolean();
+
     @Inject IIssuesStorage issuesStorage;
     @Inject FatBuildDao fatBuildDao;
     @Inject SuiteInvocationHistoryDao suiteInvocationHistoryDao;
@@ -55,41 +61,62 @@ public class Cleaner {
     private ScheduledExecutorService executorService;
 
     @AutoProfiling
-    @MonitoredTask(name = "Clean ignite cache data and logs")
+    @MonitoredTask(name = "Clean old cache data and log files")
     public void clean() {
-        if (cfg.getCleanerConfig().enabled()) {
-            try {
+        try {
+            if (cfg.getCleanerConfig().enabled()) {
                 long safeDays = cfg.getCleanerConfig().safeDays();
+
                 int numOfItemsToDel = cfg.getCleanerConfig().numOfItemsToDel();
-                long thresholdDate = ZonedDateTime.now().minusDays(safeDays).toInstant().toEpochMilli();
 
-                removeCacheEntries(thresholdDate, numOfItemsToDel);
-                removeLogFiles(thresholdDate, numOfItemsToDel);
-            }
-            catch (Exception e) {
-                e.printStackTrace();
+                ZonedDateTime thresholdDate = ZonedDateTime.now().minusDays(safeDays);
+
+                logger.info("Some data (numOfItemsToDel=" + numOfItemsToDel + ") older than " + thresholdDate + " will be removed.");
 
-                logger.error("Periodic cache clean failed: " + e.getMessage(), e);
+                long thresholdEpochMilli = thresholdDate.toInstant().toEpochMilli();
+
+                removeCacheEntries(thresholdEpochMilli, numOfItemsToDel);
+
+                removeLogFiles(thresholdEpochMilli, numOfItemsToDel);
             }
+            else
+                logger.info("Periodic cache clean disabled.");
+        }
+        catch (Throwable e) {
+            logger.error("Periodic cache clean failed: " + e.getMessage(), e);
+
+            e.printStackTrace();
         }
-        else
-            logger.info("Periodic cache clean disabled.");
 
     }
 
     private void removeCacheEntries(long thresholdDate, int numOfItemsToDel) {
         List<Long> oldBuildsKeys = fatBuildDao.getOldBuilds(thresholdDate, numOfItemsToDel);
 
+        List<String> strOldBuildsKeys = oldBuildsKeys.stream().map(compositeId -> {
+                IgniteBiTuple<Integer, Integer> idTuple = FatBuildDao.cacheKeyToSrvIdAndBuildId(compositeId);
+                return "TeamCity id: " + idTuple.get1() + " build id: " + idTuple.get2();
+            })
+            .collect(Collectors.toList());
+
+        logger.info("Builds will be removed (" + strOldBuildsKeys.size() + "): " + strOldBuildsKeys);
+
         for (Long buildCacheKey : oldBuildsKeys) {
             suiteInvocationHistoryDao.remove(buildCacheKey);
+
             buildLogCheckResultDao.remove(buildCacheKey);
+
             buildRefDao.remove(buildCacheKey);
+
             buildStartTimeStorage.remove(buildCacheKey);
+
             buildConditionDao.remove(buildCacheKey);
+
             fatBuildDao.remove(buildCacheKey);
         }
 
         defectsStorage.removeOldDefects(thresholdDate, numOfItemsToDel);
+
         issuesStorage.removeOldIssues(thresholdDate, numOfItemsToDel);
     }
 
@@ -98,34 +125,47 @@ public class Cleaner {
 
         for (String srvId : cfg.getServerIds()) {
             File srvIdLogDir = new File(workDir, cfg.getTeamcityConfig(srvId).logsDirectory());
+
             removeFiles(srvIdLogDir, thresholdDate, numOfItemsToDel);
         }
 
         File tcBotLogDir = new File(workDir, "tcbot_logs");
+
         removeFiles(tcBotLogDir, thresholdDate, numOfItemsToDel);
     }
 
     private void removeFiles(File dir, long thresholdDate, int numOfItemsToDel) {
         File[] logFiles = dir.listFiles();
+
+        List<File> filesToRmv = new ArrayList<>(numOfItemsToDel);
+
         if (logFiles != null)
-            for (File file : logFiles) {
+            for (File file : logFiles)
                 if (file.lastModified() < thresholdDate && numOfItemsToDel-- > 0)
-                    file.delete();
-            }
+                    filesToRmv.add(file);
+
+        logger.info("In the directory " + dir + " files will be removed (" +
+            filesToRmv.size() + "): " + filesToRmv.stream().map(File::getName).collect(Collectors.toList())
+        );
+
+        for (File file : filesToRmv) {
+            file.delete();
+        }
+
     }
 
     public void startBackgroundClean() {
-        suiteInvocationHistoryDao.init();
-        buildLogCheckResultDao.init();
-        buildRefDao.init();
-        buildStartTimeStorage.init();
-        buildConditionDao.init();
-        fatBuildDao.init();
-
-        executorService = Executors.newSingleThreadScheduledExecutor();
+        if (init.compareAndSet(false, true)) {
+            suiteInvocationHistoryDao.init();
+            buildLogCheckResultDao.init();
+            buildRefDao.init();
+            buildStartTimeStorage.init();
+            buildConditionDao.init();
+            fatBuildDao.init();
 
-        executorService.scheduleAtFixedRate(this::clean, 30, 30, TimeUnit.MINUTES);
-//        executorService.scheduleAtFixedRate(this::clean, 0, 10, TimeUnit.SECONDS);
+            executorService = Executors.newSingleThreadScheduledExecutor();
 
+            executorService.scheduleAtFixedRate(this::clean, 5, 30, TimeUnit.MINUTES);
+        }
     }
 }
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/defect/DefectsStorage.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/defect/DefectsStorage.java
index 23008bf..407925a 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/defect/DefectsStorage.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/defect/DefectsStorage.java
@@ -180,8 +180,13 @@ public class DefectsStorage {
 
         ScanQuery<Integer, BinaryObject> scan =
             new ScanQuery<>((key, defect) -> {
-                long resolvedTs = defect.<Long>field("resolvedTs");
-                return resolvedTs > 0 && resolvedTs < thresholdDate;
+                Long resolvedTs = 0L;
+
+                if (defect.hasField("resolvedTs"))
+                    resolvedTs = defect.<Long>field("resolvedTs");
+
+                return (resolvedTs > 0 && resolvedTs < thresholdDate) ||
+                    !defect.hasField("resolvedTs");
             });
 
         for (Cache.Entry<Integer, BinaryObject> entry : cacheWithBinary.query(scan)) {
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssuesStorage.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssuesStorage.java
index 1e93c2b..554691f 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssuesStorage.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/issue/IssuesStorage.java
@@ -133,8 +133,13 @@ public class IssuesStorage implements IIssuesStorage {
 
         ScanQuery<BinaryObject, BinaryObject> scan =
             new ScanQuery<>((issueKey, issue) -> {
-                Long detectedTs = issue.<Long>field("detectedTs");
-                return detectedTs != null && detectedTs < thresholdDate && detectedTs > 0;
+                Long detectedTs = null;
+
+                if (issue.hasField("detectedTs"))
+                    detectedTs = issue.<Long>field("detectedTs");
+
+                return (detectedTs != null && detectedTs < thresholdDate && detectedTs > 0) ||
+                    !issue.hasField("detectedTs");
             });
 
         for (Cache.Entry<BinaryObject, BinaryObject> entry : cacheWithBinary.query(scan)) {
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java
index 889597e..425e31b 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/build/FatBuildDao.java
@@ -19,6 +19,7 @@ package org.apache.ignite.tcignited.build;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
+import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
@@ -47,6 +48,7 @@ import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
 import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.tcbot.common.interceptor.AutoProfiling;
 import org.apache.ignite.tcbot.persistence.CacheConfigs;
 import org.apache.ignite.tcbot.persistence.IStringCompactor;
@@ -177,6 +179,17 @@ public class FatBuildDao {
     }
 
     /**
+     * @param cacheKey cache key.
+     */
+    public static IgniteBiTuple<Integer, Integer> cacheKeyToSrvIdAndBuildId(long cacheKey) {
+        IgniteBiTuple<Integer, Integer> srvIdAndBuildId = new IgniteBiTuple<>();
+
+        srvIdAndBuildId.set((int)(cacheKey >> 32), (int)cacheKey);
+
+        return srvIdAndBuildId;
+    }
+
+    /**
      * @param srvIdMaskHigh Server id mask high.
      * @param buildId Build id.
      */
@@ -410,12 +423,18 @@ public class FatBuildDao {
         IgniteCache<Long, BinaryObject> cacheWithBinary = buildsCache.withKeepBinary();
 
         ScanQuery<Long, BinaryObject> scan = new ScanQuery<>((key, fatBuild) -> {
-                long startDate = fatBuild.<Long>field("startDate");
-                return startDate > 0 && startDate < thresholdDate;
+                Long startDate = 0L;
+
+                if (fatBuild.hasField("startDate"))
+                    startDate = fatBuild.<Long>field("startDate");
+
+                return (startDate > 0 && startDate < thresholdDate) ||
+                    !fatBuild.hasField("startDate");
             }
         );
 
         List<Long> oldBuildsKeys = new ArrayList<>(numOfItemsToDel);
+
         for (Cache.Entry<Long, BinaryObject> entry : cacheWithBinary.query(scan)) {
             if (numOfItemsToDel > 0) {
                 numOfItemsToDel--;
@@ -445,5 +464,4 @@ public class FatBuildDao {
             return entry.getValue() == null ? BuildRefDao.cacheKeyToBuildId(key) : null;
         }
     }
-
 }


[ignite-teamcity-bot] 03/04: New tests list doesn't contain ignored and muted tests. Fix visa text. #169

Posted by ir...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

irakov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit 177bd1e7bcf0b7fc3290328e249e5b68d73a8de2
Author: sergeyuttsel <ut...@gmail.com>
AuthorDate: Thu Jul 9 23:16:13 2020 +0300

    New tests list doesn't contain ignored and muted tests. Fix visa text. #169
    
    Signed-off-by: Ivan Rakov <iv...@gmail.com>
---
 .../org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java  | 2 +-
 .../main/java/org/apache/ignite/tcbot/engine/pr/PrChainsProcessor.java  | 2 +-
 .../src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
index c4de5ca..4523a57 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
@@ -962,7 +962,7 @@ public class TcBotTriggerAndSignOffService {
 
                 cnt++;
                 if (cnt > 10) {
-                    newTests.append("... and ").append(totalNewTests - cnt).append(" tests blockers\\n");
+                    newTests.append("... and ").append(totalNewTests - cnt).append(" new tests\\n");
 
                     break;
                 }
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 0f93b99..698a8b7 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
@@ -393,7 +393,7 @@ public class PrChainsProcessor {
             .map((ctx) -> {
                 List<ShortTestUi> missingTests = ctx.getFilteredTests(test -> {
                     IRunHistory history = test.history(tcIgnited, baseBranchId, null);
-                    return history == null;
+                    return history == null && !test.isMutedOrIgored();
                 })
                     .stream()
                     .map(occurrence -> new ShortTestUi().initFrom(occurrence, occurrence.isPassed()))
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java
index ec47896..cf2147e 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java
@@ -302,7 +302,7 @@ public class DsChainUi {
             .map((suite) -> {
                 List<ShortTestUi> missingTests = suite.getFilteredTests(test -> {
                     IRunHistory history = test.history(tcIgnited, baseBranchId, null);
-                    return history == null;
+                    return history == null && !test.isMutedOrIgored();
                 })
                     .stream()
                     .map(occurrence -> {


[ignite-teamcity-bot] 01/04: Checkbox 'delete all files in checkout directory before each snapshot dependency build' #167

Posted by ir...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

irakov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit 272ad2844e91b026960d59071f5c8b2e1802b2d0
Author: sergeyuttsel <ut...@gmail.com>
AuthorDate: Thu Jul 9 23:12:17 2020 +0300

    Checkbox 'delete all files in checkout directory before each snapshot dependency build' #167
    
    Signed-off-by: Ivan Rakov <iv...@gmail.com>
---
 .../tcbot/visa/TcBotTriggerAndSignOffService.java  |  3 ++-
 .../apache/ignite/ci/web/rest/TriggerBuilds.java   |  5 +++--
 .../src/main/webapp/js/testfails-2.2.js            | 24 ++++++++++++++--------
 .../tcservice/TeamcityServiceConnection.java       |  2 +-
 4 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
index 8acb1e1..c4de5ca 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
@@ -267,6 +267,7 @@ public class TcBotTriggerAndSignOffService {
         @Nullable String ticketId,
         @Nullable String prNum,
         @Nullable String baseBranchForTc,
+        @Nonnull Boolean cleanRebuild,
         @Nullable ITcBotUserCreds prov) {
         String jiraRes = "";
 
@@ -297,7 +298,7 @@ public class TcBotTriggerAndSignOffService {
         Set<Integer> buildidsToSync = new HashSet<>();
 
         for (int i = 0; i < suiteIds.length; i++) {
-            T2<Build, Set<Integer>> objects = teamcity.triggerBuild(suiteIds[i], branchForTc, false, top != null && top, new HashMap<>(),
+            T2<Build, Set<Integer>> objects = teamcity.triggerBuild(suiteIds[i], branchForTc, cleanRebuild, top != null && top, new HashMap<>(),
                 false, "");
             buildidsToSync.addAll(objects.get2());
             builds[i] = objects.get1();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java
index 75a8d69..afb8a68 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/TriggerBuilds.java
@@ -83,7 +83,8 @@ public class TriggerBuilds {
         @Nullable @QueryParam("observe") Boolean observe,
         @Nullable @QueryParam("ticketId") String ticketId,
         @Nullable @QueryParam("prNum") String prNum,
-        @Nullable @QueryParam("baseBranchForTc") String baseBranchForTc
+        @Nullable @QueryParam("baseBranchForTc") String baseBranchForTc,
+        @Nonnull @QueryParam("cleanRebuild") Boolean cleanRebuild
     ) {
         ITcBotUserCreds prov = ITcBotUserCreds.get(req);
         Injector injector = CtxListener.getInjector(ctx);
@@ -95,7 +96,7 @@ public class TriggerBuilds {
 
         String jiraRes = injector
             .getInstance(TcBotTriggerAndSignOffService.class)
-            .triggerBuildsAndObserve(srvCodeOrAlias, branchForTc, parentSuiteId, suiteIdList, top, observe, ticketId, prNum, baseBranchForTc, prov);
+            .triggerBuildsAndObserve(srvCodeOrAlias, branchForTc, parentSuiteId, suiteIdList, top, observe, ticketId, prNum, baseBranchForTc, cleanRebuild, prov);
 
         return new TriggerResult("Tests started." + (!jiraRes.isEmpty() ? "<br>" + jiraRes : ""));
     }
diff --git a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
index 09eb64b..5a0b573 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
@@ -237,12 +237,12 @@ function showChainCurrentStatusData(chain, settings) {
         moreInfoTxt += "Trigger failed " + cntFailed + " builds";
         moreInfoTxt += " <a href='javascript:void(0);' ";
         moreInfoTxt += " onClick='triggerBuilds(\"" + srvCodeForTriggering + "\", \"" + parentSuitId + "\", " +
-            "\"" + suitesFailedList + "\", \"" + chain.branchName + "\", false, false, null, \"" + chain.prNum + "\", null)' ";
+            "\"" + suitesFailedList + "\", \"" + chain.branchName + "\", false, false, null, \"" + chain.prNum + "\", null, false)' ";
         moreInfoTxt += " title='trigger builds'>in queue</a> ";
 
         moreInfoTxt += " <a href='javascript:void(0);' ";
         moreInfoTxt += " onClick='triggerBuilds(\"" + srvCodeForTriggering + "\", \"" + parentSuitId + "\", " +
-            "\"" + suitesFailedList + "\", \"" + chain.branchName + "\", true, false, null, \"" + chain.prNum + "\", null)' ";
+            "\"" + suitesFailedList + "\", \"" + chain.branchName + "\", true, false, null, \"" + chain.prNum + "\", null, false)' ";
         moreInfoTxt += " title='trigger builds'>on top</a><br>";
     }
 
@@ -302,7 +302,7 @@ function showChainCurrentStatusData(chain, settings) {
             "\"" + chain.branchName + "\", " +
             "\"" + parentSuitId + "\", " +
             "\"\", " + // ticket id
-            "\"" + baseBranchForTc + "\")'>Comment JIRA</button>&nbsp;&nbsp;";
+            "\"" + baseBranchForTc + "\")'>Comment JIRA</button><br>";
 
         var blockersList = "";
 
@@ -319,6 +319,8 @@ function showChainCurrentStatusData(chain, settings) {
             }
         }
 
+        res += "<label for='cleanRebuild'><input id='cleanRebuild' type='checkbox'>Delete all files in checkout directory before each snapshot dependency build</label><br>"
+
         res += "<button onclick='triggerBuilds(" +
             "\"" + srvCodeForTriggering + "\", " +
             "\"" + parentSuitId + "\", " +
@@ -328,7 +330,8 @@ function showChainCurrentStatusData(chain, settings) {
             "false, " + //observe
             "null, " + // ticketId
             "\"" + + chain.prNum + "\", " +
-            "\"" + baseBranchForTc + "\" " +
+            "\"" + baseBranchForTc + "\", " +
+            "document.getElementById(\"cleanRebuild\").checked" +
             ")'> " +
             "Re-run possible blockers</button><br>";
 
@@ -341,7 +344,9 @@ function showChainCurrentStatusData(chain, settings) {
             "false, " + //observe
             "null, " + // ticketId
             "\"" + chain.prNum + "\", " + //prNum
-            "\"" + baseBranchForTc + "\")'> " +
+            "\"" + baseBranchForTc + "\", " +
+            "document.getElementById(\"cleanRebuild\").checked" +
+            ")'> " +
             "Re-run possible blockers (top queue)</button><br>";
     }
 
@@ -445,7 +450,7 @@ function filterPossibleBlocker(suite) {
     return null;
 }
 
-function triggerBuilds(tcServerCode, parentSuiteId, suiteIdList, branchName, top, observe, ticketId, prNum, baseBranchForTc) {
+function triggerBuilds(tcServerCode, parentSuiteId, suiteIdList, branchName, top, observe, ticketId, prNum, baseBranchForTc, cleanRebuild=false) {
     var queueAtTop = isDefinedAndFilled(top) && top;
     var observeJira = isDefinedAndFilled(observe) && observe;
     var suiteIdsNotExists = !isDefinedAndFilled(suiteIdList) || suiteIdList.length === 0;
@@ -510,7 +515,8 @@ function triggerBuilds(tcServerCode, parentSuiteId, suiteIdList, branchName, top
                 "observe": observeJira,
                 "ticketId": ticketId,
                 "prNum": prNum,
-                "baseBranchForTc": baseBranchForTc
+                "baseBranchForTc": baseBranchForTc,
+                "cleanRebuild": cleanRebuild
             },
             success: successDialog,
             error: showErrInLoadStatus
@@ -732,12 +738,12 @@ function showSuiteData(suite, settings, prNum) {
         mInfo += " Trigger build: ";
         mInfo += "<a href='javascript:void(0);' ";
         mInfo += " onClick='triggerBuilds(\"" + suite.serverId + "\", null, \"" +
-            suite.suiteId + "\", \"" + suite.branchName + "\", false, false, null, \"" + prNum + "\", null)' ";
+            suite.suiteId + "\", \"" + suite.branchName + "\", false, false, null, \"" + prNum + "\", null, false)' ";
         mInfo += " title='trigger build' >queue</a> ";
 
         mInfo += "<a href='javascript:void(0);' ";
         mInfo += " onClick='triggerBuilds(\"" + suite.serverId + "\", null, \"" +
-            suite.suiteId + "\", \"" + suite.branchName + "\", true, false, null, \"" + prNum + "\", null)' ";
+            suite.suiteId + "\", \"" + suite.branchName + "\", true, false, null, \"" + prNum + "\", null, false)' ";
         mInfo += " title='trigger build at top of queue'>top</a><br>";
     }
 
diff --git a/tcbot-teamcity/src/main/java/org/apache/ignite/tcservice/TeamcityServiceConnection.java b/tcbot-teamcity/src/main/java/org/apache/ignite/tcservice/TeamcityServiceConnection.java
index bc8e825..aa53420 100644
--- a/tcbot-teamcity/src/main/java/org/apache/ignite/tcservice/TeamcityServiceConnection.java
+++ b/tcbot-teamcity/src/main/java/org/apache/ignite/tcservice/TeamcityServiceConnection.java
@@ -172,7 +172,7 @@ public class TeamcityServiceConnection implements ITeamcity {
         String comments = " <comment><text>" +
             Strings.nullToEmpty(freeTextComments) + ", " +
             "Build triggered from Ignite TC Bot" +
-            " [cleanRebuild=" + cleanRebuild + ", top=" + queueAtTop + "]" +
+            " [cleanSources=" + cleanRebuild + ", cleanRebuild=" + cleanRebuild + ", top=" + queueAtTop + "]" +
             "</text></comment>\n";
 
         Map<String, Object> props = new HashMap<>();


[ignite-teamcity-bot] 04/04: Added web link to suite names in new tests list #170

Posted by ir...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

irakov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit 82c3594269fa07cba9c6a572f8299af92d47df2f
Author: sergeyuttsel <ut...@gmail.com>
AuthorDate: Thu Jul 9 23:17:13 2020 +0300

    Added web link to suite names in new tests list #170
    
    Signed-off-by: Ivan Rakov <iv...@gmail.com>
---
 .../ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java  |  4 ++--
 ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js     |  3 +++
 .../org/apache/ignite/tcbot/engine/pr/PrChainsProcessor.java |  2 +-
 .../java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java    |  2 +-
 .../apache/ignite/tcbot/engine/ui/ShortSuiteNewTestsUi.java  | 12 +++++++++++-
 5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
index 4523a57..ff4f5e8 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/TcBotTriggerAndSignOffService.java
@@ -928,13 +928,13 @@ public class TcBotTriggerAndSignOffService {
             newTests.append(jiraEscText(suite.name)).append("{color}");
 
             int totalNewTests = suite.tests.size();
-            newTests.append(" [tests ").append(totalNewTests);
+            newTests.append(" [[tests ").append(totalNewTests);
 
             int cnt = 0;
 
             newTestsCount += suite.tests().size();
 
-            newTests.append("]\\n");
+            newTests.append('|').append(suite.webToBuild).append("]]\\n");
 
             for (ShortTestUi test : suite.tests()) {
                 String testColor;
diff --git a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
index 5a0b573..bc4313e 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.2.js
@@ -111,6 +111,9 @@ function showNewTestsData(chain, settings) {
 
     for (var i = 0; i < chain.length; i++) {
         var newTests = chain[i].tests;
+        newTestRows += "<tr><td colspan='2' width='10%'></td>";
+        newTestRows += "<td colspan='2' width='80%'><a href='" + chain[i].webToBuild + "'>" + chain[i].name + "</a>" + "</td></tr>";
+        newTestRows += "<td colspan='2' width='10%'></td>";
         for (var j = 0; j < newTests.length; j++) {
             newTestsFounded = true
             var newTest = newTests[j];
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 698a8b7..8f0d56b 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
@@ -403,7 +403,7 @@ public class PrChainsProcessor {
                 if (!missingTests.isEmpty()) {
                     return new ShortSuiteNewTestsUi()
                         .tests(missingTests)
-                        .initFrom(ctx);
+                        .initFrom(ctx, tcIgnited);
                 }
                 return null;
             })
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java
index cf2147e..f31aafe 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/DsChainUi.java
@@ -314,7 +314,7 @@ public class DsChainUi {
                 if (!missingTests.isEmpty()) {
                     return new ShortSuiteNewTestsUi()
                         .tests(missingTests)
-                        .initFrom(suite);
+                        .initFrom(suite, tcIgnited);
                 }
                 return null;
             })
diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortSuiteNewTestsUi.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortSuiteNewTestsUi.java
index 8bfb2e5..7e37efb 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortSuiteNewTestsUi.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortSuiteNewTestsUi.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.List;
 import javax.annotation.Nonnull;
 import org.apache.ignite.tcbot.engine.chain.MultBuildRunCtx;
+import org.apache.ignite.tcignited.ITeamcityIgnited;
 
 public class ShortSuiteNewTestsUi extends DsHistoryStatUi {
     /** Suite Name */
@@ -28,6 +29,9 @@ public class ShortSuiteNewTestsUi extends DsHistoryStatUi {
 
     public List<ShortTestUi> tests = new ArrayList<>();
 
+    /** Web Href. to suite particular run */
+    public String webToBuild = "";
+
     public Collection<? extends ShortTestUi> tests() {
         return tests;
     }
@@ -38,9 +42,15 @@ public class ShortSuiteNewTestsUi extends DsHistoryStatUi {
         return this;
     }
 
-    public ShortSuiteNewTestsUi initFrom(@Nonnull MultBuildRunCtx suite) {
+    public ShortSuiteNewTestsUi initFrom(@Nonnull MultBuildRunCtx suite,
+        ITeamcityIgnited tcIgnited) {
         name = suite.suiteName();
+        webToBuild = buildWebLinkToBuild(tcIgnited, suite);
 
         return this;
     }
+
+    private static String buildWebLinkToBuild(ITeamcityIgnited teamcity, MultBuildRunCtx chain) {
+        return teamcity.host() + "viewLog.html?buildId=" + chain.getBuildId();
+    }
 }