Azure-pipelines-tasks: GitHub status checks not updated by manual builds

Created on 13 Oct 2017  路  10Comments  路  Source: microsoft/azure-pipelines-tasks

Environment

  • Server: VSTS
  • Account name: empactis
  • Team project name: various
  • Build definition name/build number: multiple
  • Agent: Hosted VS2017

Issue Description

We are using GitHub as our source repository and VSTS for builds. We are using GitHub status checks so that we know if our GitHub pull requests are building successfully. This works fine if the build is successful but if we need to queue a build manually then the GitHub status check isn't being updated once the manual build finishes.

An example of when this is necessary is if a build is failing due to a change required in the build definition rather than the code itself.

Error logs

N/A

CrossPlatform

Most helpful comment

this still doesn't work.

All 10 comments

Actually, the problem seems to be worse than that. I committed a small code change, the build ran automatically, but the status check still didn't get updated. Is the attempt to update the status logged anywhere?

Thanks for the feedback. We will investigate.

It's possibly only affecting older pull requests. I'll try and work out a pattern and let you know.

We have made a fix and it will be rolled out with next release in a few weeks.

@yacaovsnc Could a rebuild be triggered straight from failed build status in github? This would be convenient when the reason of the fail is in the VSTS and not in the code itself.

@tonilaukka This would be a feature request for GitHub team, but it would be awesome if they implemented that. Now the closest thing I can think of is to redeliver the webhook event (if you are the repo admin: Settings -> Webhooks -> find the event and redeliver), otherwise we have to make some change to the PR (close/reopen/update code) so GitHub would deliver the event. :-(

@yacaovsnc I have to try redelivering the webhook. But this is not optimal since you need the admin rights. Currently we start rebuild from VSTS and after successful build someone with admin priviledges merges the PR cause build status haven't updated. But did I understand correctly that this update will fix this flow?

@tonilaukka the fix we pushed will allow a manual build from VSTS to update the commit status on GitHub. However there are some complications here due to the way GitHub protects PullRequest. Consider this PR scenario:

  1. base: master w/ commit sha: A
  2. merge from: topic_branch w/ commit sha: B
  3. refs/pull/1/merge created with commit sha: C, which is a merge commit of B into A

For a PR build, we should build sha C. However GitHub display the status of sha B, and use that to block PRs. When manually trigger a build, if we trigger the build with sha B, then this PR will be unblocked, but that's probably not what we want. If we trigger the build with sha C, this PR will still be blocked.

With PR events from GitHub, we can figure out sha B from the event and since we know it came from a pullrequest, we can "hack" the status. If this is a normal manual build, we simply update the status of the triggering commit.

Sorry but it seems the flow you described still doesn't work as expected. We need to try some other options.

https://developercommunity.visualstudio.com/content/problem/131207/github-commit-status-is-not-updated-if-build-is-tr.html

This same problem is tracked in multiple places, I am closing this issue here because the issue is not a task issue per se. If anyone is experiencing this issue, please update status on the referenced link.

this still doesn't work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

syltaxue picture syltaxue  路  3Comments

MichaelWhiteCodingForFun picture MichaelWhiteCodingForFun  路  3Comments

pharring picture pharring  路  3Comments

ThomasBarnekow picture ThomasBarnekow  路  3Comments

jared-hexagon picture jared-hexagon  路  3Comments