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 2021/11/17 15:46:08 UTC
[ignite-teamcity-bot] branch master updated: Small refactoring
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
The following commit(s) were added to refs/heads/master by this push:
new ef2f080 Small refactoring
ef2f080 is described below
commit ef2f08070b4efb299a1caf43162f957ac22486bb
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Wed Nov 17 18:45:52 2021 +0300
Small refactoring
---
conf/branches.json | 4 ++--
.../java/org/apache/ignite/ci/jobs/CheckQueueJob.java | 16 +++++++---------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/conf/branches.json b/conf/branches.json
index 436e577..a2f7f1b 100644
--- a/conf/branches.json
+++ b/conf/branches.json
@@ -19,9 +19,9 @@
"logsDir": "apache_logs",
/** Default tracked branch name in internal identification of TC bot. */
"defaultTrackedBranch": "master",
- /** Time as auto-triggering build is disabled. ISO time formatting must be used. */
+ /** Time as auto-triggering build is disabled. ISO time formatting must be used, e.g. 09:00:00. Should be set simultaneusly with autoTriggeringBuildDisabledEndTime. */
// "autoTriggeringBuildDisabledStartTime": "07:00:00",
- /** Time as auto-triggering build is enabled. ISO time formatting must be used. */
+ /** Time as auto-triggering build is enabled. ISO time formatting must be used, e.g. 18:00:00. Should be set simultaneusly with autoTriggeringBuildDisabledStartTime. */
// "autoTriggeringBuildDisabledEndTime": "20:00:00",
/** Build parameters, which may be used for filtering Run history and tagging builds. */
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/jobs/CheckQueueJob.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/jobs/CheckQueueJob.java
index 7d41cfd..2f4027a 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/jobs/CheckQueueJob.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/jobs/CheckQueueJob.java
@@ -36,6 +36,7 @@ import org.apache.ignite.ci.teamcity.ignited.BuildRefCompacted;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
import org.apache.ignite.ci.user.ITcBotUserCreds;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.tcbot.common.conf.ITcServerConfig;
import org.apache.ignite.tcbot.common.exeption.ExceptionUtil;
import org.apache.ignite.tcbot.common.interceptor.AutoProfiling;
import org.apache.ignite.tcbot.common.interceptor.MonitoredTask;
@@ -135,7 +136,7 @@ public class CheckQueueJob implements Runnable {
protected String runEx() {
logger.info("Build triggering task is started");
- if (Boolean.valueOf(System.getProperty(AUTO_TRIGGERING_BUILD_DISABLED))) {
+ if (Boolean.parseBoolean(System.getProperty(AUTO_TRIGGERING_BUILD_DISABLED))) {
final String msg = "Automatic build triggering was disabled.";
logger.info(msg);
return msg;
@@ -400,27 +401,24 @@ public class CheckQueueJob implements Runnable {
/**
* @param srvCode Server code.
- * @return {@code true} if auto-triggering disabled for working hours.
+ * @return {@code true} if auto-triggering is disabled now for working hours.
*/
private boolean autoTriggerDisabledForWorkingHours(String srvCode) {
-
DayOfWeek curDayOfWeek = LocalDate.now().getDayOfWeek();
if (curDayOfWeek == DayOfWeek.SATURDAY || curDayOfWeek == DayOfWeek.SUNDAY)
return false;
- String startTime = cfg.getTeamcityConfig(srvCode).autoTriggeringBuildDisabledStartTime();
+ ITcServerConfig tcCfg = cfg.getTeamcityConfig(srvCode);
- String endTime = cfg.getTeamcityConfig(srvCode).autoTriggeringBuildDisabledEndTime();
+ String startTime = tcCfg.autoTriggeringBuildDisabledStartTime();
+ String endTime = tcCfg.autoTriggeringBuildDisabledEndTime();
if (startTime == null || endTime == null)
return false;
LocalTime now = LocalTime.now();
- if (now.isAfter(LocalTime.parse(startTime)) && now.isBefore(LocalTime.parse(endTime)))
- return true;
-
- return false;
+ return now.isAfter(LocalTime.parse(startTime)) && now.isBefore(LocalTime.parse(endTime));
}
}