Exemplo n.º 1
0
 private boolean isRunning(VerificationStatus status) { // checks if an item is running or not
   if (status.equals(VerificationStatus.RUNNING)) {
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 2
0
  public void notifyCommiter(
      String commitId,
      VerificationStatus result,
      URI jobUrl,
      String subject,
      String signature,
      String committerEmail,
      String protectedBranch,
      String parentCommitId,
      String tempBranch) {

    StringBuilder status = new StringBuilder();
    if (subject.equals("Verigreen Status - Failure")) {
      status.append(
          String.format(
              "<table><tr><td width=\"160\">Verification status:</td><td><font color=\"red\">%s</font></td></tr>",
              result));

    } else if (subject.equals("Verigreen Status - Success")) {
      status.append(
          String.format(
              "<table><tr><td width=\"160\">Verification status:</td><td><font color=\"green\">%s</font></td></tr>",
              result));
    } else {
      status.append(
          String.format(
              "<table><tr><td width=\"160\">Verification status:</td><td><font color=\"FF6600\">%s</font></td></tr>",
              result));
    }
    if (jobUrl != null && subject.equals("Verigreen Status - Failure")) {
      status.append(
          String.format(
              "<tr><td><b>Job URL</b></td><td><a href=\"%s\">%s</a></td></tr>", jobUrl, jobUrl));
    }
    status.append(
        String.format("<tr><td>Repository name:</td><td>%s</td></tr>", CollectorName._collector));
    status.append(
        String.format(
            "<tr><td>Protected branch:</td><td>%s</td></tr>", protectedBranch.substring(11)));
    if (result.equals(VerificationStatus.MERGE_FAILED)) {
      status.append(
          String.format(
              "<tr><td>Merge failed between commits:<td> <b>%s</b> and <b>%s</b></td></td></tr>",
              parentCommitId.substring(0, 7), commitId.substring(0, 7)));
    } else {
      status.append(
          String.format("<tr><td>Commit Id:</td><td>%s</td></tr>", commitId.substring(0, 7)));
    }
    if (getCommitMessage(commitId.substring(0, 7)) != null) {
      status.append(
          String.format(
              "<tr><td>Commit message:</td><td>%s</td></tr>",
              getCommitMessage(commitId.substring(0, 7))));
    }
    if (jobUrl != null && subject.equals("Verigreen Status - Failure") == false) {
      status.append(
          String.format("<tr><td>Job URL</td><td><a href=\"%s\">%s</a></td></tr>", jobUrl, jobUrl));
    }
    if (subject.equals("Verigreen Status - Failure")) {
      status.append(
          String.format("<tr><td>Temporary branch:</td><td>%s</td></tr></table>", tempBranch));
    } else {
      status.append(String.format("</table>"));
    }

    send(subject, status.toString(), new String[] {committerEmail}, signature);
  }