ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] asfgit closed pull request #94: Visa History page fix
Date Mon, 10 Dec 2018 12:02:38 GMT
asfgit closed pull request #94: Visa History page fix
URL: https://github.com/apache/ignite-teamcity-bot/pull/94
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
index 3de27fad..88a858e6 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildObserver.java
@@ -20,9 +20,11 @@
 import java.util.Objects;
 import java.util.Timer;
 import javax.inject.Inject;
-import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
 import org.apache.ignite.ci.ITcHelper;
 import org.apache.ignite.ci.tcmodel.result.Build;
+import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
+import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnited;
+import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnitedProvider;
 import org.apache.ignite.ci.user.ICredentialsProv;
 import org.apache.ignite.ci.web.model.ContributionKey;
 import org.slf4j.Logger;
@@ -48,6 +50,12 @@
     /** Helper. */
     @Inject private ITcHelper tcHelper;
 
+    /** */
+    @Inject private ITeamcityIgnitedProvider teamcityIgnitedProvider;
+
+    /** */
+    @Inject private IStringCompactor strCompactor;
+
     /**
      */
     @Inject
@@ -109,11 +117,11 @@ public String getObservationStatus(ContributionKey key) {
 
         ICredentialsProv creds = tcHelper.getServerAuthorizerCreds();
 
-        IAnalyticsEnabledTeamcity teamcity = tcHelper.server(key.srvId, creds);
+        ITeamcityIgnited teamcity = teamcityIgnitedProvider.server(key.srvId, creds);
 
         if (Objects.nonNull(buildsInfo)) {
             sb.append(buildsInfo.ticket).append(" to be commented, waiting for builds. ");
-            sb.append(buildsInfo.finishedBuildsCount(teamcity));
+            sb.append(buildsInfo.finishedBuildsCount(teamcity, strCompactor));
             sb.append(" builds done from ");
             sb.append(buildsInfo.buildsCount());
         }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
index ad1b548c..bbd01daa 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/BuildsInfo.java
@@ -24,9 +24,10 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
-import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
 import org.apache.ignite.ci.tcmodel.result.Build;
 import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
+import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnited;
+import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
 import org.apache.ignite.ci.user.ICredentialsProv;
 import org.apache.ignite.ci.web.model.ContributionKey;
 
@@ -103,20 +104,21 @@ public BuildsInfo(String srvId, ICredentialsProv prov, String ticket,
String bra
 
     /**
      * @param teamcity Teamcity.
+     * @param strCompactor {@link IStringCompactor} instance.
      *
      * @return One of {@link #FINISHED_STATUS}, {@link #CANCELLED_STATUS} or
      * {@link #RUNNING_STATUS} statuses.
      */
-    public String getStatus(IAnalyticsEnabledTeamcity teamcity) {
+    public String getStatus(ITeamcityIgnited teamcity, IStringCompactor strCompactor) {
         boolean isFinished = true;
 
         for (Integer id : builds) {
-            Build build = teamcity.getBuild(id);
+            FatBuildCompacted build = teamcity.getFatBuild(id);
 
-            if (build.isUnknown())
+            if (build.isFakeStub() || build.isCancelled(strCompactor))
                 return CANCELLED_STATUS;
 
-            if (!build.isFinished())
+            if (!build.isFinished(strCompactor))
                 isFinished = false;
         }
 
@@ -125,16 +127,18 @@ public String getStatus(IAnalyticsEnabledTeamcity teamcity) {
 
     /**
      * @param teamcity Teamcity.
+     * @param strCompactor {@link IStringCompactor} instance.
      */
-    public boolean isFinished(IAnalyticsEnabledTeamcity teamcity) {
-        return FINISHED_STATUS.equals(getStatus(teamcity));
+    public boolean isFinished(ITeamcityIgnited teamcity, IStringCompactor strCompactor) {
+        return FINISHED_STATUS.equals(getStatus(teamcity, strCompactor));
     }
 
     /**
      * @param teamcity Teamcity.
+     * @param strCompactor {@link IStringCompactor} instance.
      */
-    public boolean isCancelled(IAnalyticsEnabledTeamcity teamcity) {
-        return CANCELLED_STATUS.equals(getStatus(teamcity));
+    public boolean isCancelled(ITeamcityIgnited teamcity, IStringCompactor strCompactor)
{
+        return CANCELLED_STATUS.equals(getStatus(teamcity, strCompactor));
     }
 
     /**
@@ -147,13 +151,13 @@ public int buildsCount(){
     /**
      * Return finished builds count.
      */
-    public int finishedBuildsCount(IAnalyticsEnabledTeamcity teamcity){
+    public int finishedBuildsCount(ITeamcityIgnited teamcity, IStringCompactor strCompactor){
         int finishedCnt = 0;
 
         for (Integer id : builds) {
-            Build build = teamcity.getBuild(id);
+            FatBuildCompacted build = teamcity.getFatBuild(id);
 
-            if (build.isFinished())
+            if (!build.isFakeStub() && build.isFinished(strCompactor))
                 ++finishedCnt;
         }
 
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java
index 5d127fc6..f3a5197b 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/observer/ObserverTask.java
@@ -27,12 +27,14 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.ReentrantLock;
 import javax.inject.Inject;
-import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
 import org.apache.ignite.ci.ITcHelper;
 import org.apache.ignite.ci.di.AutoProfiling;
 import org.apache.ignite.ci.di.MonitoredTask;
 import org.apache.ignite.ci.jira.IJiraIntegration;
 import org.apache.ignite.ci.jira.IJiraIntegrationProvider;
+import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
+import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnited;
+import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnitedProvider;
 import org.apache.ignite.ci.user.ICredentialsProv;
 import org.apache.ignite.ci.web.model.ContributionKey;
 import org.apache.ignite.ci.web.model.Visa;
@@ -56,6 +58,9 @@
     /** Helper. */
     @Inject private ITcHelper tcHelper;
 
+    /** */
+    @Inject private ITeamcityIgnitedProvider teamcityIgnitedProvider;
+
     /** */
     @Inject private IJiraIntegrationProvider jiraIntegrationProvider;
 
@@ -68,6 +73,9 @@
     /** */
     private Map<ContributionKey, BuildsInfo> infos = new ConcurrentHashMap<>();
 
+    /** */
+    @Inject private IStringCompactor strCompactor;
+
     /**
      */
     ObserverTask() {
@@ -158,11 +166,12 @@ protected String runObserverTask() {
             for (ContributionKey key : infos.keySet()) {
                 BuildsInfo info = infos.get(key);
 
-                IAnalyticsEnabledTeamcity teamcity = tcHelper.server(info.srvId, tcHelper.getServerAuthorizerCreds());
+                ITeamcityIgnited teamcity = teamcityIgnitedProvider.server(info.srvId,
+                    tcHelper.getServerAuthorizerCreds());
 
                 checkedBuilds += info.buildsCount();
 
-                if (info.isCancelled(teamcity)) {
+                if (info.isCancelled(teamcity, strCompactor)) {
                     rmv.add(key);
 
                     logger.error("JIRA will not be commented." +
@@ -172,8 +181,8 @@ protected String runObserverTask() {
                     continue;
                 }
 
-                if (!info.isFinished(teamcity)) {
-                    notFinishedBuilds += info.buildsCount() - info.finishedBuildsCount(teamcity);
+                if (!info.isFinished(teamcity, strCompactor)) {
+                    notFinishedBuilds += info.buildsCount() - info.finishedBuildsCount(teamcity,
strCompactor);
 
                     continue;
                 }
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 910079f9..b7a628a1 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
@@ -34,7 +34,6 @@
 import javax.ws.rs.QueryParam;
 import org.apache.ignite.ci.HelperConfig;
 import org.apache.ignite.ci.ITcHelper;
-import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
 import org.apache.ignite.ci.ITeamcity;
 import org.apache.ignite.ci.github.GitHubUser;
 import org.apache.ignite.ci.github.PullRequest;
@@ -102,6 +101,9 @@
     /** */
     @Inject private VisasHistoryStorage visasHistoryStorage;
 
+    /** */
+    @Inject private IStringCompactor strCompactor;
+
     /** */
     @Inject IStringCompactor compactor;
 
@@ -120,7 +122,6 @@ public void startObserver() {
     public List<VisaStatus> getVisasStatus(String srvId, ICredentialsProv prov) {
         List<VisaStatus> visaStatuses = new ArrayList<>();
 
-        IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, prov);
         ITeamcityIgnited ignited = tcIgnitedProv.server(srvId, prov);
 
         IJiraIntegration jiraIntegration = jiraIntegrationProvider.server(srvId);
@@ -143,7 +144,7 @@ public void startObserver() {
             BuildTypeRefCompacted bt = ignited.getBuildTypeRef(info.buildTypeId);
             visaStatus.buildTypeName = (bt != null ? bt.name(compactor) : visaStatus.buildTypeId);
 
-            String buildsStatus = visaStatus.status = info.getStatus(teamcity);
+            String buildsStatus = visaStatus.status = info.getStatus(ignited, strCompactor);
 
             if (FINISHED_STATUS.equals(buildsStatus)) {
                 if (visa.isSuccess()) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message