How to use "when" phrase in gitlab-ci.yml (CI/CD)

Background:

I'd like to change the transfer of job in next stage by before stage result.

I will use "when" phrase in gitlab-ci.yml.

□ stage1 I define JobA and make processing failed deliberately.

□ stage2 When stage1 is success, JobB is carried out. When stage1 is failed, JobC is carried out.

□ stage3 When stage2 is success, JobD is carried out. When stage2 is failed, JobE is carried out.


I expect to be carried out by following order. JobA -> JobC -> JobD

However, it was carried out by following order. JobA -> JobC -> JobE

gitlab_when

Is this the specification street or bug?

According to a manual https://docs.gitlab.com/ee/ci/yaml/

  1. on_success - execute job only when all jobs from prior stages succeed. This is the default.
  2. on_failure - execute job only when at least one job from prior stages fails.
  3. always - execute job regardless of the status of jobs from prior stages.
  4. manual - execute job manually (added in GitLab 8.10). Read about manual actions below.

Which is "prior stages", just before stages or Everything in the front of stages?


Edited by k-koji