Skip to content

Unexplained CI Lint Failures

A customer has several projects with CI/CID pipelines that use the "needs" keyword.

Inexplicably yaml invalid and error messages appear for .gitlab-ci.yaml when it has previously been successful without any change.

Lint will process the syntax and return successfully.

To resolve the issue, a superfluous commit is made to "update" .gitlab-ci.yml... e.g. adding a newline, or commenting out a line, etc.

Unfortunately this hasn't been reproduced with any consistency locally or on the projects with this problem. Please view the internal ticket to investigate the generated MRs and pipelines directly

Here is reduced example of the example that I was not able to get to fail:

yaml
image:
  name: alpine:3.11

stages:
  - plann
  - apply

.plann: &plann
  only: # plan will only run if files affecting environment are changing
    changes:
      - .gitlab-ci.yml
  script:
    - echo "Plan is happening here"
  stage: plann

.apply: &apply
  only: # apply will only run if files affecting environment are changing
    changes:
      - .gitlab-ci.yml
  script:
    - echo "Apply is happening here"
  stage: apply 
  when: manual # requires manual execution via gitlab wwwui


plan_dev:
  <<: *plann
  variables: {environment: dev}


apply_dev:
  <<: *apply
  needs: ['plan_dev']
  only: ['branches'] # job can run from any branch
  variables: {environment: dev} # random commit

Full explanation of customer experiencing this issue: https://gitlab.zendesk.com/agent/tickets/147193 (Internal) (Uncofirmed, but possibly related issue): #207225 (closed)

Edited by Michael Lussier