I have the generic Variables like one below in my jenkins pipeline
parameters {
stringParam('DOCKER_FILE', "", "Select the Dockerfile Directory [dirname] to be built")
}
genericVariable {
key("DOCKER_FILE") //maven-mongodb
value("\$.head_commit.['modified','added'][*]") //all directory names
regexpFilter("/Dockerfile")
expressionType("JSONPath")
}
But when I see Github push payload body I can see resolved variables as "DOCKER_FILE":"[]" and "DOCKER_FILE_0":"[]"...This is because I have added 2 (modified,added) in which "DOCKER_FILE" will have all values while _0 and _1 will have their own like
Scenario:
In my Jenkins Pipeline
For Manual Trigger -> Parameter I have is only DOCKER_FILE and "DOCKER_FILE_0" is undefined
For webhook trigger -> Through Generic Variables I will have both DOCKER_FILE and DOCKER_FILE_0
Query:
**How can I use the value of "DOCKER_FILE_0" in my pipeline for manual trigger?
Or else How can I get "maven-mongodb/file1.txt" from DOCKER_FILE without [] Below are my contributing variables **
During Webhook trigger my Contributing variables:
DOCKER_FILE = ["maven-mongodb/file1.txt","maven-mongodb/file2.txt"]
DOCKER_FILE_0 = maven-mongodb/file1.txt
DOCKER_FILE_1 = maven-mongodb/file2.txt
ie.DOCKER_FILE_0 will be automatically created during push event with generic webhook trigger