Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
619cd4a5
Commit
619cd4a5
authored
Jan 13, 2021
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the controllability on the dependency validation feature flag
This commit improves the controllability on the flag
parent
1622ac99
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
11 deletions
+52
-11
app/models/ci/build_dependencies.rb
app/models/ci/build_dependencies.rb
+1
-1
config/feature_flags/development/ci_validate_build_dependencies.yml
...ture_flags/development/ci_validate_build_dependencies.yml
+8
-0
config/feature_flags/development/ci_validate_build_dependencies_override.yml
...s/development/ci_validate_build_dependencies_override.yml
+2
-2
doc/administration/job_artifacts.md
doc/administration/job_artifacts.md
+3
-3
lib/gitlab/ci/features.rb
lib/gitlab/ci/features.rb
+5
-0
spec/models/ci/build_dependencies_spec.rb
spec/models/ci/build_dependencies_spec.rb
+28
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+2
-2
spec/services/ci/register_job_service_spec.rb
spec/services/ci/register_job_service_spec.rb
+3
-3
No files found.
app/models/ci/build_dependencies.rb
View file @
619cd4a5
...
...
@@ -103,7 +103,7 @@ module Ci
end
def
valid_local?
return
true
if
Feature
.
enabled?
(
:ci_disable_validates_dependencies
)
return
true
unless
Gitlab
::
Ci
::
Features
.
validate_build_dependencies?
(
project
)
local
.
all?
(
&
:valid_dependency?
)
end
...
...
config/feature_flags/development/ci_validate_build_dependencies.yml
0 → 100644
View file @
619cd4a5
---
name
:
ci_validate_build_dependencies
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14009
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/257852
milestone
:
'
10.3'
type
:
development
group
:
group::continuous integration
default_enabled
:
true
config/feature_flags/development/ci_
disable_validates_dependencies
.yml
→
config/feature_flags/development/ci_
validate_build_dependencies_override
.yml
View file @
619cd4a5
---
name
:
ci_
disable_validates_dependencies
name
:
ci_
validate_build_dependencies_override
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14009
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/2578
47
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/2578
52
milestone
:
'
10.3'
type
:
development
group
:
group::continuous integration
...
...
doc/administration/job_artifacts.md
View file @
619cd4a5
...
...
@@ -375,7 +375,7 @@ default artifacts expiration setting, which you can find in the [CI/CD Admin set
> Introduced in GitLab 10.3.
To disable
[
the dependencies validation
](
../ci/yaml/README.md#when-a-dependent-job-fails
)
,
you can enable the
`ci_
disable_validates_dependencies
`
feature flag from a Rails console.
you can enable the
`ci_
validate_build_dependencies_override
`
feature flag from a Rails console.
**In Omnibus installations:**
...
...
@@ -388,7 +388,7 @@ you can enable the `ci_disable_validates_dependencies` feature flag from a Rails
1.
Enable the feature flag to disable the validation:
```
ruby
Feature
.
enable
(
:ci_
disable_validates_dependencies
)
Feature
.
enable
(
:ci_
validate_build_dependencies_override
)
```
**In installations from source:**
...
...
@@ -403,7 +403,7 @@ you can enable the `ci_disable_validates_dependencies` feature flag from a Rails
1.
Enable the feature flag to disable the validation:
```
ruby
Feature
.
enable
(
:ci_
disable_validates_dependencies
)
Feature
.
enable
(
:ci_
validate_build_dependencies_override
)
```
## Set the maximum file size of the artifacts
...
...
lib/gitlab/ci/features.rb
View file @
619cd4a5
...
...
@@ -70,6 +70,11 @@ module Gitlab
def
self
.
rules_variables_enabled?
(
project
)
::
Feature
.
enabled?
(
:ci_rules_variables
,
project
,
default_enabled:
true
)
end
def
self
.
validate_build_dependencies?
(
project
)
::
Feature
.
enabled?
(
:ci_validate_build_dependencies
,
default_enabled: :yaml
)
&&
::
Feature
.
disabled?
(
:ci_validate_build_dependencies_override
,
project
)
end
end
end
end
spec/models/ci/build_dependencies_spec.rb
View file @
619cd4a5
...
...
@@ -18,6 +18,10 @@ RSpec.describe Ci::BuildDependencies do
let!
(
:rubocop_test
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'rubocop'
,
stage_idx:
1
,
stage:
'test'
)
}
let!
(
:staging
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'staging'
,
stage_idx:
2
,
stage:
'deploy'
)
}
before
do
stub_feature_flags
(
ci_validate_build_dependencies_override:
false
)
end
describe
'#local'
do
subject
{
described_class
.
new
(
job
).
local
}
...
...
@@ -360,4 +364,28 @@ RSpec.describe Ci::BuildDependencies do
expect
(
subject
).
to
contain_exactly
(
1
,
2
,
3
,
4
)
end
end
describe
'#valid?'
do
subject
{
described_class
.
new
(
job
).
valid?
}
let
(
:job
)
{
rspec_test
}
it
{
is_expected
.
to
eq
(
true
)
}
context
'when a local dependency is invalid'
do
before
do
build
.
update_column
(
:erased_at
,
Time
.
current
)
end
it
{
is_expected
.
to
eq
(
false
)
}
context
'when ci_validate_build_dependencies_override feature flag is enabled'
do
before
do
stub_feature_flags
(
ci_validate_build_dependencies_override:
job
.
project
)
end
it
{
is_expected
.
to
eq
(
true
)
}
end
end
end
end
spec/models/ci/build_spec.rb
View file @
619cd4a5
...
...
@@ -3605,7 +3605,7 @@ RSpec.describe Ci::Build do
context
'when validates for dependencies is enabled'
do
before
do
stub_feature_flags
(
ci_
disable_validates_dependencies
:
false
)
stub_feature_flags
(
ci_
validate_build_dependencies_override
:
false
)
end
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
)
}
...
...
@@ -3633,7 +3633,7 @@ RSpec.describe Ci::Build do
let
(
:options
)
{
{
dependencies:
[
'test'
]
}
}
before
do
stub_feature_flags
(
ci_
disable_validates_dependencies
:
true
)
stub_feature_flags
(
ci_
validate_build_dependencies_override
:
true
)
end
it_behaves_like
'validation is not active'
...
...
spec/services/ci/register_job_service_spec.rb
View file @
619cd4a5
...
...
@@ -455,7 +455,7 @@ module Ci
end
before
do
stub_feature_flags
(
ci_
disable_validates_dependencies
:
false
)
stub_feature_flags
(
ci_
validate_build_dependencies_override
:
false
)
end
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
)
}
...
...
@@ -470,7 +470,7 @@ module Ci
context
'when validates for dependencies is enabled'
do
before
do
stub_feature_flags
(
ci_
disable_validates_dependencies
:
false
)
stub_feature_flags
(
ci_
validate_build_dependencies_override
:
false
)
end
it_behaves_like
'validation is active'
...
...
@@ -478,7 +478,7 @@ module Ci
context
'when validates for dependencies is disabled'
do
before
do
stub_feature_flags
(
ci_
disable_validates_dependencies
:
true
)
stub_feature_flags
(
ci_
validate_build_dependencies_override
:
true
)
end
it_behaves_like
'validation is not active'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment