Uploaded image for project: 'Skara'
  1. Skara
  2. SKARA-1912

Show priority for bugs in pull request body

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.0
    • None
    • bots
    • None

      Show the priority for bugs (P1, P2, P3, P4 or P5) in the issue list in the pull request body. A first (incorrect) patch for this would look like:

      diff --git a/bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java b/bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java
      index d088112f..b2de4971 100644
      --- a/bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java
      +++ b/bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java
      @@ -672,15 +672,27 @@ class CheckRun {
                                   progressBody.append("): ");
                                   progressBody.append(BotUtils.escape(iss.get().title()));
                                   var issueType = iss.get().properties().get("issuetype");
      - if (issueType != null && "CSR".equals(issueType.asString())) {
      - progressBody.append(" (**CSR**)");
      - if (isWithdrawnCSR(iss.get())) {
      - progressBody.append(" (Withdrawn)");
      + if (issueType != null) {
      + if ("CSR".equals(issueType.asString())) {
      + progressBody.append(" (**CSR**)");
      + if (isWithdrawnCSR(iss.get())) {
      + progressBody.append(" (Withdrawn)");
      + }
      + } else if ("JEP".equals(issueType.asString())) {
      + progressBody.append(" (**JEP**)");
      + } else if ("Bug".equals(issueType.asString())) {
      + progressBody.append(" (**" + issueType.asString() + "**");
      + var issuePriority = iss.get().properties().get("priority");
      + if (issuePriority == null) {
      + progressBody.append(")");
      + } else {
      + progressBody.append(" - `" + issuePriority + "`)");
      + }
      + } else if ("Enhancement".equals(issueType.asString())) {
      + progressBody.append(" (**Enhancement**)");
      + } else {
      + progressBody.append(" (⚠️ Uncommon issue type: " + issueType.asString() + ")");
                                       }
      - }
      - if (issueType != null && "JEP".equals(issueType.asString())) {
      - progressBody.append(" (**JEP**)");
      - }
                                   if (!relaxedEquals(iss.get().title(), currentIssue.description())) {
                                       progressBody.append(" ⚠️ Title mismatch between PR and JBS.");
                                       setExpiration(Duration.ofMinutes(10));


      The problem with the above approach is that if a user changes the type of the issue and/or the priority of the issue in JBS then the changes will not get reflected in the issue list in the PR body. A trivial but way too slow way to solve that would be to go through all open PRs for for a repository and query JBS for every issue in every PR to get its state. This would take too long time and put too much load on JBS.

      A proper solution would be for the PR bot to have an instance of an IssuePoller, then use the poller to poll for recently updated issues, and pass a list of the recently updated issue to each org.openjdk.skara.bots.pr.CheckWorkitem.The CheckWorkItem would need store the issues associated with the pull request in the metadata. Then CheckWorkItem.currentCheckValid can be changed to load the issues from the stored metadata and compare them to the list of recently changed issues passed to the CheckWorkItem (from the IssuePoller). If any of the ids of the recently changed issues matches the issues referred to by this PR, then currentCheckValid should return false (since CheckWorkItem might have to update the type or prio of one or more issues in the "### Issues" list).

            zsong Zhao Song
            ehelin Erik Helin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: