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

Support native Git for pipeline creation and editing

    Details

    • Sprint:
      Blue Ocean 1.0-rc4, Blue Ocean 1.2-beta2, Blue Ocean 1.2-beta3, Blue Ocean 1.2-beta4, Blue Ocean 1.2, Blue Ocean 1.3
    • Similar Issues:

      Description

      Improvement on roadmap

      This improvement is on the Blue Ocean project roadmap. Check the roadmap page for updates.

      Scope

      • User can click New Pipeline then pick Git and author a new Jenkinsfile using the Editor and save it back to the repository.
      • User can click Edit Pipeline then author the existing Jenkinsfile using the Editor and save their changes back to the repository
        • In a new branch
        • On the current branch

      Notes

      There are a number of security and user experience concerns that the team have to solve to get this working. 

       

      Design brief

      The user experience should match the equivalent Github feature as much as possible.
      The largest notable difference is that creating and editing with plain Git has noticeably more network traffic than Github. This means the user may have to wait for Blue Ocean to retrieve the content of the repository before showing them the Editor or before their save action is completed.

      Loading the editor

      • Developer clicks the edit action
      • Developer sees a progress dialog with a message "Loading your Jenkinsfile"
        • This could take a while as we have to do a shallow clone of the repository
        • How much progress information do we get from the clone? If we can easily get this info we can use a determinate progress indicator rather than a indeterminate one.
      • Developer should be able to cancel the load if it takes too long
      • Developer sees the Editor

      Saving from the editor

      1. Developer clicks save
      2. Developer sees the save dialog and then confirms
        • May commit back to new branch or current branch
      3. Developer sees progress dialog with message "Saving your pipeline"
      4. Developer lands back on the Activity screen

      Technical notes

      Unlike Github, Blue Ocean needs to make a shallow clone of the repository on the master in order to perform any operations. It is important to do whatever we can to make the editor work for developers at the best possible speed.

        Attachments

          Issue Links

            Activity

            Hide
            bwalding Ben Walding added a comment -

            If you are willing to create something "different" for Github, then there is a Content API that will let manipulate files without having a checkout - https://developer.github.com/v3/repos/contents/

            Show
            bwalding Ben Walding added a comment - If you are willing to create something "different" for Github, then there is a Content API that will let manipulate files without having a checkout - https://developer.github.com/v3/repos/contents/
            Hide
            kzantow Keith Zantow added a comment -

            Ben Walding welcome to Earth. We have the special case for Github already implemented in rc3.

            Show
            kzantow Keith Zantow added a comment - Ben Walding welcome to Earth. We have the special case for Github already implemented in rc3 .
            Hide
            michaelneale Michael Neale added a comment -

            Ben has been busy cooking up dank memes for the @loveskuchen twitter account, give him some slack. 

            Show
            michaelneale Michael Neale added a comment - Ben has been busy cooking up dank memes for the @loveskuchen twitter account, give him some slack. 
            Hide
            stodorov Steve Todorov added a comment -

            This might take a while to implement. Would it be possible to have a way to get into the visual editor and copy/paste the content of a Jenkinsfile into the editor and when we're finished with editing it - to have an "export" option that can simply output the new Jenkinsfile? One can then just commit it manually (until this gets fixed)

            Show
            stodorov Steve Todorov added a comment - This might take a while to implement. Would it be possible to have a way to get into the visual editor and copy/paste the content of a Jenkinsfile into the editor and when we're finished with editing it - to have an "export" option that can simply output the new Jenkinsfile? One can then just commit it manually (until this gets fixed)
            Hide
            kzantow Keith Zantow added a comment - - edited

            Steve Todorov go to the editor directly (there's no link for it, something like: http://localhost:8080/jenkins/blue/organizations/jenkins/pipeline-editor/) and then use Ctrl-S / Cmd-S to open the load save dialog. We will be improving the documentation on this soon, I think.

            Show
            kzantow Keith Zantow added a comment - - edited Steve Todorov go to the editor directly (there's no link for it, something like: http://localhost:8080/jenkins/blue/organizations/jenkins/pipeline-editor/ ) and then use Ctrl-S / Cmd-S to open the load save dialog. We will be improving the documentation on this soon, I think.
            Hide
            stodorov Steve Todorov added a comment -

            Keith Zantow thank you very much for sharing this! Works like a charm!

            Show
            stodorov Steve Todorov added a comment - Keith Zantow thank you very much for sharing this! Works like a charm!
            Hide
            jamesdumay James Dumay added a comment -

            Moving back to TODO so we can track its resumption (this sprint)

            Show
            jamesdumay James Dumay added a comment - Moving back to TODO so we can track its resumption (this sprint)
            Hide
            cliffmeyers Cliff Meyers added a comment -

            James Dumay once this is implemented, will the user still be able to create pipelines from Git over HTTPS? If no, then I expect the entire "Create Credential" dialog can be removed?

            Show
            cliffmeyers Cliff Meyers added a comment - James Dumay once this is implemented, will the user still be able to create pipelines from Git over HTTPS? If no, then I expect the entire "Create Credential" dialog can be removed?
            Hide
            kzantow Keith Zantow added a comment -

            Cliff Meyers James Dumay FYI - I have currently implemented a bit of a URL match... anything that looks like an SSH URL uses the user's auto-generated key, other stuff (e.g. http:// git://) lets them pick a credential. We should add some back-end stuff for this that flags certain items as 'supporting saving'.

            Show
            kzantow Keith Zantow added a comment - Cliff Meyers James Dumay FYI - I have currently implemented a bit of a URL match... anything that looks like an SSH URL uses the user's auto-generated key, other stuff (e.g. http:// git://) lets them pick a credential. We should add some back-end stuff for this that flags certain items as 'supporting saving'.
            Hide
            cliffmeyers Cliff Meyers added a comment -

            Keith Zantow I don't quite follow your statement about items "supporting saving" - can you elaborate?

            Show
            cliffmeyers Cliff Meyers added a comment - Keith Zantow I don't quite follow your statement about items "supporting saving" - can you elaborate?
            Hide
            kzantow Keith Zantow added a comment -

            Cliff Meyers In order to show the editor icon, the pipeline must support writing back to the repo. GH, BB and Git with SSH all work, but HTTPS git may not, etc.

            Show
            kzantow Keith Zantow added a comment - Cliff Meyers In order to show the editor icon, the pipeline must support writing back to the repo. GH, BB and Git with SSH all work, but HTTPS git may not, etc.
            Hide
            cliffmeyers Cliff Meyers added a comment -

            Okay right. I wonder if adding this to BlueScmSource would be appropriate. it could also be a Capability exposed on a subclass of BlueScmSource. cc Vivek Pandey for input.

            Show
            cliffmeyers Cliff Meyers added a comment - Okay right. I wonder if adding this to BlueScmSource would be appropriate. it could also be a Capability exposed on a subclass of BlueScmSource. cc Vivek Pandey for input.
            Hide
            kzantow Keith Zantow added a comment -

            Cliff Meyers Vivek Pandey in this case it's a dynamic capability - is there a way to execute some code to determine capabilities for something? E.g. it is based on the configured branch source, based on the URL and credentials and ultimately the ability to perform a specific action. We can't really use class metadata for this without defining more types of BlueScmSource, which I suppose we could do, but seems wrong. We could just add a property instead and allow the ScmSources to calculate as needed.

            Show
            kzantow Keith Zantow added a comment - Cliff Meyers Vivek Pandey in this case it's a dynamic capability - is there a way to execute some code to determine capabilities for something? E.g. it is based on the configured branch source, based on the URL and credentials and ultimately the ability to perform a specific action. We can't really use class metadata for this without defining more types of BlueScmSource, which I suppose we could do, but seems wrong. We could just add a property instead and allow the ScmSources to calculate as needed.
            Hide
            cliffmeyers Cliff Meyers added a comment -

            Keith Zantow you're absolutely write. A property probably makes sense here.

            Show
            cliffmeyers Cliff Meyers added a comment - Keith Zantow you're absolutely write. A property probably makes sense here.

              People

              • Assignee:
                kzantow Keith Zantow
                Reporter:
                michaelneale Michael Neale
              • Votes:
                42 Vote for this issue
                Watchers:
                49 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: