I want to implement a healthcheck(invoking an endpoint) in Jenkins, which should run in docker container. I don't want to manually configure my pipeline job in Jenkins every time container is up.
I've tried JCasC, but it doesn't allow to autoconfigure jobs.
How do I automatically configure jobs on first Jenkins launch and trigger them on each time Jenkins is up?
Here's is an example
jobssection ofjenkins.yml(CasC config file); it requires the "Job DSL" and "Startup Trigger" plugins (in addition to the "Configuration as Code" plugin, of course):The
triggerssection is what's important; the rest is just to put it in context.Apparently, the startup trigger can also work on slave nodes but I gather that's not what you want, so I specified
master.Note: This is the kernel from which I pieced together the solution: https://issues.jenkins-ci.org/browse/JENKINS-41671?focusedCommentId=287026&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-287026