Remove/Delete build parameters once used

We have some multi-branch pipeline jobs which are set up via Jenkinsfiles.
When we were setting up the jobs, we used build parameters to parameterize the build.

Now this is not relevant anymore, so we removed the parameters from the Jenkinsfile.
But they are still visible via the UI and the “build” button is still a “build with parameters” button.

The configuration of each branch only lists the parameters.
But they cannot be deleted and the “this build is parameterized” checkbox is activated but greyed out.

Is there any way to remove these old parameters?

THX :slight_smile:

@pmon try to add empty parameters notation to your Jenkinsfile like this:


If it will not help you have to use groovy from scripted console to manually obtain job’s object and remove parameters from it. I can just provide an example how to obtain a job, but I have not experience with code which allows to remove parameters from job. Here is how we you can use it:

import jenkins.model.Jenkins

def jobName = "your-multibranch-pipeline-name"

def jenkins = Jenkins.instance

def job = jenkins.getItemByFullName(jobName)
if (job == null) {
    println("Could not find the Multibranch Pipeline: $jobName")
if (pipeline instanceof org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) {
    def branchProjects = pipeline.getItems()
    branchProjects.each { branch ->
        // Do your staff
1 Like

THX a lot for your instant reply.
It kind of helped, please see the screenshot below.


1 Like

@pmon nice to hear. It seems, like complete solution can be achieved by groovy way only. Jenkins job object has. removeProperty​(JobProperty jobProperty) method that allows to remove some job properties (for example build discarder, periodic trigger, parameters, etc.). So you should find parameters class and combine this wit code I’ve sent above. It will remove parameters completely. Here is javadoc link:

1 Like