The Build with Parameters screen loads slowly

Article ID:360034543771
2 minute readKnowledge base

Issue

When trying to access the Build with Parameters page for my job, it takes a long time to load or doesn’t load correctly.

Resolution

One of the most common reasons you will encounter a slow Build with Parameters page is because of the Active Choices plugin. One possible reason could be due to Groovy scripts that are too complex or use of the plugin in an unexpected way.

Do not use overly complex Groovy scripts

Every time you load the Build with Parameters page, the Groovy scripts you have defined for your Active Choices parameters have to be run. If they have a lot of complex logic like querying Jenkins for a lot of data or long running loops, it is going to take time for the page to load. Also, making API calls to external systems can cause slowness if the external system responds slowly or does not respond at all. It is recommended to keep the Groovy scripts as simple as possible and not to parse large amounts of data. If you suspect one of your scripts is causing slowness, try running it from the Jenkins Script Console (Manage Jenkins -> Script Console) and on the controllers server directly and observe the behavior.

Do not use the properties block to set the parameters

We have found that if you set Active Choices parameters using the properties block inside of a pipeline job, then it has the possibility of causing slowness. This is because saving the parameters in this way causes the projectName to not be set in the jobs config.xml for the parameters. This in turn can cause the plugins code to take much longer to find the appropriate project inside Jenkins which causes the Build with Parameters screen to load very slow. The more jobs that you have on your controller, the longer it can take for it to load in this way as it may need to parse all jobs. For this reason, it is not recommended that you use Active Choices parameters in a Multibranch job. Saving the Active Choices parameters via the Jenkins UI does not seem to cause this issue.

Tested product/plugin versions