Kubernetes Cron Job to trigger a Jenkins pipeline

7/10/2021

My team to to create a cron in Kubernetes/OpenShift that will trigger our Jenkins pipeline that we have set up. We tried doing the triggers{} syntax and the build periodically option on the Jenkins UI, however these are unreliable for us since whenever Jenkins restarts, those build triggers on Jenkins get removed.

-- Ben
devops
jenkins
jenkins-pipeline
kubernetes
openshift

1 Answer

7/20/2021

There is two approaches you could use here:

1) Make your Jenkins stateless with the Configuration as Code plugin 2) Use a curlimages/curl container to trigger a job via the Jenkins REST API

-- Kai Schneider
Source: StackOverflow