Skip to content

Instantly share code, notes, and snippets.

@sturman
sturman / Jenkinsfile
Created December 9, 2020 12:39
Running integration tests using testcontainers on Jenkins with the Kubernetes Plugin
def pod =
"""
apiVersion: v1
kind: Pod
metadata:
labels:
name: worker
spec:
serviceAccountName: jenkins
containers:
@sturman
sturman / script.groovy
Last active November 9, 2021 10:54
List all Jenkins jobs and count build duration for each in sum for a period of time
def daysBefore = 30
def currentMillis = System.currentTimeMillis()
def cutOfDate = System.currentTimeMillis() - 1000L * 60 * 60 * 24 * daysBefore
long sumDurationMillis = 0
for (job in Jenkins.instance.getAllItems(Job.class)) {
def job_name = job.getFullName()
long durationMillis = 0