Skip to content
Permalink
Browse files
Merge branch 'JENKINS-25915'
  • Loading branch information
daspilker committed Dec 30, 2014
2 parents 36ff46b + 1df433a commit 7a240295bb9c951ddbb104aea4f9724926a82132
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 0 deletions.
@@ -21,6 +21,7 @@ And finally, if you want to get more involved, [here's how...](https://github.co
* Added support for the [HTTP Request Plugin](https://wiki.jenkins-ci.org/display/JENKINS/HTTP+Request+Plugin)
* Added support for the [Build Monitor Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Build+Monitor+Plugin)
* Added support for the [Publish Over SSH Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin)
* Added support for the [Team Concert Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Team+Concert+Plugin)
* Enhanced support for the [Config File Provider Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin)
* Added allow missing option for the [HTML Publisher Plugin](https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin)
* Added clone timeout option for the [Git Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin)
@@ -117,6 +117,7 @@ job(Map<String, ?> arguments = [:]) {
p4(String viewspec, Closure configure = null)
p4(String viewspec, String user, Closure configure = null)
p4(String viewspec, String user, String password, Closure configure = null)
rtc(Closure closure) // since 1.28
svn(String svnUrl, Closure configure = null)
svn(String svnUrl, String localDir, Closure configure = null)
}
@@ -744,6 +744,46 @@ baseClearCase {

(since 1.24)

## Rational Team Concert (RTC)

```groovy
job {
scm {
rtc {
buildDefinition(String buildDefinition)
buildWorkspace(String buildWorkspace)
connection(String buildTool, String credentials,
String serverURI, int timeout)
}
}
}
```

Support for the [Team Concert Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Team+Concert+Plugin).

Examples:

```groovy
job {
scm {
rtc {
buildDefinition('buildDefinitionInRTC')
}
}
}
job {
scm {
rtc {
buildWorkspace('some-workspace')
connection('my-build-tool', 'build-user', 'https://localhost:9444/ccm', 60)
}
}
}
```

(since 1.28)

# Triggers


@@ -6,6 +6,7 @@ import javaposse.jobdsl.dsl.DslContext
import javaposse.jobdsl.dsl.JobManagement
import javaposse.jobdsl.dsl.WithXmlAction
import javaposse.jobdsl.dsl.helpers.scm.ClearCaseContext
import javaposse.jobdsl.dsl.helpers.scm.RTCContext
import javaposse.jobdsl.dsl.helpers.scm.GitContext
import javaposse.jobdsl.dsl.helpers.scm.PerforcePasswordEncryptor

@@ -483,4 +484,43 @@ class ScmContext implements Context {
useTimeRule(false)
}
}

/**
* <scm class="com.ibm.team.build.internal.hjplugin.RTCScm">
* <overrideGlobal>false</overrideGlobal>
* <timeout>0</timeout>
* <buildTool/>
* <serverURI>https://jazzqual.rsint.net/ccm</serverURI>
* <credentialsId>/>
* <buildType>buildDefinition</buildType>
* <buildWorkspace/>
* <buildDefinition/>
* <avoidUsingToolkit>false</avoidUsingToolkit>
* </scm>
*/
void rtc(@DslContext(RTCContext) Closure closure) {
validateMulti()

RTCContext context = new RTCContext(jobManagement)
executeInContext(closure, context)

checkArgument(context.buildType != null, 'Either buildDefinition or buildWorkspace must be specified')

scmNodes << NodeBuilder.newInstance().scm(class: 'com.ibm.team.build.internal.hjplugin.RTCScm') {
overrideGlobal(context.overrideGlobal)
timeout(context.timeout)
if (context.overrideGlobal) {
buildTool(context.buildTool)
serverURI(context.serverURI)
credentialsId(context.credentialsId)
}
buildType(context.buildType)
if (context.buildType == 'buildDefinition') {
buildDefinition(context.buildDefinition)
} else {
buildWorkspace(context.buildWorkspace)
}
avoidUsingToolkit(false)
}
}
}
@@ -0,0 +1,43 @@
package javaposse.jobdsl.dsl.helpers.scm

import javaposse.jobdsl.dsl.Context
import javaposse.jobdsl.dsl.JobManagement

/**
* DSL context for the
* <a href="https://wiki.jenkins-ci.org/display/JENKINS/Team+Concert+Plugin">Team Concert Plugin</a>.
*/
class RTCContext implements Context {
private final JobManagement jobManagement

String buildType
String buildDefinition
String buildWorkspace
String credentialsId
boolean overrideGlobal
int timeout
String buildTool
String serverURI

RTCContext(JobManagement jobManagement) {
this.jobManagement = jobManagement
}

void buildDefinition(String buildDefinition) {
this.buildDefinition = buildDefinition
this.buildType = 'buildDefinition'
}

void buildWorkspace(String buildWorkspace) {
this.buildWorkspace = buildWorkspace
this.buildType = 'buildWorkspace'
}

void connection(String buildTool, String credentials, String serverURI, int timeout) {
this.overrideGlobal = true
this.buildTool = buildTool
this.credentialsId = jobManagement.getCredentialsId(credentials)
this.serverURI = serverURI
this.timeout = timeout
}
}
@@ -1148,4 +1148,90 @@ class ScmContextSpec extends Specification {
useTimeRule[0].value() == false
}
}

def 'call rtc without build definition or workspace'() {
when:
context.rtc {
}

then:
thrown(IllegalArgumentException)
}

def 'call rtc with build definition'() {
when:
context.rtc {
buildDefinition('buildDEF')
}

then:
context.scmNode != null
with(context.scmNode) {
attributes()['class'] == 'com.ibm.team.build.internal.hjplugin.RTCScm'
children().size() == 5
overrideGlobal[0].value() == false
timeout[0].value() == 0
buildType[0].value() == 'buildDefinition'
buildDefinition[0].value() == 'buildDEF'
avoidUsingToolkit[0].value() == false
}
}

def 'call rtc with build workspace'() {
when:
context.rtc {
buildWorkspace('buildWS')
}

then:
context.scmNode != null
with(context.scmNode) {
attributes()['class'] == 'com.ibm.team.build.internal.hjplugin.RTCScm'
children().size() == 5
overrideGlobal[0].value() == false
timeout[0].value() == 0
buildType[0].value() == 'buildWorkspace'
buildWorkspace[0].value() == 'buildWS'
avoidUsingToolkit[0].value() == false
}
}

def 'call rtc with connection override'() {
setup:
mockJobManagement.getCredentialsId('absd_credential') >> '0815'

when:
context.rtc {
buildDefinition('buildDEF')
connection('4.0.7', 'absd_credential', 'https//uri.com/ccm', 480)
}

then:
context.scmNode != null
with(context.scmNode) {
attributes()['class'] == 'com.ibm.team.build.internal.hjplugin.RTCScm'
children().size() == 8
overrideGlobal[0].value() == true
buildTool[0].value() == '4.0.7'
serverURI[0].value() == 'https//uri.com/ccm'
timeout[0].value() == 480
credentialsId[0].value() == '0815'
buildType[0].value() == 'buildDefinition'
buildDefinition[0].value() == 'buildDEF'
avoidUsingToolkit[0].value() == false
}
}

def 'rtc validates single SCM'() {
when:
context.rtc {
buildDefinition('foo')
}
context.rtc {
buildDefinition('bar')
}

then:
thrown(IllegalStateException)
}
}

0 comments on commit 7a24029

Please sign in to comment.