jenkinsci / jenkinsci/gitlab-plugin

Latest commit is not set in gitlabAfter param if multiple commits while build is running

Open
#1,200 3 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

### Version report

Jenkins and plugins versions report:

```
Jenkins: 2.303.1
OS: Linux - 3.10.0-1160.6.1.el7.x86_64
---
...
git:4.8.2
git-changelog:3.11
git-client:3.9.0
git-server:1.10
...
gitlab-api:1.0.6
gitlab-branch-source:1.5.9
gitlab-oauth:1.12
gitlab-plugin:1.5.24
...
scm-api:2.6.5
...
```

### Reproduction steps
- We have a Jenkins job that does not allow concurrent builds
- It is triggered by a gitlab webhook on push action
- While a build is running, push two times to the repo with the webhook.

### Results

Expected result:

If multiple pushes happens while a build is running, only one build is queued, but when it runs the `gitlabAfter` param is set to commit of **last** push. That is, the latter trigger should supersede the former.

Actual result:

`gitlabAfter` is set to commit of **first** push.
No build at all is triggered for second push. That change is "pending" until a build is triggered next time.

I believe this is incorrect behaviour.

I also commented in https://github.com/jenkinsci/gitlab-plugin/issues/841 which sounds similar, but I wanted to have a new clean issue for this problem.

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.