Skip to content

Commit

Permalink
Fix #143: Add full class name
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsedova committed Mar 24, 2017
1 parent 65211f8 commit 7e48026
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 21 deletions.
6 changes: 3 additions & 3 deletions dockerizeit/master/artifactory.groovy
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import java.lang.System
import hudson.model.*
import jenkins.model.*
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.plugins.credentials.common.StandardUsernameCredentials

def home_dir = System.getenv("JENKINS_HOME")
def properties = new ConfigSlurper().parse(new File("$home_dir/jenkins.properties").toURI().toURL())

def getPasswordCredentials(String id) {
def all = CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class)
def all = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class)
return all.findResult { it.id == id ? it : null }
}

Expand All @@ -17,8 +15,10 @@ properties.artifactory.each() { configName, serverConfig ->
println "--> Configure Artifactory: Server ${serverConfig.serverName}"
def inst = Jenkins.getInstance()
def desc = inst.getDescriptor("org.jfrog.hudson.ArtifactoryBuilder")

def deployerCredentials = new org.jfrog.hudson.CredentialsConfig(getPasswordCredentials(serverConfig.deployerCredentialsId),
serverConfig.deployerCredentialsId,
serverConfig.overridingCredentials)
def resolverCredentials = new org.jfrog.hudson.CredentialsConfig(getPasswordCredentials(serverConfig.deployerCredentialsId),
serverConfig.deployerCredentialsId,
serverConfig.overridingCredentials)
Expand Down
17 changes: 7 additions & 10 deletions dockerizeit/master/globalPipelineLibraries.groovy
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import java.lang.System
import hudson.model.*
import hudson.plugins.git.GitSCM
import org.jenkinsci.plugins.workflow.libs.*
import hudson.plugins.git.*
import java.util.Collections
import java.util.List

def home_dir = System.getenv("JENKINS_HOME")
def properties = new ConfigSlurper().parse(new File("$home_dir/jenkins.properties").toURI().toURL())

GlobalLibraries gl = GlobalLibraries.get()
List<LibraryConfiguration> configs = new ArrayList<LibraryConfiguration>()
def gl = org.jenkinsci.plugins.workflow.libs.GlobalLibraries.get()
def configs = new ArrayList<org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>()

properties.libraries.each() { key, value ->
if(value.enabled) {
println "--> Configure Pipeline shared groovy library: ${value.name}"
List<UserRemoteConfig> userRemoteList = new ArrayList<UserRemoteConfig>()
userRemoteList.add(new UserRemoteConfig(value.scm_path, "", "", value.credentialsId))
List<BranchSpec> branches = Collections.singletonList(new BranchSpec(value.branch))
def userRemoteList = new ArrayList<hudson.plugins.git.UserRemoteConfig>()
userRemoteList.add(new hudson.plugins.git.UserRemoteConfig(value.scm_path, "", "", value.credentialsId))
def branches = Collections.singletonList(new hudson.plugins.git.BranchSpec(value.branch))
println(userRemoteList)
GitSCM gitSCM = new GitSCM(userRemoteList,
def gitSCM = new hudson.plugins.git.GitSCM(userRemoteList,
branches,
false,
null, null, null, null)
LibraryConfiguration globalConfig = new LibraryConfiguration(value.name, new SCMRetriever(gitSCM))
def globalConfig = new org.jenkinsci.plugins.workflow.libs.LibraryConfiguration(value.name, new org.jenkinsci.plugins.workflow.libs.SCMRetriever(gitSCM))
globalConfig.setDefaultVersion(value.version)
globalConfig.setImplicit(value.implicitly)
globalConfig.setAllowVersionOverride(value.allow_overridden)
Expand Down
3 changes: 1 addition & 2 deletions dockerizeit/master/matrixbasedsecurity.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import java.lang.System
import jenkins.model.*
import hudson.security.*
import org.jenkinsci.plugins.*
import hudson.model.*

Expand All @@ -9,7 +8,7 @@ def properties = new ConfigSlurper().parse(new File("${home_dir}/security.proper

if(properties.matrixbasedsecurity.enabled){
println "--> Configure Matrix-Based security"
def strategy = new GlobalMatrixAuthorizationStrategy()
def strategy = new hudson.security.GlobalMatrixAuthorizationStrategy()

properties.matrixbasedsecurity.users.each() { key, value ->
value.permissions.each() {
Expand Down
2 changes: 1 addition & 1 deletion dockerizeit/master/securityAD.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def properties = new ConfigSlurper().parse(new File("$home_dir/security.properti

if(properties.ad.enabled) {
println "--> Configure AD"
ActiveDirectorySecurityRealm realm = new ActiveDirectorySecurityRealm(properties.ad.domain,
def realm = new hudson.plugins.active_directory.ActiveDirectorySecurityRealm(properties.ad.domain,
Lists.newArrayList(new ActiveDirectoryDomain(properties.ad.domain, properties.ad.server)),
properties.ad.site,
properties.ad.bindName,
Expand Down
3 changes: 1 addition & 2 deletions dockerizeit/master/securityGoogleLogin.groovy
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import java.lang.System
import jenkins.model.*
import hudson.security.*
import org.jenkinsci.plugins.googlelogin.GoogleOAuth2SecurityRealm

def home_dir = System.getenv("JENKINS_HOME")
def properties = new ConfigSlurper().parse(new File("$home_dir/security.properties").toURI().toURL())

if(properties.googlelogin.enabled) {
println '--> Configure Google Login'
def secretFile = new File(properties.googlelogin.clientSecret)
SecurityRealm googleLogin_realm = new GoogleOAuth2SecurityRealm(properties.googlelogin.clientId,
def googleLogin_realm = new org.jenkinsci.plugins.googlelogin.GoogleOAuth2SecurityRealm(properties.googlelogin.clientId,
secretFile.text.trim(),
properties.googlelogin.domain)
Jenkins.instance.setSecurityRealm(googleLogin_realm)
Expand Down
3 changes: 1 addition & 2 deletions dockerizeit/master/securityLDAP.groovy
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import java.lang.System
import jenkins.model.*
import hudson.security.*
import org.jenkinsci.plugins.*

def home_dir = System.getenv("JENKINS_HOME")
def properties = new ConfigSlurper().parse(new File("$home_dir/security.properties").toURI().toURL())

if(properties.ldap.enabled) {
println "--> Configure LDAP"
SecurityRealm ldap_realm = new LDAPSecurityRealm(properties.ldap.server,
def ldap_realm = new hudson.security.LDAPSecurityRealm(properties.ldap.server,
properties.ldap.rootDN,
properties.ldap.userSearchBase,
properties.ldap.userSearch,
Expand Down
1 change: 0 additions & 1 deletion dockerizeit/master/slack.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import java.lang.System
import jenkins.model.*
import hudson.security.*
import jenkins.plugins.slack.SlackNotifier.*

def home_dir = System.getenv("JENKINS_HOME")
def properties = new ConfigSlurper().parse(new File("$home_dir/jenkins.properties").toURI().toURL())
Expand Down

0 comments on commit 7e48026

Please sign in to comment.