Issue: We noticed a bug in Groovy 2.4.21 and require an upgrade to version 2.5, the university has about 80 to 90 pipeline jobs running as “Pipeline script from SCM”. I don’t want to go through each job and set the groovy version within the script.
I have a couple of questions just to confirm my understanding
From the links above i’m gathering Im unable to set the Groovy Version on a global level to override Jenkins Core Groovy ?
I will need to update each pipeline script and set the Groovy version correctly (this setting is based on Manage Jenkins / Global Tool Configuration / Groovy) ?
Our agents are deployed via pre-built images, if I install / Configure GROOVY_HOME within the image I still need to configure the pipeline script to call the version set within “Global Tool Configuration”
Any thoughts or tips/tricks to manage this number of pipe jobs that require the Groovy version update?
I’m not an expert on that, I just have read a few things.
Hopefully someone more knowledgeable will chime in.
As far as I can tell, you can’t set the Groovy version on a global level to override Jenkins Core’s Groovy.
You would need to update each pipeline script and set the Groovy version correctly.
As for managing a large number of pipeline jobs that require the Groovy version update, you could try the following:
Use the Jenkins command line client (CLI) to update the pipeline scripts in bulk. This may be a more efficient way to update a large number of jobs instead of manually editing each one.
You could maybe switch to using a Jenkinsfile instead of a Pipeline script from SCM. This could maybe allow you to manage the Groovy version in the Jenkinsfile and make updates more easily.
I know this won’t help for existing pipelines, but you could maybe create a template pipeline script for new pipelines that includes the Groovy version and use it as a basis for creating new pipeline jobs.
Use a sledgehammer to crack a nut: why not use a configuration management tool like Ansible or Puppet to manage the Jenkins configuration, including the Groovy version?
Please correct me if im wrong but I need to rewrite these templates and move away from using script steps because if I set the following “withGroovy” this seems to be ignored and still triggers jenkins core groovy version 2.4.21