Skip to content

Commit

Permalink
IGNITE-10095: Support Build Parameters specifying in triggering and t…
Browse files Browse the repository at this point in the history
…agging builds (#122)
  • Loading branch information
dspavlov committed May 8, 2019
1 parent fdf1e5b commit b02303f
Show file tree
Hide file tree
Showing 41 changed files with 783 additions and 259 deletions.
32 changes: 0 additions & 32 deletions conf/apache.auth.properties

This file was deleted.

67 changes: 56 additions & 11 deletions 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 */
Expand All @@ -22,23 +44,33 @@
// "branchNumPrefix": "IGNITE-",
/* JIRA Url, HTTPs is highly recommended because of Basic Auth used. */
"url": "https://issues.apache.org/jira/",
/** JIRA Auth token to access, use PasswordEncoder#encodeJiraTok to get from clear username/password */
/** JIRA Auth token to access,
Base-64 pre-encoded username and password, which will be included into Basic Auth requests.
Encoded token needs to be encrypted using org.apache.ignite.ci.tcbot.conf.PasswordEncoder,
use PasswordEncoder#encodeJiraTok to get from clear username/password */
"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/"
}
],
Expand Down Expand Up @@ -79,28 +111,41 @@
"suiteId": "IgniteTests24Java8_RunAllNightly",
"branchForRest": "\u003cdefault\u003e",
"triggerBuild": true,
"triggerBuildQuietPeriod": 30 //triggering quiet period in minutes
/* Triggering quiet period in minutes. Protects from too-often triggering in case build is too fast, e.g. compilation failure. */
"triggerBuildQuietPeriod": 30,
"triggerParameters": [
{
name: "reverse.dep.*.env.JAVA_HOME",
randomValue: true,
"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"}
]
}
]
}
]
},
{
"id": "ignite-2.7",
"id": "ignite-2.7.5",
"chains": [
{
"serverId": "apache",
"suiteId": "IgniteTests24Java8_RunAll",
"branchForRest": "ignite-2.7",
"branchForRest": "ignite-2.7.5",
"baseBranchForTc": "\u003cdefault\u003e"
}
]
},
{
"id": "ignite-2.7-nightly",
"id": "ignite-2.7.5-nightly",
"chains": [
{
"serverId": "apache",
"suiteId": "IgniteTests24Java8_RunAllNightly",
"branchForRest": "ignite-2.7",
"branchForRest": "ignite-2.7.5",
"baseBranchForTc": "\u003cdefault\u003e",
"triggerBuild": true,
"triggerBuildQuietPeriod": 30 //triggering quiet period in minutes
Expand Down
Expand Up @@ -17,34 +17,38 @@

package org.apache.ignite.ci;

import com.google.common.collect.Sets;
import java.io.File;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import org.apache.ignite.ci.analysis.LogCheckResult;
import org.apache.ignite.ci.analysis.SingleBuildRunCtx;
import org.apache.ignite.ci.tcmodel.agent.Agent;
import org.apache.ignite.ci.tcmodel.conf.BuildType;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
import org.apache.ignite.ci.tcmodel.result.Build;
import org.apache.ignite.ci.tcmodel.user.User;
import org.apache.ignite.ci.teamcity.pure.ITeamcityConn;
import org.apache.ignite.ci.util.Base64Util;
import org.apache.ignite.ci.util.FutureUtil;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;

/**
* API for calling methods from REST service:
* https://confluence.jetbrains.com/display/TCD10/REST+API
*/
public interface ITeamcity extends ITeamcityConn {
/** Default. */
public String DEFAULT = "<default>";

/** Branch synonym: Refs heads master. */
public String REFS_HEADS_MASTER = "refs/heads/master";

/** Branch synonym: Master. */
public String MASTER = "master";

/** Some fake property to avoid merging build in queue: Tcbot trigger time. */
public String TCBOT_TRIGGER_TIME = "tcbot.triggerTime";

/** Default list of properties to be skipped in saving in FAT builds. */
public Set<String> AVOID_SAVE_PROPERTIES = Sets.newHashSet(TCBOT_TRIGGER_TIME, "build.query.loginTs");

CompletableFuture<File> unzipFirstFile(CompletableFuture<File> fut);

CompletableFuture<File> downloadBuildLogZip(int id);
Expand Down
Expand Up @@ -19,11 +19,11 @@

import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import javax.annotation.Nullable;
Expand All @@ -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;
Expand Down Expand Up @@ -81,9 +82,9 @@ public class IgnitePersistentTeamcity implements IAnalyticsEnabledTeamcity, ITea

@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());
}
Expand Down Expand Up @@ -112,10 +113,15 @@ private <K, V> IgniteCache<K, V> getOrCreateCacheV2(String name) {
}

/** {@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);
}
Expand All @@ -124,11 +130,6 @@ private <K, V> IgniteCache<K, V> getOrCreateCacheV2(String name) {
return srvId + "." + cache;
}

/** {@inheritDoc} */
@Override public String host() {
return teamcity.host();
}

/** {@inheritDoc} */
@Override public Build getBuild(int buildId) {
return teamcity.getBuild(buildId);
Expand Down Expand Up @@ -210,8 +211,9 @@ public Executor getExecutor() {

/** {@inheritDoc} */
@AutoProfiling
@Override public Build triggerBuild(String buildTypeId, @NotNull String branchName, boolean cleanRebuild, boolean queueAtTop) {
return teamcity.triggerBuild(buildTypeId, branchName, cleanRebuild, queueAtTop);
@Override public Build triggerBuild(String buildTypeId, @NotNull String branchName, boolean cleanRebuild,
boolean queueAtTop, Map<String, Object> buildParms) {
return teamcity.triggerBuild(buildTypeId, branchName, cleanRebuild, queueAtTop, buildParms);
}

/** {@inheritDoc} */
Expand Down

0 comments on commit b02303f

Please sign in to comment.