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 2018/10/06 12:33:12 UTC
[ignite-teamcity-bot] branch ignite-9800 updated: IGNITE-9800: Show
avatar & save github branch
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch ignite-9800
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/ignite-9800 by this push:
new 69b4292 IGNITE-9800: Show avatar & save github branch
69b4292 is described below
commit 69b4292a85a4ff5d06b8c8a466035233ff5c09eb
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Sat Oct 6 15:33:09 2018 +0300
IGNITE-9800: Show avatar & save github branch
---
.../org/apache/ignite/ci/github/GitHubBranch.java | 7 +++
.../org/apache/ignite/ci/github/GitHubUser.java | 60 +++++++++++++---------
.../org/apache/ignite/ci/github/PullRequest.java | 23 +++++++--
.../ignite/ci/tcbot/visa/ContributionToCheck.java | 1 +
.../tcbot/visa/TcBotTriggerAndSignOffService.java | 6 ++-
ignite-tc-helper-web/src/main/webapp/prs.html | 14 +++--
6 files changed, 76 insertions(+), 35 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubBranch.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubBranch.java
new file mode 100644
index 0000000..e1ff4d6
--- /dev/null
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubBranch.java
@@ -0,0 +1,7 @@
+package org.apache.ignite.ci.github;
+
+public class GitHubBranch {
+ private String label;
+ private String ref;
+ private String sha;
+}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubUser.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubUser.java
index a7172c3..34d0dee 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubUser.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/GitHubUser.java
@@ -1,32 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.ignite.ci.github;
import com.google.common.base.Objects;
+import com.google.gson.annotations.SerializedName;
public class GitHubUser {
- public String login;
- public String avatar_url;
- /*
- * "user": {
- * "login": "glukos",
- * "id": 2736390,
- * "node_id": "MDQ6VXNlcjI3MzYzOTA=",
- * "avatar_url": "https://avatars0.githubusercontent.com/u/2736390?v=4",
- * "gravatar_id": "",
- * "url": "https://api.github.com/users/glukos",
- * "html_url": "https://github.com/glukos",
- * "followers_url": "https://api.github.com/users/glukos/followers",
- * "following_url": "https://api.github.com/users/glukos/following{/other_user}",
- * "gists_url": "https://api.github.com/users/glukos/gists{/gist_id}",
- * "starred_url": "https://api.github.com/users/glukos/starred{/owner}{/repo}",
- * "subscriptions_url": "https://api.github.com/users/glukos/subscriptions",
- * "organizations_url": "https://api.github.com/users/glukos/orgs",
- * "repos_url": "https://api.github.com/users/glukos/repos",
- * "events_url": "https://api.github.com/users/glukos/events{/privacy}",
- * "received_events_url": "https://api.github.com/users/glukos/received_events",
- * "type": "User",
- * "site_admin": false
- * },
+ private String login;
+ @SerializedName("avatar_url") private String avatarUrl;
+ /*See full example in prsList.json */
+
+ /**
+ * @return Login.
*/
+ public String login() {
+ return login;
+ }
+
+ /**
+ * @return Avatar url.
+ */
+ public String avatarUrl() {
+ return avatarUrl;
+ }
/** {@inheritDoc} */
@Override public boolean equals(Object o) {
@@ -36,11 +46,11 @@ public class GitHubUser {
return false;
GitHubUser user = (GitHubUser)o;
return Objects.equal(login, user.login) &&
- Objects.equal(avatar_url, user.avatar_url);
+ Objects.equal(avatarUrl, user.avatarUrl);
}
/** {@inheritDoc} */
@Override public int hashCode() {
- return Objects.hashCode(login, avatar_url);
+ return Objects.hashCode(login, avatarUrl);
}
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
index bcfca07..959e3a1 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/PullRequest.java
@@ -30,7 +30,7 @@ import org.apache.ignite.ci.db.Persisted;
public class PullRequest implements IVersionedEntity {
public static final String OPEN = "open";
/** Latest version. */
- private static final int LATEST_VERSION = 6;
+ private static final int LATEST_VERSION = 7;
/** Entity version. */
@SuppressWarnings("FieldCanBeLocal") private Integer _ver = LATEST_VERSION;
@@ -51,8 +51,12 @@ public class PullRequest implements IVersionedEntity {
/** Pull Request statuses URL. */
@SerializedName("statuses_url") private String statusesUrl;
- @SerializedName("user")
- private GitHubUser gitHubUser;
+ @SerializedName("user") private GitHubUser gitHubUser;
+
+ @SerializedName("head") private GitHubBranch head;
+
+ @SerializedName("base") private GitHubBranch base;
+
/**
* @return Pull Request number.
@@ -96,6 +100,13 @@ public class PullRequest implements IVersionedEntity {
return htmlUrl;
}
+ /**
+ * @return Head.
+ */
+ public GitHubBranch head() {
+ return head;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return MoreObjects.toStringHelper(this)
@@ -120,12 +131,14 @@ public class PullRequest implements IVersionedEntity {
Objects.equal(htmlUrl, req.htmlUrl) &&
Objects.equal(updatedAt, req.updatedAt) &&
Objects.equal(statusesUrl, req.statusesUrl) &&
- Objects.equal(gitHubUser, req.gitHubUser);
+ Objects.equal(gitHubUser, req.gitHubUser) &&
+ Objects.equal(base, req.base) &&
+ Objects.equal(head, req.head);
}
/** {@inheritDoc} */
@Override public int hashCode() {
- return Objects.hashCode(_ver, num, state, title, htmlUrl, updatedAt, statusesUrl, gitHubUser);
+ return Objects.hashCode(_ver, num, state, title, htmlUrl, updatedAt, statusesUrl, gitHubUser, base, head);
}
/** {@inheritDoc} */
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java
index 13ed63e..e627bcc 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcbot/visa/ContributionToCheck.java
@@ -23,5 +23,6 @@ public class ContributionToCheck {
public Integer prNumber;
public String prTitle;
public String prAuthor;
+ public String prAuthorAvatarUrl;
public String prHtmlUrl;
}
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 82d7995..34ccf6b 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
@@ -191,8 +191,10 @@ public class TcBotTriggerAndSignOffService {
check.prHtmlUrl = pr.htmlUrl();
GitHubUser user = pr.gitHubUser();
- if (user != null)
- check.prAuthor = user.login;
+ if (user != null) {
+ check.prAuthor = user.login();
+ check.prAuthorAvatarUrl = user.avatarUrl();
+ }
return check;
}).collect(Collectors.toList());
diff --git a/ignite-tc-helper-web/src/main/webapp/prs.html b/ignite-tc-helper-web/src/main/webapp/prs.html
index 904d6db..0bf9b07 100644
--- a/ignite-tc-helper-web/src/main/webapp/prs.html
+++ b/ignite-tc-helper-web/src/main/webapp/prs.html
@@ -111,7 +111,7 @@
title: "PR Number",
"render": function(data, type, row, meta){
if(type === 'display'){
- data = "<a href='"+data+"'>"+row.prNumber+"</a>";
+ data = "<a href='"+data+"'>#"+row.prNumber+"</a>";
}
return data;
@@ -123,7 +123,15 @@
},
{
"data": "prAuthor",
- title: "Author"
+ title: "Author",
+ "render": function(data, type, row, meta){
+ if(type === 'display'){
+ data = "<img src='"+row.prAuthorAvatarUrl+"' width='20px' height='20px'> "+data+"";
+ }
+
+ return data;
+ }
+
},
{
"data": "prNumber",
@@ -134,7 +142,7 @@
//todo customizable suite
'suiteId=IgniteTests24Java8_RunAll' +
//'&baseBranchForTc=' +
- '&branchForTc=pull%2F' +data+ '%2Fhead&action=Latest"><button>Check build for pull/' + data + '/head</button></a>';
+ '&branchForTc=pull%2F' +data+ '%2Fhead&action=Latest"><button>Open /' + data + '/head</button></a>';
}
return data;