diff --git a/dockerizeit/master/credentials.groovy b/dockerizeit/master/credentials.groovy index 3c3f714..63f9228 100644 --- a/dockerizeit/master/credentials.groovy +++ b/dockerizeit/master/credentials.groovy @@ -2,19 +2,12 @@ import java.lang.System import jenkins.* import hudson.model.* import jenkins.model.* -// Plugins for SSH credentials -import com.cloudbees.plugins.credentials.* -import com.cloudbees.plugins.credentials.common.* -import com.cloudbees.plugins.credentials.domains.* -import com.cloudbees.plugins.credentials.impl.* -import com.cloudbees.jenkins.plugins.sshcredentials.impl.* -import hudson.plugins.sshslaves.* // Read properties def home_dir = System.getenv("JENKINS_HOME") def properties = new ConfigSlurper().parse(new File("$home_dir/jenkins.properties").toURI().toURL()) -global_domain = Domain.global() +global_domain = com.cloudbees.plugins.credentials.domains.Domain.global() credentials_store = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore() properties.credentials.each { @@ -24,17 +17,17 @@ properties.credentials.each { switch (it.value.type) { case "ssh": println "--> Create ssh credentials for user ${it.value.userId} with SSH private key ${it.value.path}" - creds = new BasicSSHUserPrivateKey(CredentialsScope.GLOBAL, + creds = new com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey(com.cloudbees.plugins.credentials.CredentialsScope.GLOBAL, it.value.credentialsId, it.value.userId, - new BasicSSHUserPrivateKey.FileOnMasterPrivateKeySource(it.value.path), + new com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey.FileOnMasterPrivateKeySource(it.value.path), it.value.passphrase, it.value.description) credentials_store.addCredentials(global_domain, creds) break case "password": println "--> Create credentials for user ${it.value.userId} with the password from ${it.value.path}" - creds = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, + creds = new com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl(com.cloudbees.plugins.credentials.CredentialsScope.GLOBAL, it.value.credentialsId, it.value.description, it.value.userId, diff --git a/dockerizeit/master/initialjobs.groovy b/dockerizeit/master/initialjobs.groovy index 057ecbe..98b595e 100644 --- a/dockerizeit/master/initialjobs.groovy +++ b/dockerizeit/master/initialjobs.groovy @@ -3,8 +3,6 @@ import hudson.model.* import jenkins.model.* import javaposse.jobdsl.plugin.* import hudson.triggers.TimerTrigger -import org.jenkinsci.plugins.workflow.job.WorkflowJob -import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition def instance = Jenkins.getInstance() def home_dir = System.getenv("JENKINS_HOME") @@ -17,8 +15,8 @@ properties.seedjobs.each { def job = Jenkins.instance.getJob(it.value.name) if (job) { job.delete() } println "--> Create ${it.value.name} seed jod" - def project = Jenkins.instance.createProject(WorkflowJob.class, it.value.name) - project.setDefinition(new CpsFlowDefinition(""" + def project = Jenkins.instance.createProject(org.jenkinsci.plugins.workflow.job.WorkflowJob.class, it.value.name) + project.setDefinition(new org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition(""" import javaposse.jobdsl.plugin.* node("${properties.global.variables.utility_slave}") { diff --git a/dockerizeit/master/securityAD.groovy b/dockerizeit/master/securityAD.groovy index ed8871f..953b409 100644 --- a/dockerizeit/master/securityAD.groovy +++ b/dockerizeit/master/securityAD.groovy @@ -1,6 +1,5 @@ import java.lang.System import jenkins.model.* -import hudson.plugins.active_directory.* import com.google.common.collect.Lists def home_dir = System.getenv("JENKINS_HOME") @@ -9,15 +8,15 @@ def properties = new ConfigSlurper().parse(new File("$home_dir/security.properti if(properties.ad.enabled) { println "--> Configure AD" def realm = new hudson.plugins.active_directory.ActiveDirectorySecurityRealm(properties.ad.domain, - Lists.newArrayList(new ActiveDirectoryDomain(properties.ad.domain, properties.ad.server)), + Lists.newArrayList(new hudson.plugins.active_directory.ActiveDirectoryDomain(properties.ad.domain, properties.ad.server)), properties.ad.site, properties.ad.bindName, properties.ad.bindPassword, properties.ad.server, - GroupLookupStrategy.valueOf(properties.ad.groupLookupStrategy.toString().toUpperCase()), + hudson.plugins.active_directory.GroupLookupStrategy.valueOf(properties.ad.groupLookupStrategy.toString().toUpperCase()), true, true, - new CacheConfiguration(1000, 6000)) + new hudson.plugins.active_directory.CacheConfiguration(1000, 6000)) Jenkins.instance.setSecurityRealm(realm) Jenkins.instance.save() } diff --git a/dockerizeit/master/slaves.groovy b/dockerizeit/master/slaves.groovy index 3e60823..05a5672 100644 --- a/dockerizeit/master/slaves.groovy +++ b/dockerizeit/master/slaves.groovy @@ -2,7 +2,6 @@ import java.lang.System import hudson.model.* import jenkins.model.* import hudson.slaves.* -import hudson.plugins.sshslaves.* import hudson.model.Node.* // load helpers and read properties @@ -21,7 +20,7 @@ properties.slaves.each { launcher = new JNLPLauncher() break case "ssh": - launcher = new SSHLauncher(it.value.host, // The host to connect to + launcher = new hudson.plugins.sshslaves.SSHLauncher(it.value.host, // The host to connect to it.value.get('port', 22), // The port to connect on it.value.credentialsId, // The credentials id to connect as it.value.get('jvmOptions',""), // Options passed to the java vm