IGNITE-10095: Filtering parameters can be used for tagging builds.
diff --git a/conf/apache.auth.properties b/conf/apache.auth.properties
deleted file mode 100644
index d16f920..0000000
--- a/conf/apache.auth.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-## Teamcity Integration Parameters
-# Teamcity Host, HTTPs is highly recommended because of Basic Auth used.
-host=https://ci.ignite.apache.org/
-
-# TC bot downloaded logs path
-logs=apache_logs
-
-## GitHub integration parameters.
-# REST API Url for GitHub. Includes owner (apache) and project (ignite)
-git.api_url=https://api.github.com/repos/apache/ignite/
-
-# Specify GitHub Auth token (if needed), go to User->Settings->Developers options->create new.
-# Created token needs to be encrypted using org.apache.ignite.ci.tcbot.conf.PasswordEncoder
-github.auth_token=
-
-## Branch identification rules
-# PR-less contribution branch name mandatory prefix
-git.branch_prefix=ignite-
diff --git a/conf/branches.json b/conf/branches.json
index 11adf90..3623c32 100644
--- a/conf/branches.json
+++ b/conf/branches.json
@@ -1,14 +1,36 @@
{
// Default server (service) code, internal identification
"primaryServerCode": "apache",
- /**/
+ /* Teamcity Integration Parameters */
"tcServers": [
{
- //code of current server
+ /* Service Code for internal identification */
"code": "public",
// reference to another TC server service code to be used instead.
"reference": "apache"
+ },
+ {
+ /* Service Code for internal identification */
+ "code": "apache",
+ /** Teamcity Host, HTTPs is highly recommended because of Basic Auth used.*/
+ "host": "https://ci.ignite.apache.org/",
+ /** Downloaded build logs relative path. */
+ logsDir: "apache_logs",
+ /** Default tracked branch name in internal identification of TC bot. */
+ defaultTrackedBranch: "master",
+ /** Build parameters, which may be used for filtering Run history and tagging builds. */
+ "filteringParameters": [
+ {
+ "name": "env.JAVA_HOME",
+ "selection": [
+ {"value":"%env.JDK_ORA_18%", "label":"JDK8"},
+ {"value":"%env.JDK_ORA_9%", "label":"JDK9"},
+ {"value":"%env.JDK_ORA_10%", "label":"JDK10"},
+ {"value":"%env.JDK_OPEN_11%", "label":"JDK11"}
+ ]
+ }
+ ]
}
],
/* Set of JIRA servers/projects configured */
@@ -29,19 +51,26 @@
"authTok": "" //todo specify
}
],
- /* Set of GitHub services configured */
+ /* Set of GitHub services configured: GitHub integration parameters.*/
"gitHubConfigs": [
{
"code": "apache",
/* More for preffering branches gives branch for PR to be default branch for triggering builds on TC. */
"preferBranches": false,
+ /** Branch identification rules: PR-less contribution branch name mandatory prefix */
+ "branchPrefix": "ignite-",
+
/*
- Git Auth token encoded to access non-public GitHub repos, use {@link org.apache.ignite.ci.conf.PasswordEncoder#encodeJiraTok
- to set up value in a config. For public GitHub repos token gives more velocity
+ Specify GitHub Auth token (if needed), go to User->Settings->Developers options->create new.
+ Created token needs to be encrypted using org.apache.ignite.ci.tcbot.conf.PasswordEncoder,
+ use {@link org.apache.ignite.ci.conf.PasswordEncoder#encodeJiraTok} to set up value in a config.
+ Git Auth token encoded to access non-public GitHub repos. For public GitHub repos token gives more velocity.
*/
"authTok": "",
//todo specify token
+
+ /* REST API Url for GitHub. Includes owner (apache) and project (ignite). */
"apiUrl": "https://api.github.com/repos/apache/ignite/"
}
],
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
index 770e532..f83c455 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
@@ -36,6 +36,7 @@
import org.apache.ignite.ci.db.DbMigrations;
import org.apache.ignite.ci.db.TcHelperDb;
import org.apache.ignite.ci.di.AutoProfiling;
+import org.apache.ignite.ci.tcbot.conf.ITcServerConfig;
import org.apache.ignite.ci.tcmodel.agent.Agent;
import org.apache.ignite.ci.tcmodel.changes.Change;
import org.apache.ignite.ci.tcmodel.changes.ChangesList;
@@ -81,9 +82,9 @@
@Override public void init(ITeamcity conn) {
this.teamcity = conn;
- this.serverId = conn.serverId();
+ this.serverId = conn.serverCode();
- DbMigrations migrations = new DbMigrations(ignite, conn.serverId());
+ DbMigrations migrations = new DbMigrations(ignite, conn.serverCode());
migrations.dataMigration(visasHistStorage.visas());
}
@@ -112,10 +113,15 @@
}
/** {@inheritDoc} */
- @Override public String serverId() {
+ @Override public String serverCode() {
return serverId;
}
+ /** {@inheritDoc} */
+ @Override public ITcServerConfig config() {
+ return teamcity.config();
+ }
+
@NotNull private String ignCacheNme(String cache) {
return ignCacheNme(cache, serverId);
}
@@ -125,11 +131,6 @@
}
/** {@inheritDoc} */
- @Override public String host() {
- return teamcity.host();
- }
-
- /** {@inheritDoc} */
@Override public Build getBuild(int buildId) {
return teamcity.getBuild(buildId);
}
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 d42029d..6f5574f 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
@@ -123,7 +123,7 @@
this.executor = MoreExecutors.directExecutor();
}
- public ITcServerConfig config() {
+ @Override public ITcServerConfig config() {
return cfg.getTeamcityConfig(this.srvCode);
}
@@ -313,13 +313,6 @@
}, executor);
}
- /**
- * @return Normalized Host address, ends with '/'.
- */
- @Override public String host() {
- return config().host();
- }
-
/** {@inheritDoc} */
@Override public List<Project> getProjects() {
return sendGetXmlParseJaxb(host() + "app/rest/latest/projects", ProjectsList.class).projects();
@@ -375,7 +368,7 @@
}
/** {@inheritDoc} */
- @Override public String serverId() {
+ @Override public String serverCode() {
return srvCode;
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/MultBuildRunCtx.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/MultBuildRunCtx.java
index 96cfb85..cd56ec5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/MultBuildRunCtx.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/MultBuildRunCtx.java
@@ -457,4 +457,8 @@
public Stream<LogCheckResult> getLogChecksIfFinished() {
return buildsStream().map(SingleBuildRunCtx::getLogCheckIfFinished).filter(Objects::nonNull);
}
+
+ public Set<String> tags() {
+ return buildsStream().flatMap(b -> b.tags().stream()).collect(Collectors.toSet());
+ }
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java
index e49ca3d..d51bec5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/SingleBuildRunCtx.java
@@ -22,14 +22,21 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
+import org.apache.ignite.ci.tcbot.conf.BuildParameterSpec;
+import org.apache.ignite.ci.tcbot.conf.ITcServerConfig;
+import org.apache.ignite.ci.tcbot.conf.ParameterValueSpec;
import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrenceFull;
import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
+import org.apache.ignite.ci.teamcity.ignited.buildtype.ParametersCompacted;
import org.apache.ignite.ci.teamcity.ignited.change.ChangeCompacted;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.ProblemCompacted;
@@ -53,6 +60,9 @@
/** Logger check result future. */
private CompletableFuture<LogCheckResult> logCheckResFut;
+ /** Tags found from filtering-enabled parameters. */
+ private Set<String> tags = new HashSet<>();
+
/**
* @param buildCompacted Build compacted.
* @param compactor Compactor.
@@ -246,4 +256,33 @@
return duration;
}).sum();
}
+
+ public void addTag(String label) {
+ this.tags.add(label);
+ }
+
+ public Set<String> tags() {
+ return tags;
+ }
+
+ public void addTagsFromParameters(ParametersCompacted parameters, ITcServerConfig tcCfg,
+ IStringCompactor compactor) {
+ for (BuildParameterSpec parm : tcCfg.filteringParameters()) {
+ if (!parm.isFilled())
+ continue;
+
+ String propVal = parameters.getProperty(compactor, parm.name());
+
+ if (Strings.isNullOrEmpty(propVal))
+ continue;
+
+ List<ParameterValueSpec> selection = parm.selection();
+ Stream<ParameterValueSpec> stream = selection.stream();
+ stream
+ .filter(v -> Objects.equals(v.value(), propVal))
+ .findAny()
+ .ifPresent(v -> addTag(v.label()));
+
+ }
+ }
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java
index 9664a3a..c876da4 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/BuildChainProcessor.java
@@ -52,6 +52,7 @@
import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnited;
import org.apache.ignite.ci.teamcity.ignited.SyncMode;
+import org.apache.ignite.ci.teamcity.ignited.buildtype.ParametersCompacted;
import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
import org.apache.ignite.ci.teamcity.ignited.runhist.RunHistSync;
import org.apache.ignite.ci.util.FutureUtil;
@@ -274,7 +275,7 @@
* Runs deep collection of all related statistics for particular build.
*
* @param buildCompacted Build ref from history with references to tests.
- * @param tcIgnited
+ * @param tcIgnited TC connection.
* @return Full context.
*/
public SingleBuildRunCtx loadChanges(@Nonnull FatBuildCompacted buildCompacted,
@@ -283,6 +284,10 @@
ctx.setChanges(tcIgnited.getAllChanges(buildCompacted.changes()));
+ ParametersCompacted parameters = buildCompacted.parameters();
+ if (parameters != null)
+ ctx.addTagsFromParameters(parameters, tcIgnited.config(), this.compactor);
+
return ctx;
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessor.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessor.java
index bae99e1..1be01b3 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessor.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessor.java
@@ -32,7 +32,6 @@
import org.apache.ignite.ci.di.AutoProfiling;
import org.apache.ignite.ci.github.ignited.IGitHubConnIgnited;
import org.apache.ignite.ci.github.ignited.IGitHubConnIgnitedProvider;
-import org.apache.ignite.ci.github.pure.IGitHubConnection;
import org.apache.ignite.ci.github.pure.IGitHubConnectionProvider;
import org.apache.ignite.ci.jira.ignited.IJiraIgnited;
import org.apache.ignite.ci.jira.ignited.IJiraIgnitedProvider;
@@ -145,7 +144,7 @@
baseBranch,
mode);
- final ChainAtServerCurrentStatus chainStatus = new ChainAtServerCurrentStatus(teamcity.serverId(), branchForTc);
+ final ChainAtServerCurrentStatus chainStatus = new ChainAtServerCurrentStatus(teamcity.serverCode(), branchForTc);
chainStatus.baseBranchForTc = baseBranch;
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/BuildParameterSpec.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/BuildParameterSpec.java
index e886c11..c63ef81 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/BuildParameterSpec.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/BuildParameterSpec.java
@@ -17,18 +17,21 @@
package org.apache.ignite.ci.tcbot.conf;
+import com.google.common.base.Strings;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.jetbrains.annotations.Nullable;
public class BuildParameterSpec {
- /** Name. */
+ /** Parameter (property) Name. */
private String name;
- /** Value. */
+ /** Value to use for triggering build. */
private String value;
+ /** Use Random value, valid only for triggering parameters specifucation. */
@Nullable private Boolean randomValue;
/**
@@ -55,10 +58,16 @@
return Objects.hash(name, value, randomValue, selectionValues);
}
+ /**
+ * @return {@link #name}.
+ */
public String name() {
return name;
}
+ /**
+ * @return some valid value for property or null.
+ */
public Object generateValue() {
if (!randomValue)
return value;
@@ -72,4 +81,14 @@
return spec.value();
}
+
+ public boolean isFilled() {
+ return !Strings.isNullOrEmpty(name);
+ }
+
+ public List<ParameterValueSpec> selection() {
+ return (selectionValues == null || selectionValues.isEmpty())
+ ? Collections.emptyList()
+ : Collections.unmodifiableList(selectionValues);
+ }
}
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 dbc7641..a03b66e 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
@@ -44,5 +44,7 @@
*/
@NotNull public String defaultTrackedBranch();
- public Collection<String> filteringParametersKeys();
+ @NotNull public Collection<String> filteringParametersKeys();
+
+ @NotNull public Collection<BuildParameterSpec> filteringParameters();
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ParameterValueSpec.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ParameterValueSpec.java
index 03bf553..c63ac7e 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ParameterValueSpec.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/conf/ParameterValueSpec.java
@@ -18,7 +18,7 @@
package org.apache.ignite.ci.tcbot.conf;
/**
- *
+ * Some parameter value, which label may be used in UI.
*/
public class ParameterValueSpec {
private String value;
@@ -27,4 +27,8 @@
public String value() {
return value;
}
+
+ public String label() {
+ return label;
+ }
}
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 8479ccd..a6660ac 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
@@ -119,6 +119,14 @@
return filteringParameters.stream().map(BuildParameterSpec::name).collect(Collectors.toSet());
}
+ /** {@inheritDoc} */
+ @NotNull @Override public Collection<BuildParameterSpec> filteringParameters() {
+ if (filteringParameters == null || filteringParameters.isEmpty())
+ return Collections.emptySet();
+
+ return Collections.unmodifiableList(filteringParameters);
+ }
+
/**
* @param props Properties.
*/
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/ITeamcityIgnited.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/ITeamcityIgnited.java
index ea764bf..7520f48 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/ITeamcityIgnited.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/ITeamcityIgnited.java
@@ -26,6 +26,7 @@
import javax.annotation.Nullable;
import org.apache.ignite.ci.analysis.SuiteInBranch;
import org.apache.ignite.ci.analysis.TestInBranch;
+import org.apache.ignite.ci.tcbot.conf.ITcServerConfig;
import org.apache.ignite.ci.tcmodel.agent.Agent;
import org.apache.ignite.ci.tcmodel.mute.MuteInfo;
import org.apache.ignite.ci.tcmodel.result.Build;
@@ -45,12 +46,17 @@
/**
* @return Internal server ID as string
*/
- String serverId();
+ public String serverId();
+
+ /**
+ * @return TeamCity configuration.
+ */
+ public ITcServerConfig config();
/**
* @return Normalized Host address, ends with '/'.
*/
- public String host();
+ default public String host() {return config().host();}
/**
* Return all builds for branch and suite, without relation to its status.
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 3577d14..cabb443 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
@@ -41,6 +41,7 @@
import org.apache.ignite.ci.di.MonitoredTask;
import org.apache.ignite.ci.di.cache.GuavaCached;
import org.apache.ignite.ci.di.scheduler.IScheduler;
+import org.apache.ignite.ci.tcbot.conf.ITcServerConfig;
import org.apache.ignite.ci.tcbot.trends.MasterTrendsService;
import org.apache.ignite.ci.tcmodel.agent.Agent;
import org.apache.ignite.ci.tcmodel.conf.Project;
@@ -150,7 +151,7 @@
private int srvIdMaskHigh;
public void init(ITeamcityConn conn) {
- String srvCode = conn.serverId();
+ String srvCode = conn.serverCode();
this.srvCode = srvCode;
this.conn = conn;
@@ -179,8 +180,8 @@
}
/** {@inheritDoc} */
- @Override public String host() {
- return conn.host();
+ @Override public ITcServerConfig config() {
+ return conn.config();
}
/** {@inheritDoc} */
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeSync.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeSync.java
index 997429a..46ca440 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeSync.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeSync.java
@@ -107,7 +107,7 @@
* @param conn Pure HTTP Connection API.
*/
private void ensureActualizeBuildTypeRefsRequested(int srvIdMaskHigh, String projectId, ITeamcityConn conn) {
- scheduler.sheduleNamed(taskName("actualizeAllBuildTypeRefs", conn.serverId(), projectId),
+ scheduler.sheduleNamed(taskName("actualizeAllBuildTypeRefs", conn.serverCode(), projectId),
() -> reindexBuildTypeRefs(srvIdMaskHigh, projectId, conn), 4, TimeUnit.HOURS);
}
@@ -119,7 +119,7 @@
* @param conn Pure HTTP Connection API.
*/
private void ensureActualizeBuildTypesRequested(int srvIdMaskHigh, String projectId, ITeamcityConn conn) {
- scheduler.sheduleNamed(taskName("actualizeAllBuildTypeRefs", "actualizeAllBuildTypes", conn.serverId()),
+ scheduler.sheduleNamed(taskName("actualizeAllBuildTypeRefs", "actualizeAllBuildTypes", conn.serverCode()),
() -> reindexBuildTypes(srvIdMaskHigh, projectId, conn), 24, TimeUnit.HOURS);
}
@@ -169,7 +169,7 @@
updated += (buildTypeDao.saveBuildType(srvIdMaskHigh, buildType, exBuildType) != null) ? 1 : 0;
} catch (Exception e) {
if (Throwables.getRootCause(e) instanceof FileNotFoundException) {
- logger.info("Loading buildType [" + id + "] for server [" + conn.serverId() + "] failed:" +
+ logger.info("Loading buildType [" + id + "] for server [" + conn.serverCode() + "] failed:" +
e.getMessage(), e);
removed += markRemoved(srvIdMaskHigh, id) ? 1 : 0;
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/ParametersCompacted.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/ParametersCompacted.java
index 212bbb9..e969fd5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/ParametersCompacted.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/ParametersCompacted.java
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer;
+import javax.annotation.Nullable;
import org.apache.ignite.ci.db.Persisted;
import org.apache.ignite.ci.tcmodel.conf.bt.Parameters;
import org.apache.ignite.ci.tcmodel.conf.bt.Property;
@@ -154,4 +155,17 @@
consumer.accept(nameid, valId);
}
}
+
+ @Nullable
+ public String getProperty(IStringCompactor compactor, String parmKey) {
+ Integer present = compactor.getStringIdIfPresent(parmKey);
+ if (present == null)
+ return null;
+
+ int propStrId = findPropertyStringId(present);
+ if (propStrId < 0)
+ return null;
+
+ return compactor.getStringFromId(propStrId);
+ }
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeSync.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeSync.java
index 7e00f56..55f74a6 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeSync.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/change/ChangeSync.java
@@ -56,7 +56,7 @@
change = conn.getChange(changeId);
} catch (Exception e) {
if (Throwables.getRootCause(e) instanceof FileNotFoundException) {
- logger.info("Loading changeId [" + changeId + "] for server [" + conn.serverId() + "] failed:" + e.getMessage(), e);
+ logger.info("Loading changeId [" + changeId + "] for server [" + conn.serverCode() + "] failed:" + e.getMessage(), e);
change = new Change();
} else if (Throwables.getRootCause(e) instanceof SAXParseException) {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
index 073c9c3..826ee4a 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProactiveFatBuildSync.java
@@ -110,14 +110,14 @@
int ldrToActivate = ThreadLocalRandom.current().nextInt(FAT_BUILD_PROACTIVE_TASKS);
- scheduler.sheduleNamed(taskName("loadFatBuilds" + ldrToActivate, conn.serverId()),
- () -> loadFatBuilds(ldrToActivate, conn.serverId()), 2, TimeUnit.MINUTES);
+ scheduler.sheduleNamed(taskName("loadFatBuilds" + ldrToActivate, conn.serverCode()),
+ () -> loadFatBuilds(ldrToActivate, conn.serverCode()), 2, TimeUnit.MINUTES);
}
@NotNull
public synchronized SyncTask getSyncTask(ITeamcityConn conn) {
- final SyncTask syncTask = buildToLoad.computeIfAbsent(conn.serverId(), s -> new SyncTask());
+ final SyncTask syncTask = buildToLoad.computeIfAbsent(conn.serverCode(), s -> new SyncTask());
syncTask.conn = conn;
@@ -308,7 +308,7 @@
if (savedVer.isFakeStub())
refCompacted.setId(buildId); //to provide possiblity to save the build
- final String srvCode = conn.serverId();
+ final String srvCode = conn.serverCode();
final int srvIdMask = ITeamcityIgnited.serverIdToInt(srvCode);
buildRefDao.save(srvIdMask, refCompacted);
@@ -330,7 +330,7 @@
@Nullable public FatBuildCompacted reloadBuild(ITeamcityConn conn, int buildId, @Nullable FatBuildCompacted existingBuild) {
//todo some sort of locking to avoid double requests
- final String srvName = conn.serverId();
+ final String srvName = conn.serverCode();
final int srvIdMask = ITeamcityIgnited.serverIdToInt(srvName);
if (existingBuild != null && existingBuild.isOutdatedEntityVersion()) {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/ITeamcityConn.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/ITeamcityConn.java
index 1adfb07..bdf7885 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/ITeamcityConn.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/pure/ITeamcityConn.java
@@ -23,7 +23,7 @@
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-
+import org.apache.ignite.ci.tcbot.conf.ITcServerConfig;
import org.apache.ignite.ci.tcmodel.agent.Agent;
import org.apache.ignite.ci.tcmodel.changes.Change;
import org.apache.ignite.ci.tcmodel.changes.ChangesList;
@@ -46,12 +46,19 @@
* @return Internal server ID as string
*/
@Nullable
- public String serverId();
+ public String serverCode();
+
+ /**
+ * @return TeamCity configuration.
+ */
+ public ITcServerConfig config();
/**
* @return Normalized Host address, ends with '/'.
*/
- public String host();
+ default String host() {
+ return config().host();
+ }
/**
* @param buildId Build id.
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
index 5a13b8a..454f9dc 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/SuiteCurrentStatus.java
@@ -20,6 +20,7 @@
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -128,6 +129,8 @@
/** Possible blocker: filled for PR and builds checks, mean there was stable execution in master, but */
public Boolean possibleBlocker;
+ public Set<String> tags = new HashSet<>();
+
public void initFromContext(ITeamcityIgnited tcIgnited,
@Nonnull final MultBuildRunCtx suite,
@Nullable final String baseBranch) {
@@ -221,6 +224,8 @@
this.suiteId = suite.suiteId();
branchName = branchForLink(suite.branchName());
// todo implement this logic in suite possibleBlocker = suite.hasPossibleBlocker();
+
+ tags = suite.tags();
}
private void initSuiteStat(ITeamcityIgnited tcIgnited,
diff --git a/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css b/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
index 65c1b77..434175b 100644
--- a/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
+++ b/ignite-tc-helper-web/src/main/webapp/css/style-1.5.css
@@ -587,3 +587,9 @@
transition: transform .25s;
display: inline-block;
}
+
+.buildTag {
+ -webkit-box-shadow: 2px 4px 1px 0px rgba(224,224,224,1);
+ -moz-box-shadow: 2px 4px 1px 0px rgba(224,224,224,1);
+ box-shadow: 2px 4px 1px 0px rgba(224,224,224,1);
+}
\ No newline at end of file
diff --git a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
index c1117a0..ae80ec1 100644
--- a/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
+++ b/ignite-tc-helper-web/src/main/webapp/js/testfails-2.1.js
@@ -90,15 +90,15 @@
/**
- * @param server - see org.apache.ignite.ci.web.model.current.ChainAtServerCurrentStatus Java Class.
+ * @param chain - see org.apache.ignite.ci.web.model.current.ChainAtServerCurrentStatus Java Class.
* @param settings - see Settings JavaScript class.
*/
-function showChainCurrentStatusData(server, settings) {
- if(!isDefinedAndFilled(server))
+function showChainCurrentStatusData(chain, settings) {
+ if(!isDefinedAndFilled(chain))
return;
- if(isDefinedAndFilled(server.buildNotFound) && server.buildNotFound ) {
- return "<tr><td><b>Error: Build not found for branch [" + server.branchName + "]</b>" +
+ if(isDefinedAndFilled(chain.buildNotFound) && chain.buildNotFound ) {
+ return "<tr><td><b>Error: Build not found for branch [" + chain.branchName + "]</b>" +
"<br><br><span style='color:grey; font-size:12px;'>Perhaps, more than 2 weeks have passed since the last build " +
"run. <br>There is no data on the TC server</span></td></tr>";
}
@@ -108,22 +108,22 @@
res += "<table style='width: 100%;' border='0px'>";
res += "<tr bgcolor='#F5F5FF'><td colspan='3' width='75%'>";
res += "<table style='width: 40%'>";
- res += "<tr><td><b> Server: </b></td><td>[" + server.serverId + "]</td></tr>";
+ res += "<tr><td><b> Server: </b></td><td>[" + chain.serverId + "]</td></tr>";
- if (isDefinedAndFilled(server.prNum)) {
+ if (isDefinedAndFilled(chain.prNum)) {
res += "<tr><td><b> PR: </b></td><td>";
- if (isDefinedAndFilled(server.webToPr))
- res += "<a href='" + server.webToPr + "'>[#" + server.prNum + "]</a>";
+ if (isDefinedAndFilled(chain.webToPr))
+ res += "<a href='" + chain.webToPr + "'>[#" + chain.prNum + "]</a>";
else
- res += "[#" + server.prNum + "]";
+ res += "[#" + chain.prNum + "]";
res += "</td></tr>";
}
- if (isDefinedAndFilled(server.webToTicket) && isDefinedAndFilled(server.ticketFullName)) {
+ if (isDefinedAndFilled(chain.webToTicket) && isDefinedAndFilled(chain.ticketFullName)) {
res += "<tr><td><b> Ticket: </b></td><td>";
- res += "<a href='" + server.webToTicket + "'>[" + server.ticketFullName + "]</a>";
+ res += "<a href='" + chain.webToTicket + "'>[" + chain.ticketFullName + "]</a>";
res += "</td></tr>";
}
@@ -131,26 +131,26 @@
if (isDefinedAndFilled(findGetParameter("suiteId")))
parentSuitId = findGetParameter("suiteId");
- else if (isDefinedAndFilled(server))
- parentSuitId = findGetParameter("buildTypeId", server.webToHist);
+ else if (isDefinedAndFilled(chain))
+ parentSuitId = findGetParameter("buildTypeId", chain.webToHist);
if (isDefinedAndFilled(parentSuitId)) {
res += "<tr><td><b> Suite: </b></td><td>[" + parentSuitId + "] ";
- res += " <a href='" + server.webToHist + "'>[TC history]</a>";
+ res += " <a href='" + chain.webToHist + "'>[TC history]</a>";
res += "</td></tr>";
}
res += "</table>";
res += "</br>";
- if (isDefinedAndFilled(server.chainName)) {
- res += server.chainName + " ";
+ if (isDefinedAndFilled(chain.chainName)) {
+ res += chain.chainName + " ";
}
res += "<b>Chain result: </b>";
- if (isDefinedAndFilled(server.failedToFinish) && isDefinedAndFilled(server.failedTests))
- res += server.failedToFinish + " suites and " + server.failedTests + " tests failed";
+ if (isDefinedAndFilled(chain.failedToFinish) && isDefinedAndFilled(chain.failedTests))
+ res += chain.failedToFinish + " suites and " + chain.failedTests + " tests failed";
else
res += "empty";
@@ -163,8 +163,8 @@
var cntFailed = 0;
var suitesFailedList = "";
- for (var i = 0; i < server.suites.length; i++) {
- var suite = server.suites[i];
+ for (var i = 0; i < chain.suites.length; i++) {
+ var suite = chain.suites[i];
if (!isDefinedAndFilled(suite.suiteId))
continue;
@@ -178,44 +178,44 @@
cntFailed++;
}
- if (suitesFailedList.length !== 0 && isDefinedAndFilled(server.serverId) && isDefinedAndFilled(server.branchName)) {
+ if (suitesFailedList.length !== 0 && isDefinedAndFilled(chain.serverId) && isDefinedAndFilled(chain.branchName)) {
mInfo += "Trigger failed " + cntFailed + " builds";
mInfo += " <a href='javascript:void(0);' ";
- mInfo += " onClick='triggerBuilds(\"" + server.serverId + "\", \"" + parentSuitId + "\", " +
- "\"" + suitesFailedList + "\", \"" + server.branchName + "\", false, false, null, \"" + server.prNum + "\")' ";
+ mInfo += " onClick='triggerBuilds(\"" + chain.serverId + "\", \"" + parentSuitId + "\", " +
+ "\"" + suitesFailedList + "\", \"" + chain.branchName + "\", false, false, null, \"" + chain.prNum + "\")' ";
mInfo += " title='trigger builds'>in queue</a> ";
mInfo += " <a href='javascript:void(0);' ";
- mInfo += " onClick='triggerBuilds(\"" + server.serverId + "\", \"" + parentSuitId + "\", " +
- "\"" + suitesFailedList + "\", \"" + server.branchName + "\", true, false, null, \"" + server.prNum + "\")' ";
+ mInfo += " onClick='triggerBuilds(\"" + chain.serverId + "\", \"" + parentSuitId + "\", " +
+ "\"" + suitesFailedList + "\", \"" + chain.branchName + "\", true, false, null, \"" + chain.prNum + "\")' ";
mInfo += " title='trigger builds'>on top</a><br>";
}
- mInfo += "Duration: " + server.durationPrintable + " " +
- "(Net Time: " + server.durationNetTimePrintable + "," +
- " Tests: " + server.testsDurationPrintable + "," +
- " Src. Update: " + server.sourceUpdateDurationPrintable + "," +
- " Artifacts Publishing: " + server.artifcactPublishingDurationPrintable + "," +
- " Dependecies Resolving: " + server.dependeciesResolvingDurationPrintable + "," +
- " Timeouts: " + server.lostInTimeouts + ")<br>";
+ mInfo += "Duration: " + chain.durationPrintable + " " +
+ "(Net Time: " + chain.durationNetTimePrintable + "," +
+ " Tests: " + chain.testsDurationPrintable + "," +
+ " Src. Update: " + chain.sourceUpdateDurationPrintable + "," +
+ " Artifacts Publishing: " + chain.artifcactPublishingDurationPrintable + "," +
+ " Dependecies Resolving: " + chain.dependeciesResolvingDurationPrintable + "," +
+ " Timeouts: " + chain.lostInTimeouts + ")<br>";
- if (isDefinedAndFilled(server.topLongRunning) && server.topLongRunning.length > 0) {
+ if (isDefinedAndFilled(chain.topLongRunning) && chain.topLongRunning.length > 0) {
mInfo += "Top long running:<br>";
mInfo += "<table>";
- for (var j = 0; j < server.topLongRunning.length; j++) {
- mInfo += showTestFailData(server.topLongRunning[j], false, settings);
+ for (var j = 0; j < chain.topLongRunning.length; j++) {
+ mInfo += showTestFailData(chain.topLongRunning[j], false, settings);
}
mInfo += "</table>";
}
- if (isDefinedAndFilled(server.logConsumers) && server.logConsumers.length > 0) {
+ if (isDefinedAndFilled(chain.logConsumers) && chain.logConsumers.length > 0) {
mInfo += "Top Log Consumers:<br>";
mInfo += "<table>";
- for (var k = 0; k < server.logConsumers.length; k++) {
- mInfo += showTestFailData(server.logConsumers[k], false, settings);
+ for (var k = 0; k < chain.logConsumers.length; k++) {
+ mInfo += showTestFailData(chain.logConsumers[k], false, settings);
}
mInfo += "</table>";
}
@@ -234,13 +234,13 @@
// }
if (settings.isJiraAvailable()) {
- res += "<button onclick='commentJira(\"" + server.serverId + "\", \"" + server.branchName + "\", \""
+ res += "<button onclick='commentJira(\"" + chain.serverId + "\", \"" + chain.branchName + "\", \""
+ parentSuitId + "\")'>Comment JIRA</button> ";
var blockersList = "";
- for (var l = 0; l < server.suites.length; l++) {
- var suite0 = server.suites[l];
+ for (var l = 0; l < chain.suites.length; l++) {
+ var suite0 = chain.suites[l];
var suiteOrNull = suiteWithCriticalFailuresOnly(suite0);
@@ -252,16 +252,16 @@
}
}
- res += "<button onclick='triggerBuilds(\"" + server.serverId + "\", \"" + parentSuitId + "\", \"" +
- blockersList + "\", \"" + server.branchName + "\", false, false, null, \"" + + server.prNum + "\")'> " +
+ res += "<button onclick='triggerBuilds(\"" + chain.serverId + "\", \"" + parentSuitId + "\", \"" +
+ blockersList + "\", \"" + chain.branchName + "\", false, false, null, \"" + + chain.prNum + "\")'> " +
"Re-run possible blockers</button><br>";
- res += "<button onclick='triggerBuilds(\"" + server.serverId + "\", \"" + parentSuitId + "\", \"" +
- blockersList + "\", \"" + server.branchName + "\", false, true, null, \"" + + server.prNum +"\")'> " +
+ res += "<button onclick='triggerBuilds(\"" + chain.serverId + "\", \"" + parentSuitId + "\", \"" +
+ blockersList + "\", \"" + chain.branchName + "\", false, true, null, \"" + + chain.prNum +"\")'> " +
"Re-run possible blockers & Comment JIRA</button><br>";
}
- if (isDefinedAndFilled(server.baseBranchForTc)) {
+ if (isDefinedAndFilled(chain.baseBranchForTc)) {
// if (settings.isGithubAvailable())
// res+="<br>";
@@ -269,17 +269,17 @@
res+="<br>";
res += "Base branch";
- res += ": " + server.baseBranchForTc.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
+ res += ": " + chain.baseBranchForTc.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
}
res += " </td></tr>";
- res += addBlockersData(server, settings);
+ res += addBlockersData(chain, settings);
- for (var m = 0; m < server.suites.length; m++) {
- var subSuite = server.suites[m];
+ for (var m = 0; m < chain.suites.length; m++) {
+ var subSuite = chain.suites[m];
- res += showSuiteData(subSuite, settings, server.prNum);
+ res += showSuiteData(subSuite, settings, chain.prNum);
}
res += "<tr><td colspan='4'> </td></tr>";
@@ -649,6 +649,13 @@
"[ " + "<a href='" + suite.webToBuild + "' title=''> " +
"tests " + suite.failedTests + " " + suite.result;
+ if(isDefinedAndFilled(suite.tags)) {
+ for (let i = 0; i < suite.tags.length; i++) {
+ const tag = suite.tags[i];
+ res += " <div style='buildTag'>" + tag + "</div>" ;
+ }
+ }
+
if (isDefinedAndFilled(suite.warnOnly) && suite.warnOnly.length > 0) {
res += " warn " + suite.warnOnly.length;
}