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

Developer should see a helpful message on the Branch or Pipeline tabs if job isn't supported

    • 1.0-m7

      In Scope

      • Empty states should provide a helpful message on the tabs if the branch or pull request builds are unsupported by the underlying job type

      Branch tab

      • Title: "Branches are unsupported for this job type"
      • Description: "Branch builds only work with the <i>Multi-Branch Pipeline</i> job type. This is just one of the many reasons to switch to Jenkins Pipeline."
      • Button

      Pull Requests tab

      • Title: "Pull Requests are unsupported for this job type"
      • Description: "Validated pull request builds only work with the <i>Multi-Branch Pipeline</i> job type. This is just one of the many reasons to switch to Jenkins Pipeline."
      • Button

          [JENKINS-35823] Developer should see a helpful message on the Branch or Pipeline tabs if job isn't supported

          James Dumay added a comment -

          vpandey imeredith WDYT about having some way of checking what features are available when requesting a pipeline

          curl -v -X GET "http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/test1"

          {
            "organization" : "jenkins",
            "name" : "test1",
            "branches" : [ ],
            "capabilities": {
              "pullRequests": false,
              "branches": false
            }
          }
          

          James Dumay added a comment - vpandey imeredith WDYT about having some way of checking what features are available when requesting a pipeline curl -v -X GET "http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/test1" { "organization" : "jenkins" , "name" : "test1" , "branches" : [ ], "capabilities" : { "pullRequests" : false , "branches" : false } }

          Vivek Pandey added a comment - - edited

          jdumay This is already possible. A pipeline response has optional branchNames element that is array of branch names. If this is empty or null, pipeline tab should not be seen and so the pull request should be hidden as well - that is no branches no pull request.

          Below shows a pipeline with branches:

          curl -v http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/p/
              
              {
                  "displayName": "p",
                  "name": "p",
                  "organization": "jenkins",
                  "weatherScore": 100,
                  "branchNames": [
                      "feature1",
                      "master",
                      "feature2"
                  ],
                  "numberOfFailingBranches": 0,
                  "numberOfFailingPullRequests": 0,
                  "numberOfSuccessfulBranches": 0,
                  "numberOfSuccessfulPullRequests": 0,
                  "totalNumberOfBranches": 3,
                  "totalNumberOfPullRequests": 0
              }
          

          Here is a pipeline without branches:

          curl -v -X GET  "http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/test1"
          
              {
                "organization" : "jenkins",
                "name" : "test1",
                "displayName": "test1",
                "weatherScore": 100
              }
          

          Vivek Pandey added a comment - - edited jdumay This is already possible. A pipeline response has optional branchNames element that is array of branch names. If this is empty or null, pipeline tab should not be seen and so the pull request should be hidden as well - that is no branches no pull request. Below shows a pipeline with branches: curl -v http: //localhost:8080/jenkins/blue/ rest /organizations/jenkins/pipelines/p/ { "displayName" : "p" , "name" : "p" , "organization" : "jenkins" , "weatherScore" : 100, "branchNames" : [ "feature1" , "master" , "feature2" ], "numberOfFailingBranches" : 0, "numberOfFailingPullRequests" : 0, "numberOfSuccessfulBranches" : 0, "numberOfSuccessfulPullRequests" : 0, "totalNumberOfBranches" : 3, "totalNumberOfPullRequests" : 0 } Here is a pipeline without branches: curl -v -X GET "http: //localhost:8080/jenkins/blue/ rest /organizations/jenkins/pipelines/test1" { "organization" : "jenkins" , "name" : "test1" , "displayName" : "test1" , "weatherScore" : 100 }

          James Dumay added a comment -

          Thanks Vivek!

          James Dumay added a comment - Thanks Vivek!

            cliffmeyers Cliff Meyers
            jamesdumay James Dumay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: