Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70096

Ability to hide committed pre-commit reviews

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • 1.13.0

      Scenario:

      When using Swarm as a branch source you see a list of open reviews. It is possible for end users in Swarm to commit pre-commit reviews outside of swarm which leaves the review open. Over time these build up and no one tidies them up. 

      Request:

      It would be good if we could hide jobs for open pre-commit reviews in Swarm that have commits attached.

      Workaround:

      Project managers should review open requests in Swarm frequently and close open reviews that are no longer required.

      Implementation notes:

      An open pre-commit review can have a commit attached when the users submits the review outside Swarm. For example:

      http://SWARM/api/v9/reviews/2636?fields=projects%2Cchanges%2Ccommits%2Cauthor%2Cstate
      {
        "review": {
          "author": "super",
          "changes": [
            2635,
            2637,
            2641
          ],
          "commits": [
            2641
          ],
          "projects": {
            "project1": [
              "main"
            ]
          },
          "state": "needsReview"
        }
      }

      Note that the 'commits' are different to the 'changes'.

       

      An open  post-commit review will always have one or more commits attached. For example:

       

      http://SWARM/api/v9/reviews/2640?fields=projects%2Cchanges%2Ccommits%2Cauthor%2Cstate
      {
        "review": {
          "author": "super",
          "changes": [
            2639
          ],
          "commits": [
            2639
          ],
          "projects": {
            "project1": [
              "main"
            ]
          },
          "state": "needsReview"
        }
      }

      and:

       

       

      http://SWARM/api/v9/reviews/2640?fields=projects%2Cchanges%2Ccommits%2Cauthor%2Cstate
      {
        "review": {
          "author": "super",
          "changes": [
            2639,
            2642
          ],
          "commits": [
            2639,
            2642
          ],
          "projects": {
            "project1": [
              "main"
            ]
          },
          "state": "needsReview"
        }
      } 

      Note that these commits mirror the 'chenges' field.

       

      Suggest that an tick box is added per job that changes the behavior (we cant break existing behavior). Example:

       A tickbox on the job that is called 'Hide open committed pre-commit review' which hides jobs that have something in the 'commits' list where the 'commits' list is not equal to the 'changes' list seen via the SWARM 'reviews' REST endpoint. 

       

      Testing:

      (1) Create a Swarm project with one branch.

      (2) Submit a simple Jenkinsfile to the top of that branch. For example:

      pipeline {
          agent any
          stages {
              stage('Hello') {
                  steps {
                      echo 'Hello World'
                  }
              }
          }
      } 

      (3) Create a multibranch pipeline project with Swarm as the branch source and use the project from step 1.

      (4) Create a reviewing using the P4 command line:

      echo test > test1.txt
      p4 add test1.txt
      p4 shelve # Enter the changelist description "Creating a review #review" 

      (5) Click on scan multibranch pipeline in the Jenkins job. The Swarm job should appear.

      (6) Submit the shelve from step (4).

      p4 shelve -d SHELVE_NUMBER
      p4 submit -c SHELVE_NUMBER 

      (7) Click on scan multibranch pipeline in the Jenkins job. The Swarm job should now disappear. Current behavior is that the review remains until a user manually approves the review.

       

       

       

            Unassigned Unassigned
            p4karl Karl Wirth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: