Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Collection<InvalidProperty> process(Map<String, String> params) {
};
}

@Override
//@Override
public boolean isRequiresAgent() {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Constants {
public static final String GERRIT_PUBLISHER_ID = "gerritStatusPublisher";
public static final String GERRIT_SERVER = "gerritServer";
public static final String GERRIT_PROJECT = "gerritProject";
public static final String GERRIT_SCORE_FIELD = "gerritScoreField";
public static final String GERRIT_USERNAME = "gerritUsername";
public static final String GERRIT_SUCCESS_VOTE = "successVote";
public static final String GERRIT_FAILURE_VOTE = "failureVote";
Expand Down Expand Up @@ -120,6 +121,11 @@ public String getGerritUsername() {
return GERRIT_USERNAME;
}

@NotNull
public String getGerritScoreField() {
return GERRIT_SCORE_FIELD;
}

@NotNull
public String getGerritSuccessVote() {
return GERRIT_SUCCESS_VOTE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ abstract class GerritClientBase implements GerritClient {
public void review(@NotNull final GerritConnectionDetails connectionDetails, @NotNull final String vote, @NotNull final String message, @NotNull final String revision)
throws JSchException, IOException {
StringBuilder command = new StringBuilder();

/**
* Added gerScoreField
* */
command.append("gerrit review --project ").append(connectionDetails.getGerritProject())
.append(" --verified ").append(vote)
.append(" --")
.append(connectionDetails.gerScoreField()).append(" ")
//.append(" --verified ")
.append(vote)
.append(" -m \"").append(escape(message)).append("\" ")
.append(revision);
runCommand(connectionDetails, command.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ class GerritConnectionDetails {
private final String myServer;
private final String myUserName;
private final String myKeyId;
private final String myGerritScoreField;

GerritConnectionDetails(@NotNull SProject project, @NotNull String gerritProject,
@NotNull String server, @NotNull String username, @Nullable String keyId) {
@NotNull String server, @NotNull String username, @Nullable String keyId, @NotNull String gerritScoreFiled) {
myProject = project;
myGerritProject = gerritProject;
myServer = server;
myUserName = username;
myKeyId = keyId;
myGerritScoreField = gerritScoreFiled;
}

@NotNull
Expand Down Expand Up @@ -48,4 +50,7 @@ String getKeyId() {
return myKeyId;
}

@NotNull
String gerScoreField() {return myGerritScoreField; }

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public boolean buildFinished(@NotNull SFinishedBuild build, @NotNull BuildRevisi

myGerritClient.review(
new GerritConnectionDetails(bt.getProject(), getGerritProject(), getGerritServer(), getUsername(),
myParams.get(ServerSshKeyManager.TEAMCITY_SSH_KEY_PROP)),
myParams.get(ServerSshKeyManager.TEAMCITY_SSH_KEY_PROP), getGerritScoreField()),
vote, msg, revision.getRevision()
);
return true;
Expand All @@ -70,6 +70,8 @@ private String getGerritProject() {
return myParams.get(Constants.GERRIT_PROJECT);
}

private String getGerritScoreField() {return myParams.get(Constants.GERRIT_SCORE_FIELD); }

private String getUsername() {
return myParams.get(Constants.GERRIT_USERNAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public Map<String, String> getDefaultParameters() {
Map<String, String> params = new HashMap<String, String>();
params.put(Constants.GERRIT_SUCCESS_VOTE, "+1");
params.put(Constants.GERRIT_FAILURE_VOTE, "-1");
params.put(Constants.GERRIT_SCORE_FIELD, "build-result");
return params;
}

Expand Down Expand Up @@ -108,7 +109,7 @@ public void testConnection(@NotNull BuildTypeIdentity buildTypeOrTemplate, @NotN
myGerritClient.testConnection(
new GerritConnectionDetails(buildTypeOrTemplate.getProject(), params.get(Constants.GERRIT_PROJECT),
params.get(Constants.GERRIT_SERVER), params.get(Constants.GERRIT_USERNAME),
params.get(ServerSshKeyManager.TEAMCITY_SSH_KEY_PROP))
params.get(ServerSshKeyManager.TEAMCITY_SSH_KEY_PROP), params.get(Constants.GERRIT_SCORE_FIELD))
);
} catch (Exception e) {
throw new PublisherException("Gerrit publisher connection test has failed", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
</td>
</tr>

<tr>
<th><label for="${keys.gerritScoreField}">Score field: <l:star/></label></th>
<td>
<props:textProperty name="${keys.gerritScoreField}" className="mediumField"/>
<span class="smallNote">Like: <strong>reviewed | build-result | code-review | extension-check</strong></span>
<span class="error" id="error_${keys.gerritScoreField}"></span>
</td>
</tr>

<tr>
<th><label for="${keys.gerritSuccessVote}">Successful Build Vote: <l:star/></label></th>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ public ValueResolver getValueResolver() {
return null;
}

@Override
//@Override
public boolean isBranchesConfigured() {
return false;
}

@Override
//@Override
public boolean isCompositeBuild() {
return false;
}
Expand All @@ -161,7 +161,7 @@ public Browser getVcsBrowser(boolean b, @Nullable String s) {
return null;
}

@Override
//@Override
public boolean isDefaultExcluded() { return false; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ protected Map<String, String> getPublisherParams(final String gerritProjectName)
put(Constants.GERRIT_USERNAME, "gerrit_user");
put(Constants.GERRIT_SUCCESS_VOTE, "+1");
put(Constants.GERRIT_FAILURE_VOTE, "-1");
put(Constants.GERRIT_SCORE_FIELD, "verified");
}};
}

Expand Down