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

Pipeline does not run, variables are not resolved. #208

Closed jcstorino closed 2 years ago

jcstorino commented 2 years ago

Version report

Jenkins and plugins versions report:

Jenkins: 2.301
OS: Linux - 5.1.0-1.el7.elrepo.x86_64
---
jjwt-api:0.11.2-9.c8b45b8bb173
sshd:3.0.3
jdk-tool:1.5
cloudbees-folder:6.15
trilead-api:1.0.13
command-launcher:1.6
antisamy-markup-formatter:2.1
handlebars:3.0.8
structs:1.23
workflow-step-api:2.23
token-macro:2.15
build-timeout:1.20
momentjs:1.1.1
credentials:2.5
bouncycastle-api:2.20
ssh-credentials:1.19
jaxb:2.3.0.1
plain-credentials:1.7
ace-editor:1.1
credentials-binding:1.26
scm-api:2.6.4
workflow-api:2.46
timestamper:1.13
script-security:1.77
gradle:1.36
plugin-util-api:2.3.0
pipeline-milestone-step:1.3.2
font-awesome-api:5.15.3-3
popper-api:1.16.1-2
jsch:0.1.55.2
jquery3-api:3.6.0-1
bootstrap4-api:4.6.0-3
snakeyaml-api:1.29.1
jackson2-api:2.12.3
git-client:3.7.2
echarts-api:5.1.2-2
pipeline-input-step:2.12
display-url-api:2.3.5
workflow-support:3.8
checks-api:1.7.0
git-server:1.9
junit:1.51
pipeline-stage-step:2.5
matrix-project:1.19
pipeline-graph-analysis:1.11
resource-disposer:0.16
ws-cleanup:0.39
ant:1.11
branch-api:2.6.4
durable-task:1.37
workflow-durable-task-step:2.39
workflow-scm-step:2.13
workflow-cps:2.92
workflow-job:2.41
apache-httpcomponents-client-4-api:4.5.13-1.0
mailer:1.34
workflow-basic-steps:2.23
pipeline-rest-api:2.19
pipeline-stage-view:2.19
pipeline-build-step:2.13
generic-webhook-trigger:1.74
ssh-slaves:1.32.0
lockable-resources:2.11
workflow-aggregator:2.6
okhttp-api:3.14.9
github-api:1.123
popper2-api:2.5.4-2
github:1.33.1
bootstrap5-api:5.0.1-2
pipeline-github-lib:1.0
matrix-auth:2.6.7
pam-auth:1.6
gitlab-plugin:1.5.20
pipeline-stage-tags-metadata:1.8.5
caffeine-api:2.9.1-23.v51c4e2c879c8
email-ext:2.83
pipeline-model-api:1.8.5
pipeline-model-extensions:1.8.5
workflow-multibranch:2.26
workflow-cps-global-lib:2.21
github-branch-source:2.11.1
git:4.7.2
pipeline-model-definition:1.8.5
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Reproduction steps

image

image

Unable to resolve label_title with JSONPath $labels[*].title in {"object_kind":"issue","event_type":"issue","user":{"id":1,"name":"Administrator","username":"root","avatar_url":"https://secure.gravatar.com/avatar/9d088a0412637eb0d00f4fd9ae9a1568?s=80\u0026d=identicon","email":"keynes.fernandes@credip.com.br"},"project":{"id":61,"name":"credipnet","description":"","web_url":"https://git.credip.coop.br/java/credipnet","avatar_url":null,"git_ssh_url":"git@git.credip.coop.br:java/credipnet.git","git_http_url":"https://git.credip.coop.br/java/credipnet.git","namespace":"java","visibility_level":0,"path_with_namespace":"java/credipnet","default_branch":"main","ci_config_path":null,"homepage":"https://git.credip.coop.br/java/credipnet","url":"git@git.credip.coop.br:java/credipnet.git","ssh_url":"git@git.credip.coop.br:java/credipnet.git","http_url":"https://git.credip.coop.br/java/credipnet.git"},"object_attributes":{"author_id":1,"closed_at":null,"confidential":false,"created_at":"2021-07-09 18:28:51 UTC","description":"Issue de Teste\n\n\n (╯°□°)╯︵ ┻━┻","discussion_locked":null,"due_date":null,"id":351,"iid":219,"last_edited_at":"2021-07-09 20:20:16 UTC","last_edited_by_id":1,"milestone_id":null,"moved_to_id":null,"duplicated_to_id":null,"project_id":61,"relative_position":-5678,"state_id":1,"time_estimate":0,"title":"Teste de Pipeline de Validação.","updated_at":"2021-07-10 00:12:03 UTC","updated_by_id":1,"url":"https://git.credip.coop.br/java/credipnet/-/issues/219","total_time_spent":0,"human_total_time_spent":null,"human_time_estimate":null,"assignee_ids":[],"assignee_id":null,"labels":[{"id":33,"title":"Aguardando Teste","color":"#eee600","project_id":61,"created_at":"2021-06-16 20:25:32 UTC","updated_at":"2021-06-28 19:19:32 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}],"state":"opened","action":"update"},"labels":[{"id":33,"title":"Aguardando Teste","color":"#eee600","project_id":61,"created_at":"2021-06-16 20:25:32 UTC","updated_at":"2021-06-28 19:19:32 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}],"changes":{"relative_position":{"previous":8790,"current":-5678},"labels":{"previous":[{"id":35,"title":"Fazendo","color":"#ed9121","project_id":61,"created_at":"2021-06-24 12:49:48 UTC","updated_at":"2021-06-24 12:49:48 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}],"current":[{"id":33,"title":"Aguardando Teste","color":"#eee600","project_id":61,"created_at":"2021-06-16 20:25:32 UTC","updated_at":"2021-06-28 19:19:32 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}]}},"repository":{"name":"credipnet","url":"git@git.credip.coop.br:java/credipnet.git","description":"","homepage":"https://git.credip.coop.br/java/credipnet"}} com.jayway.jsonpath.InvalidPathException: Illegal character at position 1 expected '.' or '[

Unable to resolve object_kind with JSONPath $object_kind in {"object_kind":"issue","event_type":"issue","user":{"id":1,"name":"Administrator","username":"root","avatar_url":"https://secure.gravatar.com/avatar/9d088a0412637eb0d00f4fd9ae9a1568?s=80\u0026d=identicon","email":"keynes.fernandes@credip.com.br"},"project":{"id":61,"name":"credipnet","description":"","web_url":"https://git.credip.coop.br/java/credipnet","avatar_url":null,"git_ssh_url":"git@git.credip.coop.br:java/credipnet.git","git_http_url":"https://git.credip.coop.br/java/credipnet.git","namespace":"java","visibility_level":0,"path_with_namespace":"java/credipnet","default_branch":"main","ci_config_path":null,"homepage":"https://git.credip.coop.br/java/credipnet","url":"git@git.credip.coop.br:java/credipnet.git","ssh_url":"git@git.credip.coop.br:java/credipnet.git","http_url":"https://git.credip.coop.br/java/credipnet.git"},"object_attributes":{"author_id":1,"closed_at":null,"confidential":false,"created_at":"2021-07-09 18:28:51 UTC","description":"Issue de Teste\n\n\n (╯°□°)╯︵ ┻━┻","discussion_locked":null,"due_date":null,"id":351,"iid":219,"last_edited_at":"2021-07-09 20:20:16 UTC","last_edited_by_id":1,"milestone_id":null,"moved_to_id":null,"duplicated_to_id":null,"project_id":61,"relative_position":-5678,"state_id":1,"time_estimate":0,"title":"Teste de Pipeline de Validação.","updated_at":"2021-07-10 00:12:03 UTC","updated_by_id":1,"url":"https://git.credip.coop.br/java/credipnet/-/issues/219","total_time_spent":0,"human_total_time_spent":null,"human_time_estimate":null,"assignee_ids":[],"assignee_id":null,"labels":[{"id":33,"title":"Aguardando Teste","color":"#eee600","project_id":61,"created_at":"2021-06-16 20:25:32 UTC","updated_at":"2021-06-28 19:19:32 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}],"state":"opened","action":"update"},"labels":[{"id":33,"title":"Aguardando Teste","color":"#eee600","project_id":61,"created_at":"2021-06-16 20:25:32 UTC","updated_at":"2021-06-28 19:19:32 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}],"changes":{"relative_position":{"previous":8790,"current":-5678},"labels":{"previous":[{"id":35,"title":"Fazendo","color":"#ed9121","project_id":61,"created_at":"2021-06-24 12:49:48 UTC","updated_at":"2021-06-24 12:49:48 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}],"current":[{"id":33,"title":"Aguardando Teste","color":"#eee600","project_id":61,"created_at":"2021-06-16 20:25:32 UTC","updated_at":"2021-06-28 19:19:32 UTC","template":false,"description":null,"type":"ProjectLabel","group_id":null}]}},"repository":{"name":"credipnet","url":"git@git.credip.coop.br:java/credipnet.git","description":"","homepage":"https://git.credip.coop.br/java/credipnet"}} com.jayway.jsonpath.InvalidPathException: Illegal character at position 1 expected '.' or '[

Results

Expected result:

Expected Pipeline to run when rule is true.

Actual result:

Pipeline doesn't run, I can't get the variable resolution logs and I get this error in the Jenkis log, listed above.

tomasbjerre commented 2 years ago

The problem is Unable to resolve object_kind with JSONPath $object_kind in. And specifically $object_kind which is not a valid JSONPath. Your screenshot shows $.object_kind, with the dot, which is valid.

Do you configure the plugin with properties in a pipeline script? Or manually in the job?

jcstorino commented 2 years ago

Hello Tomas, I believe I have found the problem, my mistake! One of the patches referenced is an array, so researching further, I found that the extension adds _n to the variable name, so I made it work !

Thanks a Lot !      http://www.jcstorino.com.br/ JULIO CESAR STORINO / Consultor Especialista e-mail: @. @.> tel: (11) 94955-9591

Em 12 de jul. de 2021, à(s) 15:43, Tomas Bjerre @.***> escreveu:

The problem is Unable to resolve object_kind with JSONPath $object_kind in. And specifically $object_kind which is not a valid JSONPath. Your screenshot shows $.object_kind, with the dot, which is valid.

Do you configure the plugin with properties in a pipeline script? Or manually in the job?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jenkinsci/generic-webhook-trigger-plugin/issues/208#issuecomment-878508126, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVHLPQQM2GWIM7VUAYYVX3TXMZVXANCNFSM5AG2KVWA.