0

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

https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/src/test/resources/org/jenkinsci/plugins/gwt/bdd/github/github-push-get-changed-files.feature

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

kc7
  • 113
  • 4
  • 18
  • Is your question, "How can I get a value populated by a Github Push Notif plugin on a push notif also populated when my trigger is not a push notif?" – MaratC Mar 10 '21 at 06:22
  • When I push ,webhook triggers means I will get DOCKER_FILE & DOCKER_FILE_0..But for Manually trigger the job I have defined only DOCKER_FILE parameter..So the other one will be undefined and cant use it in pipeline – kc7 Mar 10 '21 at 06:48
  • @MaratC Kindly check the updated description of my question – kc7 Mar 10 '21 at 06:57

0 Answers0