1

At work we have recently started using Jenkins. I would like to be able to see the basic status of builds from within Vim. Is there a typical or standard way of doing this?

Currently i am using my own script which interacts with the jenkins API but it seems unlikely to me that there would be no more common ways of doing something which i think rather a lot of people would want to do.

axwr
  • 2,118
  • 1
  • 16
  • 29
  • What did you find on google? – romainl Mar 13 '17 at 05:52
  • @romainl Very little, there is the remote terminal access Jenkins plugin but it is out of date and would require adding it to Jenkins. From what i can tell there is not a currently working / active plugin available. This is why i am wondering what the standard way would be as i imagine plenty of vimmers have wanted to do this before. – axwr Mar 13 '17 at 16:50
  • For vim specifically, I would guess not. But Jenkins has an API. – Christopher Orr Mar 14 '17 at 01:56
  • @ChristopherOrr Yes, that's true and i've gone with that for the time being, i just though there would be a standard way of doing this since it is such a common combination of tools. – axwr Apr 07 '17 at 00:57
  • i'd be interested in writing a plugin to accomplish this. i'll follow up with an answer when i've put something together. – burnettk Apr 13 '17 at 01:08
  • you could use https://github.com/diepm/vim-rest-console – Novaterata Apr 14 '17 at 23:37

1 Answers1

1

You can use this vim plugin, which I have developed;

https://github.com/burnettk/vim-jenkins

Since most apps that use Jenkins going forward will use Jenkinsfiles, I decided to use that as the hook. So what you do is add a comment anywhere in your Jenkinsfile with the path to its build plan, like this:

// BUILD_PLAN_PATH: /view/Sweetapps/job/hot-app/job/master

This comment is theoretically useful even apart from this feature as documentation, but its purpose is for the plugin to parse it to figure out how to interact with the jenkins API to fetch the build status (FAILURE/SUCCESS/etc) for the build plan that goes with this Jenkinfile. Once the comment is in place, fetch your build status by running:

:JenkinsShowLastBuildResult

Or its shortcut ("jenkins build"):

<Leader>jb

The build status will be echo'ed into your vim window.

My favorite feature is still Jenkinsfile validation. I use it multiple times a day.

:JenkinsValidateJenkinsFile

or the shortcut (short for "jenkins Jenkinsfile"):

<Leader>jj

Hopefully people like the features, and maybe get some ideas about other features that might be useful to add. Pull requests are of course welcome. I intend to add a feature to open the same build plan that is already documented in the Jenkinsfile in a browser window (using mac "open", but probably if anyone cares to make it work on linux or windows, it would be possible).

Matt
  • 74,352
  • 26
  • 153
  • 180
burnettk
  • 13,557
  • 4
  • 51
  • 52