0

How to reference a secret in a GitHub webhook payload URL?

The link we followed: https://www.cloudbooklet.com/jenkins-how-to-build-a-specific-branch-on-github/

We are using Generic Webhooks Trigger Plugin to trigger automatic builds when a commit is pushed to the repository, everything is working fine when the token value is passed directly to the GitHub webhook payload URL

https://JENKINS_URL/generic-webhook-trigger/invoke?token=YOUR_TOKEN

But we wanted to reference the token value through the secret shown in the image below

enter image description here

I did try to reference the secret value in the below way

http://JENKINS_URL/generic-webhook-trigger/invoke?token=${{ Secret }}

But it's not picking up that secret value instead it I think sees ${{Secret }} as the token value. The response is the below one for the above way of passing/referencing secret/token value.

{"jobs":null,"message":"Did not find any jobs with GenericTrigger configured! If you are using a token, you need to pass it like ...trigger/invoke?token=TOKENHERE. If you are not using a token, you need to authenticate like http://user:passsword@example.org/generic-webhook... "}

So what would be the right way of referencing the secret of the token value for this particular use-case?

devops-admin
  • 1,447
  • 1
  • 15
  • 26

0 Answers0