l e m m s t e r . d e
  • Home
  • impressum
  • talks
  • Categories
  • Tags
  • Archives

Receive E-Mail notifications when Jenkins plug-in updates are available

  • Install Groovy script plug-in via Jenkin UpdateCenter

  • Create a new Jenkins job and name it e.g. zPluginCheck

    • Set to “Build periodically” with a reasonable schedule (once a day?!)

    • Add “E-Mail notification” as a post build action

    • Add an “Execute system Groovy script” build step:

      // Explicitly checking for updates works only with Jenkins >= 1.501
      // Not available in LTS release :(
      //
      //hudson.model.Hudson.instance.updateCenter.getSiteList().each(
      // {hudson.model.UpdateSite s -> s.doInvalidateData()
      //    println(s.isDue())})
      //hudson.model.Hudson.instance.updateCenter.updateAllSites()
      
      def updates = []
      hudson.model.Hudson.instance.pluginManager.plugins.inject(updates) {
          List toUpdate, p -> if(p.hasUpdate()) {
           toUpdate << "${p.longName}/${p.shortName}:${p.version}"
          }
          toUpdate
      }.inspect()
      
      if(!updates.empty) {
         println(updates)
         throw new hudson.AbortException("Found available updates.")
      }
      

Published

Mar 1, 2013

Category

eclipse

Contact

  • Powered by Pelican. Theme: Elegant