Commit fba38b51 authored by Shinya Maeda's avatar Shinya Maeda

Add feature flag

parent f5bfedc6
......@@ -485,6 +485,8 @@ module Ci
end
def validates_dependencies!
return unless Feature.enabled?('ci_validates_dependencies')
dependencies.tap do |deps|
# When `dependencies` keyword is given and depended jobs are skipped by `only` keyword
if options[:dependencies]&.any? && deps.empty?
......
......@@ -1106,8 +1106,7 @@ Note that `artifacts` from all previous [stages](#stages) are passed by default.
To use this feature, define `dependencies` in context of the job and pass
a list of all previous jobs from which the artifacts should be downloaded.
You can only define jobs from stages that are executed before the current one.
An error will be shown if you define jobs from the current stage or next ones,
or there are no depended jobs with artifacts in previous stages.
An error will be shown if you define jobs from the current stage or next ones.
Defining an empty array will skip downloading any artifacts for that job.
The status of the previous job is not considered when using `dependencies`, so
if it failed or it is a manual job that was not run, no error occurs.
......@@ -1154,6 +1153,22 @@ deploy:
script: make deploy
```
### Validations for `dependencies` keyword
> Introduced in GitLab 10.3
`dependencies` keyword doesn't check the depended `artifacts` strictly. Therefore
they do not fail even though it falls into the following conditions.
1. A depended `artifacts` has been [erased](https://docs.gitlab.com/ee/api/jobs.html#erase-a-job).
1. A depended `artifacts` has been [expired](https://docs.gitlab.com/ee/ci/yaml/#artifacts-expire_in).
To validate those conditions, you can flip the feature flag from a rails console:
```
Feature.enable('ci_validates_dependencies')
```
### before_script and after_script
It's possible to overwrite the globally defined `before_script` and `after_script`:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment