Skip to content

Remove warning/error for duplicate includes

Laura Montemayor requested to merge lm-remove-duplicate-includes into master

What does this MR do and why?

Allow including duplicate yaml file in the same configuration. In addition, we won't raise any warnings for now. There is a follow-up issue to do this: #350468

Screenshots or screen recordings

An example of how this would be used:

.gitlab-ci.yml

include:
  - https://example.org/phpunit.yml
  - https://example.org/stylecheck.yml

tests.yml

.ci:stage:test:
  stage: test
  only:
    refs:
      - branches
      - tags

phpunit.yml

include:
  - tests.yml

phpunit:
  extends: .ci:stage:test
  image: $PHPUNIT_IMAGE
  dependencies:
    - composer
  coverage: '/^\s*Lines\s*:\s*\d+\.?\d+\%/'
  script:
    - vendor/bin/phpunit

stylecheck.yml

include:
  - https://example.org/tests.yml

php-cs-fixer:
  extends: .ci:stage:test
  image: $CI_REGISTRY/php-cs-fixer:php-5.6
  dependencies:
    - composer
  allow_failure: true
  script:
    - php-cs-fixer fix --verbose --diff --dry-run --ansi

# vim:ts=2:sw=2:et

Previously, this would return an error:

Include `{"remote":".../tests.yml"}` was already included!

Now, it should be valid. This MR also includes lengthy documentation on how to use this properly and avoid your jobs being overwritten.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

#28987 (closed)

Edited by Laura Montemayor

Merge request reports

Loading