Child pages
  • Change publish over SSH configuration
Skip to end of metadata
Go to start of metadata

This script changes the configuration for the plugin: Publish Over SSH Plugin

It will change the configuration name from "bad-server" to "good-server" for FreeStyleProjects.

import java.util.*
import hudson.model.*
import hudson.maven.*
import hudson.maven.reporters.*
import hudson.matrix.*
import hudson.tasks.*
import hudson.util.DescribableList
import jenkins.plugins.publish_over_ssh.*
import jenkins.plugins.publish_over.*

hudson.model.Hudson.instance.items.findAll{job -> job.isBuildable() }.each{
job -> 

  if(job instanceof FreeStyleProject) {
    for (builder in{
      if(builder instanceof BapSshBuilderPlugin) {
        ArrayList<BapPublisher> publishers = builder.delegate.delegate.publishers
        for(publisher in publishers) {
          if (publisher.configName == "bad-server") {
            println "Changing job: ${}"
            publisher.configName = "good-server"
  • No labels