我尝试根据作业参数创建使用不同Jenkinsbuild文件的Jenkins管道作业。有没有办法在执行作业期间加载Jenkins构建文件,如:
class UpdatePreviousDetails() {
var CompanyName: String? = null
var Designation: String? = null
var DateOfJoin: Date? = null
var DateOfLeaving: Date? = null
var SectorPreviouslyWorked: String? = null
var Id: Int? = null
constructor(
CompanyName: String?,
Designation: String?,
DateOfJoin: Date?,
DateOfLeaving: Date?,
SectorPreviouslyWorked: String?,
Id: Int?
) : this() {
this.CompanyName = CompanyName
this.Designation = Designation
this.DateOfJoin = DateOfJoin
this.DateOfLeaving = DateOfLeaving
this.SectorPreviouslyWorked = SectorPreviouslyWorked
this.Id = Id
}
}
这会很有用......
答案 0 :(得分:3)
我发现解决方案非常简单。 Jenkins只需要加载文件
node {
stage("Determine build file") {
String jenkinsFile = /path/to/Jenkins/build/file
}
// Here the Jenkins build file is loaded and executed
load jenkinsFile
}