gitlab-ce/lib/gitlab/ci/config/entry
Paul B 30791a36c5
ci(config): validate 'include' keyword
During `.gitlab-ci.yml` configuration file validation there are two
cases:
1- either we are validating a file within a project context (a project
and a sha is given in option parameters)
2- either we are validating a file with no project context (as in the
api POST /ci/lint)

In the first case, all `include:` keywords are replaced by the content
of the included CI cnfiguration files.

In the second case, the `include:` configuration is kept untouched.

The current problem arises in the second case when one wants to
validate a generic gitlab-ci configuration file with an `include:`
keyword from the API. The following error will be raised by the API:
`"jobs:include config should be a hash"`.

This commit fixes the behavior by validating the `include:` keyword if
its present to not parse it as a job definition.

Fixes #55863 / #52822
2019-02-19 17:10:50 +01:00
..
artifacts.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
cache.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
commands.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
coverage.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
environment.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
global.rb ci(config): validate 'include' keyword 2019-02-19 17:10:50 +01:00
hidden.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
image.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
include.rb ci(config): validate 'include' keyword 2019-02-19 17:10:50 +01:00
includes.rb ci(config): validate 'include' keyword 2019-02-19 17:10:50 +01:00
job.rb Use defauly `only` policy defined as a constant 2019-01-25 10:35:24 +01:00
jobs.rb Make it possible to override config jobs composition in EE 2019-01-25 10:29:01 +01:00
key.rb Make default config entry value configurable 2019-01-15 11:18:14 +01:00
paths.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
policy.rb Use defauly `only` policy defined as a constant 2019-01-25 10:35:24 +01:00
reports.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
retry.rb Refactor only/except configuration policies 2019-01-14 14:22:13 +01:00
script.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
service.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
services.rb ci/config: generalize Config validation into Gitlab::Config:: module 2018-11-29 16:09:18 +01:00
stage.rb Make default config entry value configurable 2019-01-15 11:18:14 +01:00
stages.rb Make default config entry value configurable 2019-01-15 11:18:14 +01:00
variables.rb Refactor only/except configuration policies 2019-01-14 14:22:13 +01:00