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

No obvious way to launch editor against repo with no preexisting Jenkinsfile

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • Blue Ocean 1.3

      Summary:
      When moving through the Create Pipeline flow, it's possible for a user to specify a repo with no Jenkinsfile present. If the user happens to click out of this flow, or otherwise exit the editor before creating and committing a new Jenkinsfile, no branches will be shown, and there is thus no obvious way to get back to the editor.

      Prerequisites

      • A repository which does not already have a Jenkinsfile. In this case I was testing with a Bitbucket Server, but my guess is this problem is the same regardless of SCM

      Steps to recreate:
      1. Click "New Pipeline" to begin the process:

      2. Pick where you store your code, the location of the server (if applicable), and in this example, the Project it belongs to, since we're using a Bitbucket repo:

      3. Click "Create Pipeline." Usually, you'll very quickly see a message stating that there were no Jenkinsfiles found. I have occasionally seen the UI appear to hang at this step, but couldn't recreate that part while writing this up:

      4. Click the second "Create Pipeline" button which has now appeared at the bottom of the workflow:

      5. You'll be taken to the editor, as expected:

      6. Take any action that leaves the editor. In this case, I clicked on "Jenkins" up at the top left, to go to the top level BO page:

      7. Click on the project you just created, which in this case is the one called `wacky-branchnames-no-jenkinsfile`.

      8. Now you'll be taken into the project, and there's a pop up message stating "You don't have any branches that contain a Jenkinsfile." Which is true. But there's no obvious way to re-invoke the editor so that you can create one.

      9. As a workaround, it's possible to puzzle together a URL that lets you invoke the editor. The URL shown in my address bar at this point is:

      http://my-jenkins:8080/blue/organizations/jenkins/wacky-branchnames-no-jenkinsfile/activity
      

      You can edit that URL, to look like this:

      http://my-jenkins:8080/blue/organizations/jenkins/pipeline-editor/wacky-branchnames-no-jenkinsfile/master
      

      And get to the editor. This is problematic though, for a few reasons:

      • Users have to know that this is a thing they can do, and how to do it. It's mistake prone.
      • Since there aren't any branches on the screen, the user has to guess at the last element of that URL. If there's no master branch in my example above, the user gets an error message. Granted, master is a pretty safe guess, but isn't guaranteed.

      Entering it incorrectly results in the following:

      There was an error loading the pipeline from the Jenkinsfile in this repository. Correct the error by editing the Jenkinsfile using the declarative syntax then commit it back to the repository.

      branch: new-branch-nam not found

      This message is also misleading, because its first half implies that there's something wrong with "the Jenkinsfile." But there's no Jenkinsfile at all.

          [JENKINS-46434] No obvious way to launch editor against repo with no preexisting Jenkinsfile

          Karl Shultz added a comment -

          I just noticed a further symptom. After (successfully) committing a Jenkinsfile, to a branch other than the default for this repo, when I'm returned to the project's page, Blue Ocean still behaves as though there aren't any Jenkinsfiles:

          Even though there is one on master:

          This is a pretty esoteric corner case. On Bitbucket, I've got "new-branch-name" set to be the default branch for the project, as opposed to "master." But out of habit, when I hand-edited the URL in my browser to invoke the editor, I put "master" on the end of it as a branch name. When Blue Ocean loads the Activity page for this project, I guess it's basing the error about not having a Jenkinsfile on the default branch, and not bothering to look in the others? I'll do some more digging to see if that's actually the case.

          Karl Shultz added a comment - I just noticed a further symptom. After (successfully) committing a Jenkinsfile, to a branch other than the default for this repo, when I'm returned to the project's page, Blue Ocean still behaves as though there aren't any Jenkinsfiles: Even though there is one on master: This is a pretty esoteric corner case. On Bitbucket, I've got "new-branch-name" set to be the default branch for the project, as opposed to "master." But out of habit, when I hand-edited the URL in my browser to invoke the editor, I put "master" on the end of it as a branch name. When Blue Ocean loads the Activity page for this project, I guess it's basing the error about not having a Jenkinsfile on the default branch, and not bothering to look in the others? I'll do some more digging to see if that's actually the case.

          Cliff Meyers added a comment -

          I'm guessing that a full-page refresh might result in the correct data showing up? If so, there's likely a problem with the UI not receiving the right kind of event to do a real time update. I'd say either way it might be worth cutting a new bug for that problem as long as it's reproducible.

          Cliff Meyers added a comment - I'm guessing that a full-page refresh might result in the correct data showing up? If so, there's likely a problem with the UI not receiving the right kind of event to do a real time update. I'd say either way it might be worth cutting a new bug for that problem as long as it's reproducible.

          Karl Shultz added a comment -

          It's reproducible, and I've opened JENKINS-46435 for it. It seems like a fairly esoteric corner case, but not impossible to imagine.

          Karl Shultz added a comment - It's reproducible, and I've opened JENKINS-46435 for it. It seems like a fairly esoteric corner case, but not impossible to imagine.

          Cliff Meyers added a comment -

          Per kzantow this will be addressed as part of JENKINS-43148

          Cliff Meyers added a comment - Per kzantow this will be addressed as part of JENKINS-43148

          James Dumay added a comment -

          kzantow I assume your work in JENKINS-43148 will cover this?

          James Dumay added a comment - kzantow I assume your work in JENKINS-43148 will cover this?

          Michael Neale added a comment -

          kshultz if you are daring and have time - https://github.com/jenkinsci/blueocean-plugin/pull/1299 is ready to test, if it covers this nicely, can we close this as a duplicate? 

          Michael Neale added a comment - kshultz if you are daring and have time - https://github.com/jenkinsci/blueocean-plugin/pull/1299  is ready to test, if it covers this nicely, can we close this as a duplicate? 

          Karl Shultz added a comment -

          michaelneale, as far as I can tell, my abiility to verify this is blocked by JENKINS-46723.

          Karl Shultz added a comment - michaelneale , as far as I can tell, my abiility to verify this is blocked by JENKINS-46723 .

          Michael Neale added a comment -

          kshultz right - Cliff has a fix in progress for that (in review): https://github.com/jenkinsci/blueocean-plugin/pull/1386 which may help shed light if it is covered or not. That only isn't merged as I am wondering if those changes can't go upstream to JIRA plugin itself (would be super cool if they could!)

           

          Michael Neale added a comment - kshultz right - Cliff has a fix in progress for that (in review): https://github.com/jenkinsci/blueocean-plugin/pull/1386  which may help shed light if it is covered or not. That only isn't merged as I am wondering if those changes can't go upstream to JIRA plugin itself (would be super cool if they could!)  

            kzantow Keith Zantow
            kshultz Karl Shultz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: