Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated triggering result in single build #162

Closed
sgargel opened this issue May 19, 2020 · 2 comments
Closed

Repeated triggering result in single build #162

sgargel opened this issue May 19, 2020 · 2 comments

Comments

@sgargel
Copy link

sgargel commented May 19, 2020

When I repeatedly call the webhook in rapid sequence I expect to trigger multiple builds but instead only one is queued.

The pipeline prints multiple "build Cause" for each webhook call.

Jenkins ver. 2.222.3
Generic Webhook Trigger Plugin 1.67

My full pipeline output is:

Endpoint my-fooService:9182 down
Endpoint my-fooService-3:9182 down
Endpoint my-fooService-7:9182 down
Endpoint my-fooService-S:9182 down
Endpoint my-fooService-4:9182 down
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Compilazione su master in corso nello spazio di lavoro /var/lib/jenkins/workspace/SYSADMIN/prometheus_webook_my
GenericWebhookEnvironmentContributor
 Received:

{"receiver":"jenkins_prometheus_webook_my","status":"firing","alerts":[{"status":"firing","labels":{"alertname":"Server Down","instance":"my-fooService:9182","job":"fooService","service":"fooService","severity":"critical"},"annotations":{"description":"my-fooService:9182 of job fooService has been down for more than 1 minutes.","summary":"Endpoint my-fooService:9182 down"},"startsAt":"2020-05-19T10:06:42.510455176+02:00","endsAt":"0001-01-01T00:00:00Z","generatorURL":"http://my-lnx-prometheus:9090/graph?g0.expr=up+%3D%3D+0\u0026g0.tab=1","fingerprint":"3b626c6419d1cae6"}],"groupLabels":{"instance":"my-fooService:9182"},"commonLabels":{"alertname":"Server Down","instance":"my-fooService:9182","job":"fooService","service":"fooService","severity":"critical"},"commonAnnotations":{"description":"my-fooService:9182 of job fooService has been down for more than 1 minutes.","summary":"Endpoint my-fooService:9182 down"},"externalURL":"http://my-lnx-prometheus:9093","version":"4","groupKey":"{}/{job=~\"^(?:fooService)$\"}:{instance=\"my-fooService:9182\"}"}



Contributing variables:

    json = ["jenkins_prometheus_webook_my","firing",[{"status":"firing","labels":{"alertname":"Server Down","instance":"my-fooService:9182","job":"fooService","service":"fooService","severity":"critical"},"annotations":{"description":"my-fooService:9182 of job fooService has been down for more than 1 minutes.","summary":"Endpoint my-fooService:9182 down"},"startsAt":"2020-05-19T10:06:42.510455176+02:00","endsAt":"0001-01-01T00:00:00Z","generatorURL":"http://my-lnx-prometheus:9090/graph?g0.expr\u003dup+%3D%3D+0\u0026g0.tab\u003d1","fingerprint":"3b626c6419d1cae6"}],{"instance":"my-fooService:9182"},{"alertname":"Server Down","instance":"my-fooService:9182","job":"fooService","service":"fooService","severity":"critical"},{"description":"my-fooService:9182 of job fooService has been down for more than 1 minutes.","summary":"Endpoint my-fooService:9182 down"},"http://my-lnx-prometheus:9093","4","{}/{job\u003d~\"^(?:fooService)$\"}:{instance\u003d\"my-fooService:9182\"}"]
    json_0 = jenkins_prometheus_webook_my
    json_1 = firing
    json_2_0_annotations_description = my-fooService:9182 of job fooService has been down for more than 1 minutes.
    json_2_0_annotations_summary = Endpoint my-fooService:9182 down
    json_2_0_endsAt = 0001-01-01T00:00:00Z
    json_2_0_fingerprint = 3b626c6419d1cae6
    json_2_0_generatorURL = http://my-lnx-prometheus:9090/graph?g0.expr=up+%3D%3D+0&g0.tab=1
    json_2_0_labels_alertname = Server Down
    json_2_0_labels_instance = my-fooService:9182
    json_2_0_labels_job = fooService
    json_2_0_labels_service = fooService
    json_2_0_labels_severity = critical
    json_2_0_startsAt = 2020-05-19T10:06:42.510455176+02:00
    json_2_0_status = firing
    json_3_instance = my-fooService:9182
    json_4_alertname = Server Down
    json_4_instance = my-fooService:9182
    json_4_job = fooService
    json_4_service = fooService
    json_4_severity = critical
    json_5_description = my-fooService:9182 of job fooService has been down for more than 1 minutes.
    json_5_summary = Endpoint my-fooService:9182 down
    json_6 = http://my-lnx-prometheus:9093
    json_7 = 4
    json_8 = {}/{job=~"^(?:fooService)$"}:{instance="my-fooService:9182"}


[prometheus_webook_my] $ /bin/bash -xe /tmp/jenkins601696594822714523.sh
+ jq '.[2][0].labels'
+ echo
+ echo 'Alarm per Endpoint my-fooService:9182 down'
Alarm per Endpoint my-fooService:9182 down
Finished: SUCCESS

cUrl command to repeat the issue:

for a in 1 2 3  ; do curl -H "Content-Type: application/json" -X POST -d '{ "app":{ "name":"some value" }}' http://my-jenkins:8080/generic-webhook-trigger/invoke?token=sometoken ; done
@sgargel sgargel changed the title Multiple trigger result in single build Multiple triggers result in single build May 19, 2020
@sgargel sgargel changed the title Multiple triggers result in single build Repeated triggering result in single build May 19, 2020
@tomasbjerre
Copy link
Contributor

Might be solved if you add a job parameter like:
https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/sandbox/default-value-parameter.png

Name it json_2_0_fingerprint

And this plugin will populate that parameter and make the build unique, so that Jenkins will not batch multiple builds into one.

@sgargel
Copy link
Author

sgargel commented May 20, 2020

Thanks, this works!
Congratulations for the excellent work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants