You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/04/12 19:46:39 UTC

[ignite-teamcity-bot] branch ce-cfg-usability updated (596aa38 -> d39ec77)

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

dpavlov pushed a change to branch ce-cfg-usability
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git.


    from 596aa38  Old Github branches uploading implemented to detect PRless contributions earlier; more statused considered as actual
     new 67dcd11  TC config refactoring: removal of unused values
     new 349a484  Merge branch 'master' into ce-cfg-usability
     new d39ec77  TC config refactoring: removal of unused values

The 3 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:
 .../main/java/org/apache/ignite/ci/ITeamcity.java  |  1 -
 .../apache/ignite/ci/IgniteTeamcityConnection.java | 52 +++++++---------------
 .../ignite/ci/tcbot/conf/ITcServerConfig.java      |  6 +--
 .../ignite/ci/tcbot/conf/TcServerConfig.java       |  8 ----
 .../teamcity/ignited/TcIgnitedCachingProvider.java |  7 +--
 .../ci/teamcity/ignited/TeamcityIgnitedImpl.java   | 32 ++++++-------
 .../ignite/ci/teamcity/pure/TcLoginImpl.java       |  9 ----
 .../java/org/apache/ignite/ci/util/UrlUtil.java    |  9 ----
 8 files changed, 41 insertions(+), 83 deletions(-)


[ignite-teamcity-bot] 02/03: Merge branch 'master' into ce-cfg-usability

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

dpavlov pushed a commit to branch ce-cfg-usability
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit 349a484e7c05db989b8e01207d42e056ebeeee6f
Merge: 596aa38 67dcd11
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Fri Apr 12 22:45:57 2019 +0300

    Merge branch 'master' into ce-cfg-usability
    
    # Conflicts:
    #	ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java

 .../main/java/org/apache/ignite/ci/ITeamcity.java  |  1 -
 .../apache/ignite/ci/IgniteTeamcityConnection.java | 55 ++++++++--------------
 .../ignite/ci/tcbot/conf/ITcServerConfig.java      |  6 +--
 .../ignite/ci/tcbot/conf/TcServerConfig.java       |  8 ----
 .../teamcity/ignited/TcIgnitedCachingProvider.java |  7 +--
 .../ci/teamcity/ignited/TeamcityIgnitedImpl.java   | 32 +++++++------
 .../ignite/ci/teamcity/pure/TcLoginImpl.java       |  9 ----
 .../java/org/apache/ignite/ci/util/UrlUtil.java    |  9 ----
 8 files changed, 43 insertions(+), 84 deletions(-)

diff --cc ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
index fcdbc0b,a8d004a..71f6a58
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
@@@ -101,9 -94,9 +94,9 @@@ public class IgniteTeamcityConnection i
      /** Teamcity http connection. */
      @Inject private ITeamcityHttpConnection teamcityHttpConn;
  
 -    @Inject private ITcBotConfig config;
 +    @Inject private ITcBotConfig cfg;
  
-     private String tcName;
+     private String srvCode;
  
      /** Build logger processing running. */
      private ConcurrentHashMap<Integer, CompletableFuture<LogCheckTask>> buildLogProcessingRunning = new ConcurrentHashMap<>();
@@@ -141,6 -112,10 +112,10 @@@
          this.executor = MoreExecutors.directExecutor();
      }
  
+     public ITcServerConfig config() {
 -        return this.config.getTeamcityConfig(this.srvCode );
++        return cfg.getTeamcityConfig(this.srvCode );
+     }
+ 
      /** {@inheritDoc} */
      @Override public void setAuthToken(String tok) {
          basicAuthTok = tok;
diff --cc ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ITcServerConfig.java
index 52af7a5,1d07f25..3bc4763
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ITcServerConfig.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ITcServerConfig.java
@@@ -32,11 -29,11 +29,14 @@@ public interface ITcServerConfig 
       */
      @Nullable public String reference();
  
+     /**
+      * @return Normalized Host address, ends with '/'.
+      */
      @NotNull public String host();
  
 +    /**
 +     * @return Directory for downloading build logs (will contain ZIP files).
 +     */
      @NotNull public String logsDirectory();
  
      /**


[ignite-teamcity-bot] 01/03: TC config refactoring: removal of unused values

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

dpavlov pushed a commit to branch ce-cfg-usability
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit 67dcd11f2aed46c93c4eefb338c63eb65db52606
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Fri Apr 12 22:44:44 2019 +0300

    TC config refactoring: removal of unused values
---
 .../main/java/org/apache/ignite/ci/ITeamcity.java  |  1 -
 .../apache/ignite/ci/IgniteTeamcityConnection.java | 54 ++++++++--------------
 .../ignite/ci/tcbot/conf/ITcServerConfig.java      |  6 +--
 .../ignite/ci/tcbot/conf/TcServerConfig.java       |  8 ----
 .../teamcity/ignited/TcIgnitedCachingProvider.java |  7 +--
 .../ci/teamcity/ignited/TeamcityIgnitedImpl.java   | 32 +++++++------
 .../ignite/ci/teamcity/pure/TcLoginImpl.java       |  9 ----
 .../java/org/apache/ignite/ci/util/UrlUtil.java    |  9 ----
 8 files changed, 42 insertions(+), 84 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
index 89f1155..1f002b8 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/ITeamcity.java
@@ -42,7 +42,6 @@ import java.util.concurrent.ExecutorService;
  * https://confluence.jetbrains.com/display/TCD10/REST+API
  */
 public interface ITeamcity extends ITeamcityConn {
-
     public String DEFAULT = "<default>";
     public String REFS_HEADS_MASTER = "refs/heads/master";
 
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
index 7e1cba0..a8d004a 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
@@ -63,7 +63,6 @@ import javax.xml.bind.JAXBException;
 import java.io.*;
 import java.util.SortedSet;
 import java.util.List;
-import java.util.Properties;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Supplier;
@@ -89,12 +88,6 @@ public class IgniteTeamcityConnection implements ITeamcity {
     /** Executor. */
     private Executor executor;
 
-    /** Logs directory. */
-    private File logsDir;
-
-    /** Normalized Host address, ends with '/'. */
-    private String host;
-
     /** TeamCity authorization token. */
     private String basicAuthTok;
 
@@ -103,7 +96,7 @@ public class IgniteTeamcityConnection implements ITeamcity {
 
     @Inject private ITcBotConfig config;
 
-    private String tcName;
+    private String srvCode;
 
     /** Build logger processing running. */
     private ConcurrentHashMap<Integer, CompletableFuture<LogCheckTask>> buildLogProcessingRunning = new ConcurrentHashMap<>();
@@ -113,35 +106,16 @@ public class IgniteTeamcityConnection implements ITeamcity {
     }
 
     /** {@inheritDoc} */
-    @Override public void init(@Nullable String tcName) {
-        this.tcName = tcName;
-
-        ITcServerConfig tcCfg = this.config.getTeamcityConfig(tcName);
-        final Properties props = tcCfg.properties();
-
-        this.host = tcCfg.host();
-
-        if (props != null) {
-            try {
-                if (!Strings.isNullOrEmpty(props.getProperty(HelperConfig.USERNAME))
-                    && props.getProperty(HelperConfig.ENCODED_PASSWORD) != null)
-                    setAuthToken(HelperConfig.prepareBasicHttpAuthToken(props, "TC Config"));
-            }
-            catch (Exception e) {
-                e.printStackTrace();
-                logger.error("Failed to set credentials", e);
-            }
-        }
-
-        final File logsDirFile = HelperConfig.resolveLogs(
-            HelperConfig.resolveWorkDir(),
-            tcCfg.logsDirectory());
-
-        logsDir = ensureDirExist(logsDirFile);
+    @Override public void init(@Nullable String srvCode) {
+        this.srvCode = srvCode;
 
         this.executor = MoreExecutors.directExecutor();
     }
 
+    public ITcServerConfig config() {
+        return this.config.getTeamcityConfig(this.srvCode );
+    }
+
     /** {@inheritDoc} */
     @Override public void setAuthToken(String tok) {
         basicAuthTok = tok;
@@ -170,7 +144,7 @@ public class IgniteTeamcityConnection implements ITeamcity {
         boolean archive = true;
         Supplier<File> supplier = () -> {
             String buildIdStr = Integer.toString(buildId);
-            final File buildDir = ensureDirExist(new File(logsDir, "buildId" + buildIdStr));
+            final File buildDir = ensureDirExist(new File(logsDir(), "buildId" + buildIdStr));
             final File file = new File(buildDir,
                 "build.log" + (archive ? ".zip" : ""));
             if (file.exists() && file.canRead() && file.length() > 0) {
@@ -192,6 +166,14 @@ public class IgniteTeamcityConnection implements ITeamcity {
         return supplyAsync(supplier, executor);
     }
 
+    private File logsDir() {
+        File logsDirFile = HelperConfig.resolveLogs(
+                HelperConfig.resolveWorkDir(),
+                config().logsDirectory());
+
+        return ensureDirExist(logsDirFile);
+    }
+
     @AutoProfiling
     @Override public CompletableFuture<LogCheckResult> analyzeBuildLog(Integer buildId, SingleBuildRunCtx ctx) {
         final Stopwatch started = Stopwatch.createStarted();
@@ -313,7 +295,7 @@ public class IgniteTeamcityConnection implements ITeamcity {
      * @return Normalized Host address, ends with '/'.
      */
     @Override public String host() {
-        return host;
+        return config().host();
     }
 
     /** {@inheritDoc} */
@@ -372,7 +354,7 @@ public class IgniteTeamcityConnection implements ITeamcity {
 
     /** {@inheritDoc} */
     @Override public String serverId() {
-        return tcName;
+        return srvCode;
     }
 
     private CompletableFuture<LogCheckTask> checkBuildLogNoCache(int buildId, ISuiteResults ctx) {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ITcServerConfig.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ITcServerConfig.java
index 5a415b4..1d07f25 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ITcServerConfig.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ITcServerConfig.java
@@ -24,14 +24,14 @@ import org.jetbrains.annotations.Nullable;
  * Teamcity Server configuration.
  */
 public interface ITcServerConfig {
-    @Deprecated
-    public Properties properties();
-
     /**
      * @return Another TC Server (service) config name to use settings from. Filled only for server aliases.
      */
     @Nullable public String reference();
 
+    /**
+     * @return Normalized Host address, ends with '/'.
+     */
     @NotNull public String host();
 
     @NotNull public String logsDirectory();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/TcServerConfig.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/TcServerConfig.java
index 1c42a11..c7d3688 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/TcServerConfig.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/TcServerConfig.java
@@ -62,14 +62,6 @@ public class TcServerConfig implements ITcServerConfig {
     }
 
     /** {@inheritDoc} */
-    @Override public Properties properties() {
-        if (props == null)
-            return new Properties();
-
-        return props;
-    }
-
-    /** {@inheritDoc} */
     @Override public String reference() {
         return reference;
     }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TcIgnitedCachingProvider.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TcIgnitedCachingProvider.java
index 77ff2e7..6fe237e 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TcIgnitedCachingProvider.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TcIgnitedCachingProvider.java
@@ -75,14 +75,15 @@ class TcIgnitedCachingProvider implements ITeamcityIgnitedProvider {
                 ITeamcity tcRealConn = srvFactory.server(realSrvCode, prov);
 
                 if (prov != null) {
-                    final String user = prov.getUser(realSrvCode);
-                    final String pwd = prov.getPassword(realSrvCode);
+                    String user = prov.getUser(realSrvCode);
+                    String pwd = prov.getPassword(realSrvCode);
+
                     tcRealConn.setAuthData(user, pwd);
                 }
 
                 TeamcityIgnitedImpl impl = provider.get();
 
-                impl.init(realSrvCode, tcRealConn);
+                impl.init(tcRealConn);
 
                 return impl;
             });
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
index b38350e..b1a8039 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
@@ -89,8 +89,8 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
     /** Max build id diff to enforce reload during incremental refresh. */
     public static final int MAX_ID_DIFF_TO_ENFORCE_CONTINUE_SCAN = 3000;
 
-    /** Server id. */
-    private String srvName;
+    /** Server (service) code. */
+    private String srvCode;
 
     /** Pure HTTP Connection API. */
     private ITeamcityConn conn;
@@ -146,11 +146,13 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
     /** Server ID mask for cache Entries. */
     private int srvIdMaskHigh;
 
-    public void init(String srvId, ITeamcityConn conn) {
-        this.srvName = srvId;
+    public void init(ITeamcityConn conn) {
+        String srvCode = conn.serverId();
+
+        this.srvCode = srvCode;
         this.conn = conn;
 
-        srvIdMaskHigh = ITeamcityIgnited.serverIdToInt(srvId);
+        srvIdMaskHigh = ITeamcityIgnited.serverIdToInt(srvCode);
         buildRefDao.init(); //todo init somehow in auto
         buildConditionDao.init();
         fatBuildDao.init();
@@ -165,12 +167,12 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
      */
     @NotNull
     private String taskName(String taskName) {
-        return ITeamcityIgnited.class.getSimpleName() +"." + taskName + "." + srvName;
+        return ITeamcityIgnited.class.getSimpleName() +"." + taskName + "." + srvCode;
     }
 
     /** {@inheritDoc} */
     @Override public String serverId() {
-        return srvName;
+        return srvCode;
     }
 
     /** {@inheritDoc} */
@@ -456,14 +458,14 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
      * Enables scheduleing for build refs/builds/history sync
      */
     public void ensureActualizeRequested() {
-        scheduler.sheduleNamed(taskName("actualizeRecentBuildRefs"), () -> actualizeRecentBuildRefs(srvName), 2, TimeUnit.MINUTES);
+        scheduler.sheduleNamed(taskName("actualizeRecentBuildRefs"), () -> actualizeRecentBuildRefs(srvCode), 2, TimeUnit.MINUTES);
 
         buildRefSync.ensureActualizeRequested();
 
         // schedule find missing later
-        fatBuildSync.ensureActualizationRequested(srvName, conn);
+        fatBuildSync.ensureActualizationRequested(srvCode, conn);
 
-        runHistSync.invokeLaterFindMissingHistory(srvName);
+        runHistSync.invokeLaterFindMissingHistory(srvCode);
     }
 
     /** {@inheritDoc} */
@@ -471,7 +473,7 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
         Build build = conn.triggerBuild(buildTypeId, branchName, cleanRebuild, queueAtTop);
 
         //todo may add additional parameter: load builds into DB in sync/async fashion
-        buildRefSync.runActualizeBuildRefs(srvName, false, Sets.newHashSet(build.getId()), conn);
+        buildRefSync.runActualizeBuildRefs(srvCode, false, Sets.newHashSet(build.getId()), conn);
 
         return build;
     }
@@ -565,7 +567,7 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
     }
 
     String actualizeRecentBuildRefs() {
-        return actualizeRecentBuildRefs(srvName);
+        return actualizeRecentBuildRefs(srvCode);
     }
 
     /**
@@ -595,12 +597,12 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
         //schedule direct reload for Fat Builds for all queued too-old builds
         fatBuildSync.scheduleBuildsLoad(conn, directUpload);
 
-        buildRefSync.runActualizeBuildRefs(srvName, false, paginateUntil, conn);
+        buildRefSync.runActualizeBuildRefs(srvCode, false, paginateUntil, conn);
 
         int freshButNotFoundByBuildsRefsScan = paginateUntil.size();
         if (!paginateUntil.isEmpty()) {
             //some builds may stuck in the queued or running, enforce loading now
-            fatBuildSync.doLoadBuilds(-1, srvName, conn, paginateUntil);
+            fatBuildSync.doLoadBuilds(-1, srvCode, conn, paginateUntil);
         }
 
         // schedule full resync later
@@ -622,6 +624,6 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
      *
      */
     void fullReindex() {
-        buildRefSync.runActualizeBuildRefs(srvName, true, null, conn);
+        buildRefSync.runActualizeBuildRefs(srvCode, true, null, conn);
     }
 }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/TcLoginImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/TcLoginImpl.java
index 2cf6281..bacc4b2 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/TcLoginImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/TcLoginImpl.java
@@ -46,15 +46,6 @@ class TcLoginImpl implements ITcLogin {
 
             final User tcUser = tcConn.getUserByUsername(username);
 
-                /*
-                final List<UserRef> usersRefs = users.getUsersRefs();
-
-                for (UserRef next : usersRefs) {
-                    if (next.username.equals(username)) {
-                        System.err.println("Found ");
-                    }
-                }*/
-
             if (tcUser != null)
                 logger.info("TC user returned: " + tcUser);
 
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/UrlUtil.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/UrlUtil.java
index 600d124..f33472c 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/UrlUtil.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/util/UrlUtil.java
@@ -37,13 +37,4 @@ public class UrlUtil {
             return val;
         }
     }
-
-    public static String escapeOrB64(String val) {
-        if (Strings.nullToEmpty(val).contains("/")) {
-            String idForRestEncoded = Base64Util.encodeUtf8String(val);
-            return "($base64:" + idForRestEncoded + ")";
-        }
-        else
-            return escape(val);
-    }
 }


[ignite-teamcity-bot] 03/03: TC config refactoring: removal of unused values

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

dpavlov pushed a commit to branch ce-cfg-usability
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git

commit d39ec777f495ec15e627d94c9671e6cf09f28711
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Fri Apr 12 22:46:29 2019 +0300

    TC config refactoring: removal of unused values
---
 .../src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
index 71f6a58..b75be87 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
@@ -105,8 +105,7 @@ public class IgniteTeamcityConnection implements ITeamcity {
         return executor;
     }
 
-    /** {@inheritDoc} */
-    @Override public void init(@Nullable String srvCode) {
+    public void init(@Nullable String srvCode) {
         this.srvCode = srvCode;
 
         this.executor = MoreExecutors.directExecutor();