New Pipeline only:changes feature does not respect the job dependency tree
### Summary
The great new 11.4 Pipeline only->changes feature see [docs](https://docs.gitlab.com/ee/ci/yaml/#onlychanges) or [issue](https://gitlab.com/gitlab-org/gitlab-ce/issues/19232) works generally very well, but does not respect the job dependency tree, because it may skip some jobs of a pipeline but will not refer to the result of the last skipped jobs to determine if the pipeline went through. Thus it allows to merge code that is actually not going through the pipeline.
### Steps to reproduce
Open a new branch with a test stage, on which a build stage for example depends.
Inside the test stage, have different jobs, depending on different paths.
Make a first commit that will run a job A because changing file A and causing the job to fail.
Make a new commit that will run a job B because changing file B and cause the job to pass.
The build stage has a dependency on jobs A and B from the test stage, but after the latest commit, it will still be ran, because it won't analyse/use the result of the skipped job. It will also be possible to Merge the MR.
Another problem is that if you push 2 commits shortly in time that triggers pipelines 1 and 2 with different jobs: Pipeline 1 might be still running the stage 1 "test", while pipeline 2 can already be running stage 2 "build" jobs, whereas these should be pending and waiting for the result of the skipped jobs of stage 1 from the previous pipeline
### What is the current *bug* behavior?
In the configuration described before, the latest pipeline is marked as "successful", merging is possible and steps depending on failing tests are ran.
Also in the case of two parallel running pipelines, the stage 2 of pipeline 2 is not waiting on the result of skipped jobs still running in stage 1 of pipeline 1.
### What is the expected *correct* behavior?
The latest pipeline should not be marked as "successful", merging should not be possible, steps afterwards should not be ran.
Also, in the case of two commits very short in time, if the second commit has finished a stage containing `only/changes` conditionals, the following stages should stay in "Pending" until the results of all previous jobs of the previous stages are finished.
### Relevant logs and/or screenshots



#### Results of GitLab environment info
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.4.4p296
Gem Version: 2.6.14.1
Bundler Version:1.17.1
Rake Version: 12.3.1
Redis Version: 3.0.6
Git Version: 2.19.1
Sidekiq Version:5.2.1
Go Version: unknown
GitLab information
Version: 11.4.4
Revision: 2e8fd64b
Directory: /home/git/gitlab
DB Adapter: postgresql
URL: https://dev.jonasundderwolf.de
HTTP Clone URL: https://dev.jonasundderwolf.de/some-group/some-project.git
SSH Clone URL: git@dev.jonasundderwolf.de:some-group/some-project.git
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 8.3.3
Repository storage paths:
- default: /home/git/data/repositories
Hooks: /home/git/gitlab-shell/hooks
Git: /usr/bin/git
</pre>
</details>
#### Results of GitLab application Check
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
Checking GitLab Shell ...
GitLab Shell version >= 8.3.3 ? ... OK (8.3.3)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
32/5 ... ok
28/6 ... ok
33/7 ... ok
23/8 ... ok
21/9 ... ok
27/10 ... ok
45/11 ... ok
32/12 ... ok
35/13 ... ok
29/14 ... ok
23/15 ... ok
44/16 ... ok
23/17 ... ok
27/18 ... ok
23/19 ... ok
36/20 ... ok
30/21 ... ok
41/22 ... ok
41/23 ... ok
26/24 ... ok
39/25 ... ok
42/26 ... ok
23/27 ... ok
23/28 ... ok
40/29 ... ok
23/31 ... ok
38/32 ... ok
31/33 ... ok
23/35 ... ok
37/36 ... ok
43/37 ... ok
34/38 ... ok
26/39 ... ok
27/42 ... ok
28/43 ... ok
26/44 ... ok
23/47 ... ok
20/48 ... ok
24/50 ... ok
26/51 ... ok
20/52 ... ok
24/53 ... ok
20/55 ... ok
20/56 ... ok
47/57 ... ok
20/60 ... ok
23/61 ... ok
5/62 ... ok
27/63 ... ok
20/64 ... ok
27/65 ... ok
48/66 ... ok
33/67 ... ok
5/68 ... repository is empty
5/69 ... ok
50/70 ... ok
27/71 ... ok
20/72 ... ok
52/73 ... ok
53/74 ... ok
14/75 ... ok
7/76 ... ok
55/77 ... ok
56/78 ... ok
56/79 ... ok
24/80 ... ok
20/81 ... ok
23/82 ... ok
58/83 ... ok
59/84 ... ok
60/85 ... ok
5/86 ... repository is empty
29/87 ... ok
61/88 ... ok
61/89 ... ok
23/90 ... ok
20/91 ... ok
7/92 ... ok
20/93 ... ok
64/94 ... ok
20/95 ... ok
64/96 ... ok
20/97 ... ok
64/98 ... ok
24/99 ... ok
5/100 ... ok
8/101 ... ok
27/102 ... ok
7/103 ... ok
64/104 ... ok
27/105 ... ok
64/106 ... ok
64/107 ... ok
64/109 ... ok
27/110 ... ok
5/111 ... repository is empty
75/112 ... ok
64/113 ... ok
27/116 ... ok
64/117 ... ok
27/119 ... ok
27/120 ... ok
27/121 ... ok
84/122 ... repository is empty
84/123 ... repository is empty
91/124 ... ok
20/126 ... ok
64/128 ... ok
64/129 ... ok
64/131 ... ok
20/132 ... ok
95/133 ... repository is empty
20/134 ... ok
20/135 ... ok
64/136 ... ok
27/137 ... ok
90/138 ... ok
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK
Access to /home/git/.ssh/authorized_keys: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml
Checking LDAP ...
Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
[...]
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
Projects have namespace: ...
32/5 ... yes
28/6 ... yes
33/7 ... yes
23/8 ... yes
21/9 ... yes
27/10 ... yes
45/11 ... yes
32/12 ... yes
35/13 ... yes
29/14 ... yes
23/15 ... yes
44/16 ... yes
23/17 ... yes
27/18 ... yes
23/19 ... yes
36/20 ... yes
30/21 ... yes
41/22 ... yes
41/23 ... yes
26/24 ... yes
39/25 ... yes
42/26 ... yes
23/27 ... yes
23/28 ... yes
40/29 ... yes
23/31 ... yes
38/32 ... yes
31/33 ... yes
23/35 ... yes
37/36 ... yes
43/37 ... yes
34/38 ... yes
26/39 ... yes
27/42 ... yes
28/43 ... yes
26/44 ... yes
23/47 ... yes
20/48 ... yes
24/50 ... yes
26/51 ... yes
20/52 ... yes
24/53 ... yes
20/55 ... yes
20/56 ... yes
47/57 ... yes
20/60 ... yes
23/61 ... yes
5/62 ... yes
27/63 ... yes
20/64 ... yes
27/65 ... yes
48/66 ... yes
33/67 ... yes
5/68 ... yes
5/69 ... yes
50/70 ... yes
27/71 ... yes
20/72 ... yes
52/73 ... yes
53/74 ... yes
14/75 ... yes
7/76 ... yes
55/77 ... yes
56/78 ... yes
56/79 ... yes
24/80 ... yes
20/81 ... yes
23/82 ... yes
58/83 ... yes
59/84 ... yes
60/85 ... yes
5/86 ... yes
29/87 ... yes
61/88 ... yes
61/89 ... yes
23/90 ... yes
20/91 ... yes
7/92 ... yes
20/93 ... yes
64/94 ... yes
20/95 ... yes
64/96 ... yes
20/97 ... yes
64/98 ... yes
24/99 ... yes
5/100 ... yes
8/101 ... yes
27/102 ... yes
7/103 ... yes
64/104 ... yes
27/105 ... yes
64/106 ... yes
64/107 ... yes
64/109 ... yes
27/110 ... yes
5/111 ... yes
75/112 ... yes
64/113 ... yes
27/116 ... yes
64/117 ... yes
27/119 ... yes
27/120 ... yes
27/121 ... yes
84/122 ... yes
84/123 ... yes
91/124 ... yes
20/126 ... yes
64/128 ... yes
64/129 ... yes
64/131 ... yes
20/132 ... yes
95/133 ... yes
20/134 ... yes
20/135 ... yes
64/136 ... yes
27/137 ... yes
90/138 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.4.4)
Git version >= 2.9.5 ? ... yes (2.19.1)
Git user has default SSH configuration? ... yes
Active users: ... 24
Checking GitLab ... Finished
</pre>
</details>
issue