alefragnani / vscode-jenkins-status

Jenkins Status Extension for Visual Studio Code
MIT License
27 stars 20 forks source link

Add support for multibranch pipelines #16

Open pzelnip opened 6 years ago

pzelnip commented 6 years ago

The multibranch pipelines plugin (https://wiki.jenkins.io/display/JENKINS/Pipeline+Multibranch+Plugin) for Jenkins allows one to effectively have a separate build job for a number of branches within a repository.

It'd be really cool if the Jenkins Status VSCode addon could support this. Currently if you specify the main url for a multibranch job (ie http://my.jenkinsserver.com/job/MainProject), it fails to retrieve the status of the job. If you specify a specific branch's job (http://my.jenkinsserver.com/job/MainProject/job/somebranch), you get the status of the most recent build on that branch. This works for monitoring a single "mainline" branch, but if you want to see the status of the most recent build of the branch you're working (which may very well not be master), then you have to manually edit the .jenkins config file to point to the Jenkins job for your branch which is cumbersome.

What I'm envisioning is having the base url in the .jenkins file (ie http://my.jenkinsserver.com/job/MainProject), and then the VS Code plugin queries Jenkins for the most recent build of the current branch you have checked out.

pmartindev commented 5 years ago

Love this feature! We use multibranch pipelines heavily, and this would be an excellent feature to have.

LinuxSuRen commented 5 years ago

If there's no one prepared to do this, I'll take over it.

alefragnani commented 5 years ago

Hi @LinuxSuRen ,

Feel free to send a PR 👍

I would ask you to use this issue to describe how you intend to support the feature, so others (which are subscribed ) could participate in the discussion.

Thanks for your help

pzelnip commented 5 years ago

Doesn't help with the status badge, but I use the following tasks to allow me to quickly open up Jenkins in my browser:

        {
            "label": "Open Up Jenkins",
            "type": "shell",
            "command": "open https://my.jenkins.url.com/job/MyTopLevelFolder/job/MyProject/",
            "presentation": {
                "reveal": "silent"
           }
        },
        {
            "label": "Open Up Branch in Jenkins",
            "type": "shell",
            "command": "open https://my.jenkins.url.com/job/MyTopLevelFolder/job/MyProject/job/`git rev-parse --abbrev-ref HEAD`",
            "presentation": {
                "reveal": "silent"
           }
        },

This is kludgy, but works reasonably well for my workflow where we have a top level folder (MyTopLevelFolder in the example), and within that folder have a number of projects (MyProject in the example), each of which are multibranch pipeline jobs.

This allows me to open up the command pallette, type "run Task", and then pick "Open Up Branch In Jenkins" and the current branch on my machine is opened up in Jenkins (assuming it's been built, if not then I'll get a 404).

presdec commented 1 year ago

Any chance of this getting resolved?

LinuxSuRen commented 1 year ago

hi @alefragnani ,sorry for missing this message. I didn't have too much time in this area. Please go ahead if anyone is interested in it.