Calculate Jenkins Job minutes for all jobs all folder weekly or monthly

Hi all,

I’m looking to get a way to calculate all our job build minutes, from all projects (folder). Currently, we run Jenkins in Kubernetes using build agents.

Is this information stored internally, or would I need to write something in each pipeline and write to some DB?

G

You can get access to the build duration via the JSON API each job.

https://your.jenkins.instance.com/job/jobName/lastSuccessfulBuild/api/json?pretty=true

It will have a property named “duration” that I believe is in milliseconds.

You could have a job that automatically runs weekly/monthly to collect this data, or something outside of Jenkins.

1 Like

OK, thanks I will put my thinking hat on.

so it will be in the JSON response like

....
"timestamp" : 1666091400722,
......

What about one of the many metrics plugins? For example I use the prometheus plugin to generate https://ci.g4v.dev/prometheus/ which can include average build duration.

1 Like

Something like that, take a look at a result via web browser.