I ran into issues with missing build steps when trying to migrate jobs from one server to another when those jobs contained "Execute system Groovy Script" build steps.
After copying the job directory from the old server into the %JENKINS_HOME%/jobs directory on the new server and running "Reload Configuration from Disk", the job gets created but when reviewing it, the build step is missing.
Also, a message is displayed under "Manage Jenkins" that says:
Clicking Manage next to that message shows an error message related to the new job. That error is
The target server is a docker instance using the jenkins/jenkins:2.302-alpine image and, other than installing some extensions (such as the Groovy plugin), nothing else has been done to the instance.
I took the old server out of the mix and can recreate this problem with the following steps.
- Make sure the Groovy plugin is installed so you have the "Execute Groovy Script" and "Execute system Groovy script" build step options.
- Create a new Freestyle project
- Add a "Execute system Groovy script" build step with any simple Groovy script. such as
- Save the job and execute it
- Everything will work fine and the console output will show the word "test" printed
- Navigate to Manage Jenkins and click (and confirm) the "Reload Configuration from Disk" option.
- Navigate back to the job configuration and notice the build step is now gone
- Navigate back to Manage Jenkins and note the message at the top of the screen: "You have data stored in an older format and/or unreadable data."
- Click Manage next to that message to see the "CannotResolveClassException: hudson.plugins.groovy.SystemGroovy" error message and a complaint about "Old unreadable data"
I've marked the ticket as Critical since using the "Reload Configuration from Disk" option can wipe out build steps and makes migrating some jobs impossible.