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

How do I customize the structure of response? #178

Open
Bpazy opened this issue Aug 27, 2020 · 4 comments
Open

How do I customize the structure of response? #178

Bpazy opened this issue Aug 27, 2020 · 4 comments

Comments

@Bpazy
Copy link

Bpazy commented Aug 27, 2020

Similar to #113 .

My purpose is to return the following payload (docker hub webhook expected response):

{
  "state": "success",
  "description": "387 tests PASSED",
  "context": "Continuous integration by Acme CI",
  "target_url": "http://ci.acme.com/results/afd339c1c3d27"
}

But the response structure of this plugin does not seem to be customizable. Are there any related tutorials or development plans?

@tomasbjerre
Copy link
Contributor

So not a static custom response but something that is dynamic. Something that can be sent after the build is completed.

No such feature is implemented. PR:s are welcome but I think this would be hard to do, if possible.

@Bpazy Bpazy changed the title How do I customize the structure and of response? How do I customize the structure of response? Aug 28, 2020
@caquino
Copy link

caquino commented Aug 10, 2023

Regarding the response payload, I see it contains an url field pointing to the /queue/item/<id>. Is it possible if quiet-period is set to 0 that, instead of returning the queue URL to respond with the url for the job like /job/<job_name>/<id>?

This would allow me to log the job URL on the system triggering the webhook to simplify troubleshooting.

@tomasbjerre
Copy link
Contributor

Dont you have all the things you need to construct the URL yourself?

{"jobs":{"refjob":{"regexpFilterExpression":"","triggered":true,"resolvedVariables":{"ref":""},"regexpFilterText":"","id":1,"url":"queue/item/1/"}},"message":"Triggered jobs."}

@caquino
Copy link

caquino commented Aug 10, 2023

First of all, thanks for such a quick response!

Maybe I'm missing something here, so feel free to correct me if my understanding is incorrect, but to be able to map from /queue/item/1/ to a JOB URL, it would require the webhook originator system to issue another request to Jenkins to query the/queue/item/1/api/{xml,json} endpoint and retrieve the job information.

This is not a problem, but still, it would require extra logic on the webhook source system, another request to Jenkins, and also credentials for that system to access the /queue/item/1/api/{xml,json}, which sadly is not viable for us.

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

3 participants