Skip to content

Pipeline intermittent lint failures

Workaround

When using needs and only:/except:/rules make sure the needs job has the same rule as the predecessor job

Summary

Intermittent pipeline lint failures. Many times, the next commit will cause the pipeline to run. Testing the yaml with the lint tool does now show any issues.

What is the current bug behavior?

Here's a minimal config to reproduce the error:

image: busybox

build_job:
  stage: build
  script:
    - ls -lh
  only:
    refs:
      - master
    changes:
      - test_file.txt

test_job:
  stage: test
  script:
    - ls -lh
  needs:
    - build_job
  only:
    refs:
      - master
  • build_job is created only when the test_file.txt file changes on master
  • test_job is created on all the changes that are pushed on master

The only: rules are applied during build time and they prevent the build_job from being created and the need: with throw an error:

Screenshot_2020-01-21_at_12.11.58

So pushing any changes on master that don't change test_file.txt would result in an yaml invalid error.

What is the expected correct behavior?

The error message should be more helpful in debugging this error. We should update the error message to say that the required jobs might have been removed by rules/only/except.

Running Gitlab 11.0.2 with runner 0.11.0.

Customer ticket -> https://gitlab.zendesk.com/agent/tickets/100695 (internal only)

(If you can, link to the line of code that might be responsible for the problem)

Can we get some guidance on the best way to troubleshoot?

Edited by Dov Hershkovitch