Wrong pipline status in commit view

Summary

The commit status is contradictory when there are multiple pipeline results for one commit (group/project/commit/$sha/pipelines)

Steps to reproduce

  • Create a merge request
  • Pipeline fails
  • Retrigger build
  • Pipeline succeeds

What is the current bug behavior?

The pipeline status shows contradictory results for the latest pipeline.

What is the expected correct behavior?

The status should show the correct result of the latest pipeline.

Relevant logs and/or screenshots

commit_with_two_pipelines

As you can see it shows (wrongly) in the top that pipeline 1262 has failed while below it shows that it passed.

Output of checks

Results of GitLab environment info

sudo gitlab-rake gitlab:env:info

System information
System:         Ubuntu 16.04
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.3.3p222
Gem Version:    2.6.6
Bundler Version:1.13.7
Rake Version:   10.5.0
Redis Version:  3.2.5
Sidekiq Version:4.2.7

GitLab information
Version:        8.17.3-ee
Revision:       33f4b58
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
DB Version:     9.2.18
URL:            https://example.com
HTTP Clone URL: https://example.com/some-group/some-project.git
SSH Clone URL:  git@example.com:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     yes
Using Omniauth: no

GitLab Shell
Version:        4.1.1
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:            /opt/gitlab/embedded/bin/git

Results of GitLab application Check

sudo gitlab-rake gitlab:check SANITIZE=true)

Checking GitLab Shell ...

GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
5/1 ... ok
6/2 ... repository is empty
7/3 ... ok
9/5 ... ok
10/6 ... repository is empty
12/7 ... repository is empty
13/8 ... repository is empty
9/9 ... ok
5/10 ... ok
1/12 ... ok
17/13 ... ok
11/14 ... ok
1/16 ... ok
23/17 ... ok
1/18 ... ok
17/19 ... ok
1/20 ... ok
9/21 ... ok
9/22 ... ok
3/23 ... repository is empty
17/24 ... ok
17/25 ... ok
1/26 ... ok
32/28 ... ok
33/29 ... ok
17/30 ... ok
11/32 ... ok
1/33 ... ok
17/35 ... ok
17/38 ... ok
33/40 ... ok
11/41 ... ok
11/42 ... ok
11/43 ... ok
1/44 ... ok
38/45 ... ok
11/46 ... repository is empty
11/47 ... ok
17/48 ... ok
17/49 ... ok
11/50 ... ok
17/52 ... ok
17/53 ... ok
16/54 ... ok
16/55 ... ok
42/56 ... repository is empty
1/57 ... ok
1/58 ... ok
11/59 ... ok
9/62 ... ok
45/63 ... ok
17/64 ... ok
11/65 ... ok
23/68 ... ok
1/69 ... ok
11/70 ... ok
47/71 ... ok
47/72 ... ok
3/73 ... ok
17/74 ... ok
11/75 ... ok
47/76 ... ok
51/77 ... ok
2/78 ... ok
2/79 ... ok
3/80 ... ok
3/81 ... ok
11/82 ... ok
3/83 ... ok
54/84 ... ok
2/85 ... ok
2/86 ... ok
3/87 ... ok
54/88 ... ok
54/89 ... ok
54/90 ... ok
15/91 ... ok
1/92 ... ok
58/93 ... ok
58/94 ... ok
58/95 ... ok
58/96 ... ok
3/97 ... ok
3/98 ... ok
17/99 ... ok
3/100 ... ok
1/101 ... ok
17/102 ... ok
17/103 ... ok
33/104 ... ok
43/105 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
    # DELETED

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ... 
5/1 ... yes
6/2 ... yes
7/3 ... yes
9/5 ... yes
10/6 ... yes
12/7 ... yes
13/8 ... yes
9/9 ... yes
5/10 ... yes
1/12 ... yes
17/13 ... yes
11/14 ... yes
1/16 ... yes
23/17 ... yes
1/18 ... yes
17/19 ... yes
1/20 ... yes
9/21 ... yes
9/22 ... yes
3/23 ... yes
17/24 ... yes
17/25 ... yes
1/26 ... yes
32/28 ... yes
33/29 ... yes
17/30 ... yes
11/32 ... yes
1/33 ... yes
17/35 ... yes
17/38 ... yes
33/40 ... yes
11/41 ... yes
11/42 ... yes
11/43 ... yes
1/44 ... yes
38/45 ... yes
11/46 ... yes
11/47 ... yes
17/48 ... yes
17/49 ... yes
11/50 ... yes
17/52 ... yes
17/53 ... yes
16/54 ... yes
16/55 ... yes
42/56 ... yes
1/57 ... yes
1/58 ... yes
11/59 ... yes
9/62 ... yes
45/63 ... yes
17/64 ... yes
11/65 ... yes
23/68 ... yes
1/69 ... yes
11/70 ... yes
47/71 ... yes
47/72 ... yes
3/73 ... yes
17/74 ... yes
11/75 ... yes
47/76 ... yes
51/77 ... yes
2/78 ... yes
2/79 ... yes
3/80 ... yes
3/81 ... yes
11/82 ... yes
3/83 ... yes
54/84 ... yes
2/85 ... yes
2/86 ... yes
3/87 ... yes
54/88 ... yes
54/89 ... yes
54/90 ... yes
15/91 ... yes
1/92 ... yes
58/93 ... yes
58/94 ... yes
58/95 ... yes
58/96 ... yes
3/97 ... yes
3/98 ... yes
17/99 ... yes
3/100 ... yes
1/101 ... yes
17/102 ... yes
17/103 ... yes
33/104 ... yes
43/105 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 22

Checking GitLab ... Finished
Assignee Loading
Time tracking Loading