Configure an update center in an existing Team/Managed controller

Article ID:360031819472
1 minute readKnowledge base

Issue

You would like to automatically configure an update center in an existing Team/Managed controller

Environment

Resolution

Configure an update center in an existing Team

For Teams you can execute the groovy code below under Manage Jenkins -> Script Console in Operations Center. You could also execute this groovy script through Operations Center CLI.

def team = Jenkins.instance.getItemByFullName('Teams/<TEAM_NAME>')
com.cloudbees.opscenter.plugins.updatecenter.ConnectedMasterUpdateCenterProperty prp = new com.cloudbees.opscenter.plugins.updatecenter.ConnectedMasterUpdateCenterProperty(new com.cloudbees.plugins.updatecenter.sources.LocalUpdateSource('<UPDATE_CENTER_NAME>'))
team.getProperties().replace(prp)
team.save()

Configure an update center in a Managed controller

For Managed controllers you can execute the groovy code below under Manage Jenkins -> Script Console in Operations Center. You could also execute this groovy script through Operations Center CLI.

def mm = Jenkins.instance.getItemByFullName('MANAGED_CONTROLLER_FULL_NAME>')
com.cloudbees.opscenter.plugins.updatecenter.ConnectedMasterUpdateCenterProperty prp = new com.cloudbees.opscenter.plugins.updatecenter.ConnectedMasterUpdateCenterProperty(new com.cloudbees.plugins.updatecenter.sources.LocalUpdateSource('<UPDATE_CENTER_NAME>'))
mm.getProperties().replace(prp)
mm.save()