Indefinite pipeline when using manual job with "needs:" for another manual job

While trying to workaround problems with manual jobs ignoring other manual job dependencies: #32552, I noticed a problem with the needs keyword:

CI configuration without needs

stages:
  - build
  - test
  - deploy

BuildJob:
  stage: build
  tags:
    - docker
  script:
    - echo "building"
    
TestJob-manual:
  stage: test
  when: manual
  tags:
    - docker
  script:
    - echo "testing"

DeployJob-manual:
  when: manual
  dependencies:
    - TestJob-manual
  stage: deploy
  tags:
    - docker
  script:
    - echo "deploying"

This is how the finished pipeline looks like: "passed", so everything is OK. Just as a side note: see how the play button is available for the deploy job but this is the mentioned other bug (#32552)

image

CI configuration with needs

stages:
  - build
  - test
  - deploy

BuildJob:
  stage: build
  tags:
    - docker
  script:
    - echo "building"
    
TestJob-manual:
  stage: test
  when: manual
  tags:
    - docker
  script:
    - echo "testing"

DeployJob-manual:
  when: manual
  dependencies:
    - TestJob-manual
  needs:
    - TestJob-manual
  stage: deploy
  tags:
    - docker
  script:
    - echo "deploying"

The pipeline now runs indefinitely because the deployment job waits for the testjob to be started manually. This is inconsistent to how dependencies is handled - there, the pipeline passes when the two manual jobs are not started.

image

If I then manually start the test job, two things happen:

  • The pipeline is passed
  • The deploy job did not run This is also unexpected

image

How to reproduce

Use the above CI YAML or see https://gitlab.com/PhilLab/testing-private/

Edited Oct 01, 2019 by Philipp Hasper
Assignee Loading
Time tracking Loading