Jenkins set github commit status

I see that the command is being called in the logs, but on GitHub it does not display the status.

[Set GitHub commit status (universal)] PENDING on repos [] (sha:47ccf20) with context:api 

Webhook-url works correctly and notifies Jenkins when to build.

I also have a GitHub server setup and test connection.

Any ideas on what I might be missing in the setup?

I followed the steps in this question but didn't get anything that could be shown on github: Show Jenkins current state based on GitHub repository

+10
source share
3 answers

if you follow the steps indicated in the shared link, you may have missed the critical step after step 9 ( Set the status of the Github commit ), which should select the second option in the Status section under What , as shown below:

Post-build action -> Set Github commit status (universal)

This will allow you to send default status messages (error, failure, success, wait) for each assembly. When choosing the first option, you will need to manually determine which status you want to send back (by default this is not so, and may explain why you are not receiving anything).

Also, make sure your payload URL in the Webhook section of Github is configured correctly with your generated token. I think you did well anyway.

Payload Configuration

You can choose. Let me select individual events to have more control over what Jenkins can send, but be sure to check the repo option : status . Hope this helps.

+21
source

For debugging, use the CLI command below to check if your access token can set status on GitHub for any PR dummy_test.

 curl "https://api.github.com/repos/[organization name]/[repo name]/statuses/[commit id]?access_token=[GitHub access token]" -H "Content-Type: application/json" -X POST -d "{\"state\": \"success\", \"description\": \"Build Successful \", \"target_url\": \"[jenkins job url]\", \"context\": \"[Job name]\" }" 

PS: remove the square brackets

0
source

Add the line below to your README.md and change both URLs according to your jenkins project.

 [![Build Status](https://jenkins../..project/lastBuild/buildStatus)](https://jenkins../..project/lastBuild/) 
-one
source

Source: https://habr.com/ru/post/1015019/


All Articles