뭔가 도와주세요. 두 가지에서
당신은 구성
- 소스 코드 - 관리로 작업을 시작 : 서브
- 체크 아웃 전략 : 가능
만큼 사용 'SVN 업데이트' 그런 다음 Groovy 시스템 스크립트를 시작하십시오.
import hudson.model.*
import hudson.util.*
import hudson.scm.*
// work with current build
// (does only work as groovy system script, not in the Jenkins shell)
def build = Thread.currentThread()?.executable
// for testing, comment the line above and uncomment the job line
// and one of the build lines - use specific build (last build or build by number)
//def job = hudson.model.Hudson.instance.getItem("<your job name>")
//def build = job.getLastBuild()
//def build = job.getBuildByNumber(162)
// get ChangesSets with all changed items
def changeSet= build.getChangeSet()
def items = changeSet.getItems()
그러나이 단계에서 파일은 다음과 같습니다. 빌드 머신에서 준비! changeSet에는 svn 업데이트에 포함 된 모든 항목이 포함되어 있습니다. 따라서 경로를 사용하여 처리하십시오. 예를 들어 변경된 파일 당 Jenkins 작업을 다음과 같이 시작할 수 있습니다.
void startJenkinsJob(jobName, param)
{
// Start another job
def job = Hudson.instance.getJob(jobName)
def anotherBuild
try {
def params = [
new StringParameterValue('StringParam', param),
]
def future = job.scheduleBuild2(0, new Cause.UpstreamCause(build), new ParametersAction(params))
println "Waiting for the completion of " + HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName)
anotherBuild = future.get()
} catch (CancellationException x) {
throw new AbortException("${job.fullDisplayName} aborted.")
}
println HyperlinkNote.encodeTo('/' + anotherBuild.url, anotherBuild.fullDisplayName) + " completed. Result was " + anotherBuild.result
// Check that it succeeded
build.result = anotherBuild.result
if (anotherBuild.result != SUCCESS && anotherBuild.result != UNSTABLE) {
// We abort this build right here and now.
throw new AbortException("${anotherBuild.fullDisplayName} failed.")
}
}