- Open a project in Jenkins
- Click "more" in Build History (this should show all builds in that project)
- Open console, paste in above code.
- Inspect buildStatsobject.
          Created
          October 24, 2014 16:37 
        
      - 
      
- 
        Save Holek/db478dedd0e81c26f4b1 to your computer and use it in GitHub Desktop. 
    Jenkins build categorization by month
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var buildStats = {}; | |
| function buildChecker(buildRow) { | |
| var linkText = Prototype.Selector.select('td:nth-child(2) a', buildRow); | |
| var dateTxt = linkText && linkText.first() && (typeof linkText.first().text != 'undefined') && linkText.first().text.match(/([a-z]{3})-2014/i); | |
| if (dateTxt) { | |
| var date = dateTxt[1]; | |
| // console.log('date is', date); | |
| var img = Prototype.Selector.select('td:first-child img', buildRow); | |
| // console.log('img', img); | |
| if (!buildStats[date]) buildStats[date] = {}; | |
| if (img.first() && img.first().alt != '') { | |
| var state = (img.first().alt.match(/Success/) ? 'success' : 'failure'); | |
| if (buildStats[date][state]) { | |
| // console.log('adding +1 to', date, state) | |
| buildStats[date][state] += 1; | |
| } else { | |
| // console.log('adding +1 to', date, state) | |
| buildStats[date][state] = 1; | |
| } | |
| } | |
| } | |
| } | |
| $$("#buildHistory > tbody > tr").each(buildChecker); | |
| buildStats | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment