jenkinsci / generic-webhook-trigger-plugin

Can receive any HTTP request, extract any values from JSON or XML and trigger a job with those values available as variables. Works with GitHub, GitLab, Bitbucket, Jira and many more.
https://plugins.jenkins.io/generic-webhook-trigger
404 stars 159 forks source link

Skipped parameter as it is undefined #261

Closed monwolf closed 7 months ago

monwolf commented 1 year ago

When reporting a bug, please try to provide as much information as possible.

This bug isn't related with a build so information about the build is not provided, we are getting this warnings when we start jenkins:

Skipped parameter `jenkins-generic-webhook-trigger-plugin_uuid` as it is undefined on `JOB1` (#1,502). Set `-Dhudson.model.ParametersAction.keepUndefinedParameters=true` to allow undefined parameters to be injected as environment variables or `-Dhudson.model.ParametersAction.safeParameters=[comma-separated list]` to whitelist specific parameter names, even though it represents a security breach or `-Dhudson.model.ParametersAction.keepUndefinedParameters=false` to no longer show this message.
Skipped parameter `jenkins-generic-webhook-trigger-plugin_uuid` as it is undefined on `JOB2` (#650). Set `-Dhudson.model.ParametersAction.keepUndefinedParameters=true` to allow undefined parameters to be injected as environment variables or `-Dhudson.model.ParametersAction.safeParameters=[comma-separated list]` to whitelist specific parameter names, even though it represents a security breach or `-Dhudson.model.ParametersAction.keepUndefinedParameters=false` to no longer show this message.

Jobs are created with a dsl script:


        dslFactory.pipelineJob(jobName) {
            logRotator {
                numToKeep(20)
                artifactNumToKeep(1)
            }
            triggers {
                genericTrigger {
                    genericVariables {
                        genericVariable {
                            key("event")
                            value("\$.eventKey")
                            expressionType("JSONPath")
                            regexpFilter("")
                        }
                        genericVariable {
                            key("commit")
                            value("\$.changes[0].toHash")
                            expressionType("JSONPath")
                            regexpFilter("")
                        }
                        genericVariable {
                            key("author")
                            value("\$.actor.displayName")
                            expressionType("JSONPath")
                            regexpFilter("")
                        }
                        genericVariable {
                            key("branch")
                            value("\$.changes[0].ref.displayId")
                            expressionType("JSONPath")
                            regexpFilter("") //Optional, defaults to empty string
                        }
                        genericVariable {
                            key("gitrepo_ssh")
                            value("\$.repository.links.clone[?(@.name =~ /ssh/)].href")
                            expressionType("JSONPath")
                            regexpFilter("")
                        }

                        genericVariable {
                            key("type")
                            value("\$.changes[0].ref.type")
                            expressionType("JSONPath")
                            regexpFilter("")
                        }
                        genericVariable {
                            key("changestype")
                            value("\$.changes[0].type")
                            expressionType("JSONPath")
                            regexpFilter("")
                        }

                    }
                    causeString('Generic Cause')
                    token(tokenHash)
                    regexpFilterExpression('^(UPDATE_BRANCH_master|ADD_TAG_v?(\\d+(?:\\.\\d+)*))$')
                    regexpFilterText('$changestype_$type_$branch')
                }
            }
            definition {
                cps {
                    script(pipelineFile)
                    sandbox()
                }
            }
        }
juanpablo-santos commented 1 year ago

Hi,

we're getting the same warning at startup for all the jobs, in our case with:

jobs are just simple pipeline jobs, triggered by a post-commit webhook, nothing special about them. It's possible that we've been having this issue before, but we've noticed it when upgrading to latest jenkins LTS

EDIT: I stand corrected, we're seeing this warning every time a job is launched

tomasbjerre commented 1 year ago

Was probably introduced in 1.86.0.

Sounds like a minor issue, only a log entry. And it seems that log entry suggests how to ger rid of the entry.

191801737 commented 1 year ago

Hi,

we're getting the same warning plugin version:[1.86.3] jenkins version: [Jenkins 2.401.1] Is there a good way to deal with this

samveen commented 10 months ago

The same warning triggers during job runs:

Skipped parameter `jenkins-generic-webhook-trigger-plugin_uuid` as it is undefined on `pipeline-gke` (#30). 

In the case above, for build 30 of my pipeline, this showed up 48 times for 1 build of my pipeline of 4 stages and 2 steps per stage at maximum.

tomasbjerre commented 10 months ago

I dont really see why this is an issue. Is the logging not explaining what you need to do if you dont want the logging? What is the real issue here?

samveen commented 10 months ago

From what I understand of the message, the real issue seems to be that something in jenkins is looking for jenkins-generic-webhook-trigger-plugin_uuid and the generic-webhook-trigger-plugin isn't setting such a value.

tomasbjerre commented 10 months ago

The plugin is setting the value, but the parameter does not exist. The cause of this is: https://github.com/jenkinsci/generic-webhook-trigger-plugin/commit/aa6370b2930ac940ad7a210bff56ecf1aa129c2a#diff-6ebf01ab722c8d9a68113de0b3bd48bc7ec77b0673c6d0df242b0a919082b0ccR29

But still: what is the issue? How is this a problem?

samveen commented 10 months ago

( Thank you for the commit ref, though I got it via git diff generic-webhook-trigger-1.85.2 generic-webhook-trigger-1.86.0)

As to why I (and probably others) see this as an issue:

To solve this, where should such a parameter be created so that the parameter value gets matched to the parameter?

tomasbjerre commented 10 months ago

One way of getting rid of the logging is probably to make the job parameterized add add a string parameter named "jenkins-generic-webhook-trigger-plugin_uuid".

As a user of Jenkins I would think such a parameter looks strange. Seems confusing for a user.

Another alternative would be to disable the feature. That is, by checking the "Allow several triggers per build" option.

Another way, the correct way in my opinion is to do what the logging is telling you to do. You can google how to add such properties.