Project

General

Profile

1
def myFile= new File("/tmp/DSL45/configuration.xml")
2
def parser=new XmlSlurper().parseText(myFile.text);
3
def allModule=parser.module.each {
4
        def projectName= it.name as String
5
        def sourceCodeType=it.source.@type
6
        def versionCode = it.source.@version
7
        def URLSource=it.source as String        
8
        def mvnGoal= it.goal as String
9
        def hasSonar= it.sonar as String
10
        def mail = it.mail as String
11
        def myrepositoryId = it.deploy.RepositoryId as String
12
        def repositoryURL = it.deploy.RepositoryURL as String
13
        def nightly = it.nightly as String
14
        def cron_node = it.cron as String
15
        def j_name =  'DSL45_'+projectName          
16
        if (versionCode == '4')
17
        {
18
          j_name =  'DSL45_'+projectName          
19
        }
20
        if (versionCode == '5')
21
        {
22
          j_name =  'DSL5_'+projectName          
23
        }
24
        
25
        
26
          mavenJob(j_name) {    
27
            scm {
28
                svn {
29
                    location(URLSource)
30
                    checkoutStrategy(SvnCheckoutStrategy.CHECKOUT)                  
31
                  }
32
            }
33
            triggers {
34
               scm('H/10 * * * *')
35
               snapshotDependencies(true)
36
            }            
37
            goals(mvnGoal)  
38
            logRotator {
39
                numToKeep(2)
40
                artifactNumToKeep(1)
41
            }      
42
            publishers {
43
                deployArtifacts {
44
                    repositoryUrl (repositoryURL)
45
                    repositoryId (myrepositoryId)
46
                    uniqueVersion (true)
47
                    evenIfUnstable (true)
48
                    }                    
49
                }   
50
            
51
            configure { project ->
52
                project / 'publishers' / 'jenkins.plugins.slack.SlackNotifier'(plugin: 'slack@2.2"') {
53
                      'baseUrl'()
54
                      'teamDomain'()
55
                      'authToken'()
56
                      'authTokenCredentialId'()
57
                      'botUser'(false)
58
                      'room'()
59
                      'startNotification'(false)
60
                      'notifySuccess'(false)
61
                      'notifyAborted'(false)
62
                      'notifyNotBuilt'(false)
63
                      'notifyUnstable'(true)
64
                      'notifyRegression'(false)
65
                      'notifyFailure'(true)
66
                      'notifyBackToNormal'(true)
67
                      'notifyRepeatedFailure'(false)
68
                      'includeTestSummary'(false)
69
                      'includeFailedTests'(false)
70
                      'commitInfoChoice'('NONE')
71
                      'includeCustomMessage'(false)
72
                      'customMessage'()
73
                }
74
            }
75
        }
76
    
77
}
(5-5/6)