CI manual jobs ignore dependencies

Summary

When there are several jobs that depend on each other specified as when: manual, the dependencies do not trigger dependent jobs upon starting the top-level job.

Steps to reproduce

.gitlab-ci.yml

stages:
  - stage1
  - stage2

cache:
  key: none
  untracked: false
  paths: []

build-stage1:
  stage: stage1
  when: manual
  script:
    - bash stage1.sh
  artifacts:
    expire_in: 1 day
    paths:
    - stage1/*

build-stage2:
  stage: stage2
  when: manual
  script:
    - bash stage2.sh
  dependencies:
    - build-stage1
  artifacts:
    expire_in: 1 day
    paths:
    - stage2/*

stage1.sh

#!/bin/bash

mkdir -p stage1
echo "stage1 @ $(date)" > stage1/out.txt

stage2.sh

#!/bin/bash

mkdir -p stage2
echo "stage2 @ $(date)" > stage2/out.txt
echo "stage1 output:" >> stage2/out.txt
cat stage1/out.txt >> stage2/out.txt

Run build-stage2 manually from the web UI.

What is the current bug behavior?

build-stage2 is started and fails because it cannot find artifacts from stage1.

Running with gitlab-ci-multi-runner 1.9.4 (8ce22bd)
Using Shell executor...
Running on WINCI...
Fetching changes...
Removing stage1/
Removing stage2/
HEAD is now at c3b17ee fix ci file
From https://.../support/ci-playground
   c3b17ee..0a925d0  master     -> origin/master
Checking out 0a925d0e as master...
$ bash stage2.sh
cat: stage1/out.txt: No such file or directory
ERROR: Build failed: exit status 1

What is the expected correct behavior?

build-stage1 should be started, because it is a dependency of build-stage2. build-stage1artifacts should produced and passed to build-stage2.

Results of GitLab environment info

I, [2017-02-19T13:24:46.500576 #13856]  INFO -- sentry: ** [Raven] Raven 2.0.2 ready to catch errors

System information
System:         Ubuntu 16.04
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
Sidekiq Version:4.2.7

GitLab information
Version:        8.16.6
Revision:       65cdbdd
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            https://....com
HTTP Clone URL: https://....com/some-group/some-project.git
SSH Clone URL:  git@....com:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

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

Results of GitLab application 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 ...

IMAP server credentials are correct? ... yes
Init.d configured correctly? ... skipped (omnibus-gitlab has no init script)
MailRoom running? ... can't check because of previous errors

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

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: ...
9/1 ... yes
9/2 ... yes
1/3 ... yes
1/4 ... yes
8/5 ... yes
1/6 ... yes
1/7 ... yes
1/8 ... yes
1/9 ... yes
1/10 ... yes
9/11 ... yes
1/12 ... yes
1/13 ... yes
1/14 ... yes
1/15 ... yes
1/16 ... yes
1/17 ... yes
1/18 ... yes
1/19 ... yes
1/20 ... yes
13/21 ... yes
1/22 ... yes
1/23 ... yes
8/24 ... yes
1/25 ... yes
1/26 ... yes
1/27 ... yes
1/28 ... yes
1/29 ... yes
1/30 ... yes
1/31 ... yes
1/32 ... yes
1/33 ... yes
1/34 ... yes
1/35 ... yes
1/36 ... yes
11/37 ... yes
1/38 ... yes
1/39 ... yes
9/40 ... yes
1/41 ... yes
9/42 ... yes
1/43 ... yes
1/44 ... yes
1/45 ... yes
1/46 ... yes
9/47 ... yes
9/48 ... yes
1/49 ... yes
11/50 ... yes
10/51 ... yes
1/52 ... yes
1/53 ... yes
1/54 ... yes
9/55 ... yes
9/56 ... yes
9/57 ... yes
9/58 ... yes
22/59 ... yes
22/60 ... yes
7/62 ... yes
7/64 ... yes
7/65 ... yes
7/66 ... yes
9/67 ... yes
13/68 ... yes
13/69 ... yes
13/70 ... yes
13/71 ... yes
9/72 ... yes
13/73 ... yes
7/76 ... yes
13/77 ... yes
27/78 ... yes
13/79 ... 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: 19

Checking GitLab ... Finished