나는 아주 단순해야하는 일련의 작업을 시도하지만 나에게 많은 고통을줍니다. 높은 수준에서 배열을 통해 반복하고 각 값을 자신의 배열을 반환해야하는 gradle 작업으로 전달하려고합니다. 그런 다음이 배열을 사용하여 일부 Jenkins 구성을 설정하려고합니다.배열을 반복하고 각 값을 gradle 작업에 전달하려고합니다.
나는이 작품을 만드는 여러 가지 방법을 시도하지만, 여기에 내 현재의 셋업입니다 않은 : 난 정말 젠킨스 블록이 설정되는 방법이 아니라 이미로 변경할 수 없습니다
project.ext.currentItemEvaluated = "microservice-1"
task getSnapshotDependencies {
def item = currentItemEvaluated
def snapshotDependencies = []
//this does a load of stuff like looping through gradle dependencies,
//which means this really needs to be a gradle task rather than a
//function etc. It eventually populates the snapshotDependencies array.
return snapshotDependencies
}
jenkins {
jobs {
def items = getItems() //returns an array of projects to loop through
items.each { item ->
"${item}-build" {
project.ext.currentItemEvaluated = item
def dependencies = project.getSnapshotDependencies
dsl {
configure configureLog()
//set some config here using the returned dependencies array
}
}
}
}
성숙 했으므로 가능하다면 그 구조 안에서 일해야합니다.
나는 프로젝트 변수를 사용하여 변수를 작업에 전달하려고 시도했다. 문제는 젠킨스가 차단되기 전에 작업이 평가되는 것으로 보이며 새롭게 설정된 currentItemEvaluated
변수로 작업을 다시 올바르게 평가하는 방법을 찾지 못합니다.
내가 시도 할 수있는 다른 아이디어가 있습니까?