jenkinsci / jenkinsci/gitlab-plugin

updateGitlabCommitStatus doesn't work with multibranch pipeline

Open
#919 5 comments 13 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

## Issue
For any multibranch pipeline job, the gitlab status isn't updated., but it works perfectly for normal pipeline jobs. The gitlab project name of this failed jobs contains group and subgroup names, separated by `/` (slash). This slash is then URL encoded by the gitlab plugin for building the request URL at gitlab site for retrieving project releated infos (ids, commits etc.) Those requests failed with `404 Not found`.
Already stumple upon #462 and #691 but I do not see that it should be an nginx@gitlab issue. I also configured the gitlab connection for the multi branch pipeline:

```
properties(currentBuild.getRawBuild().getParent().getAllProperties())
properties([disableConcurrentBuilds()])
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '5']]])
properties([[$class: 'GitLabConnectionProperty', gitLabConnection: 'gitlab']])
properties([ gitLabConnection('gitlab')] )
```

I'm wondering that for other non-multibranch-jobs, the retrieving of the project ids from gitlab returns successfully and those ids are used for the URLs afterwards. For the failing multibranch jobs, this retrieving failed and then this encoded project name

### Context
- **Gitlab plugin version**: 1.5.9
- **Gitlab version**: 11.6.3
- **Jenkins version**: 2.150.1
- **Job type**: Multibranch Pipeline

### Logs & Traces
```
Apr 12, 2019 11:53:09 AM FINE com.dabsquared.gitlabjenkins.webhook.build.PushBuildAction

Notify scmSourceOwner fashion42-backend-build-multibranch about changes for https://git.todo42.de/fashion42/backend/core.git

Apr 12, 2019 11:53:16 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds

Retrieving gitlab project ids

Apr 12, 2019 11:53:16 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater addGitLabBranchBuild

Retrieving the gitlab project id from remote url https://git.todo42.de/fashion42/backend/core.git

Apr 12, 2019 11:53:16 AM FINEST com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClientBuilder

Call GitLab:
HTTP method: GET
URL: https://git.todo42.de/api/v4/user
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]

Apr 12, 2019 11:53:16 AM FINEST com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClientBuilder

Got response from GitLab:
URL: https://git.todo42.de/api/v4/user
Status: 200 OK

...

Apr 12, 2019 11:53:16 AM FINEST com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClientBuilder

Call GitLab:
HTTP method: GET
URL: https://git.todo42.de/api/v4/projects/fashion42%2Fbackend%2Fcore/repository/commits/8627c5e2853389a16cceae27c1ba2af4bc5c177a
Request headers: [
Accept = [application/json],
PRIVATE-TOKEN = [****FILTERED****]
]

Apr 12, 2019 11:53:16 AM FINEST com.dabsquared.gitlabjenkins.gitlab.api.impl.ResteasyGitLabClientBuilder

Got response from GitLab:
URL: https://git.todo42.de/api/v4/projects/fashion42%2Fbackend%2Fcore/repository/commits/8627c5e2853389a16cceae27c1ba2af4bc5c177a
Status: 404 Not Found

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.