Skip to content

Setting commit status on MRs from other repos fails with 404

Current status 2022-08-04

This issue has not had recent interaction, before close it we want to validate this bug is still happening on gitlab.com or the latest stable release.

Problem to solve

When my build system builds a MR from another repo I'm unable to update the build status in the MR. GitLab responds with 404 which kinda make sense as the commits are not really in the repo yet, I suppose. But how is it supposed to work? I can't find any documentation explaining this. Should some other API be used for these cases?

It works perfectly fine if it's a merge-request from the same repo.

I've included the failing POST and the original merge_request-webhook below:

Thanks, Andreas

POSTDATA: {"id":"andoma\/btest","sha":"60d62ea67b9f1d1ea0b7692d8d65746fe69cb911","state":"success","target_url":"http:\/\/doozertest.io:9000\/build\/FvSqX3iO88","description":"Build done","context":"doozer\/target\/osx"}
* Found bundle for host gitlab.com: 0x60300011adf0 [can pipeline]
* Re-using existing connection! (#0) with host gitlab.com
* Connected to gitlab.com (104.210.2.228) port 443 (#0)
> POST /api/v3/projects/andoma%2Fbtest/statuses/60d62ea67b9f1d1ea0b7692d8d65746fe69cb911 HTTP/1.1
Host: gitlab.com
User-Agent: doozer
Accept: */*
Content-Type: application/json
Authorization: Bearer XXXX
Content-Length: 210

* upload completely sent off: 210 out of 210 bytes
< HTTP/1.1 404 Not Found
< Server: nginx
< Date: Sun, 20 Nov 2016 19:13:46 GMT
< Content-Type: application/json
< Content-Length: 49
< Cache-Control: no-cache
< Vary: Origin
< X-Request-Id: 05311fd6-06a8-44c6-b401-716a13d4be5e
< X-Runtime: 0.110147
<
* Connection #0 to host gitlab.com left intact
Reply: {"message":"404 References for commit Not Found"}
object_kind: "merge_request"
user: {
  name: "Andreas Smas"
  username: "andoma2"
  avatar_url: "https://secure.gravatar.com/avatar/d0001b744d041b2e311b8fddae7677d7?s=80&d=identicon"
}
project: {
  name: "btest"
  description: ""
  web_url: "https://gitlab.com/andoma/btest"
  avatar_url: null
  git_ssh_url: "git@gitlab.com:andoma/btest.git"
  git_http_url: "https://gitlab.com/andoma/btest.git"
  namespace: "andoma"
  visibility_level: 20
  path_with_namespace: "andoma/btest"
  default_branch: "master"
  homepage: "https://gitlab.com/andoma/btest"
  url: "git@gitlab.com:andoma/btest.git"
  ssh_url: "git@gitlab.com:andoma/btest.git"
  http_url: "https://gitlab.com/andoma/btest.git"
}
object_attributes: {
  id: 1260264
  target_branch: "master"
  source_branch: "feature4"
  source_project_id: 2041340
  author_id: 853760
  assignee_id: null
  title: "Feature4"
  created_at: "2016-11-20 18:52:54 UTC"
  updated_at: "2016-11-20 19:13:38 UTC"
  milestone_id: null
  state: "opened"
  merge_status: "unchecked"
  target_project_id: 2037706
  iid: 5
  description: ""
  position: 0
  locked_at: null
  updated_by_id: null
  merge_error: null
  merge_params: {
    force_remove_source_branch: "0"
  }
  merge_when_build_succeeds: false
  merge_user_id: null
  merge_commit_sha: null
  deleted_at: null
  approvals_before_merge: null
  rebase_commit_sha: null
  in_progress_merge_commit_sha: null
  lock_version: 0
  source: {
    name: "btest"
    description: ""
    web_url: "https://gitlab.com/andoma2/btest"
    avatar_url: null
    git_ssh_url: "git@gitlab.com:andoma2/btest.git"
    git_http_url: "https://gitlab.com/andoma2/btest.git"
    namespace: "andoma2"
    visibility_level: 20
    path_with_namespace: "andoma2/btest"
    default_branch: "master"
    homepage: "https://gitlab.com/andoma2/btest"
    url: "git@gitlab.com:andoma2/btest.git"
    ssh_url: "git@gitlab.com:andoma2/btest.git"
    http_url: "https://gitlab.com/andoma2/btest.git"
  }
  target: {
    name: "btest"
    description: ""
    web_url: "https://gitlab.com/andoma/btest"
    avatar_url: null
    git_ssh_url: "git@gitlab.com:andoma/btest.git"
    git_http_url: "https://gitlab.com/andoma/btest.git"
    namespace: "andoma"
    visibility_level: 20
    path_with_namespace: "andoma/btest"
    default_branch: "master"
    homepage: "https://gitlab.com/andoma/btest"
    url: "git@gitlab.com:andoma/btest.git"
    ssh_url: "git@gitlab.com:andoma/btest.git"
    http_url: "https://gitlab.com/andoma/btest.git"
  }
  last_commit: {
    id: "60d62ea67b9f1d1ea0b7692d8d65746fe69cb911"
    message: "no changes
"
    timestamp: "2016-11-20T11:13:30-08:00"
    url: "https://gitlab.com/andoma/btest/commit/60d62ea67b9f1d1ea0b7692d8d65746fe69cb911"
    author: {
      name: "Andreas Smas"
      email: "andreas@lonelycoder.com"
    }
  }
  work_in_progress: false
  url: "https://gitlab.com/andoma/btest/merge_requests/5"
  action: "update"
  oldrev: "faea5510aeb5fb3fd5794329c950381280027c4f"
}
repository: {
  name: "btest"
  url: "git@gitlab.com:andoma/btest.git"
  description: ""
  homepage: "https://gitlab.com/andoma/btest"
}
Edited by James Heimbuck