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
31aa6433
Commit
31aa6433
authored
Nov 22, 2021
by
Marius Bobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ci_predefined_vars_in_builder feature flag
Changelog: other
parent
ad43a0f2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1 addition
and
72 deletions
+1
-72
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+0
-6
app/models/concerns/ci/contextable.rb
app/models/concerns/ci/contextable.rb
+0
-27
config/feature_flags/development/ci_predefined_vars_in_builder.yml
...ature_flags/development/ci_predefined_vars_in_builder.yml
+0
-8
lib/gitlab/ci/variables/builder.rb
lib/gitlab/ci/variables/builder.rb
+1
-1
spec/lib/gitlab/ci/variables/builder_spec.rb
spec/lib/gitlab/ci/variables/builder_spec.rb
+0
-10
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+0
-20
No files found.
app/models/ci/pipeline.rb
View file @
31aa6433
...
...
@@ -1276,12 +1276,6 @@ module Ci
self
.
builds
.
latest
.
build_matchers
(
project
)
end
def
predefined_vars_in_builder_enabled?
strong_memoize
(
:predefined_vars_in_builder_enabled
)
do
Feature
.
enabled?
(
:ci_predefined_vars_in_builder
,
project
,
default_enabled: :yaml
)
end
end
def
authorized_cluster_agents
strong_memoize
(
:authorized_cluster_agents
)
do
::
Clusters
::
AgentAuthorizationsFinder
.
new
(
project
).
execute
.
map
(
&
:agent
)
...
...
app/models/concerns/ci/contextable.rb
View file @
31aa6433
...
...
@@ -13,7 +13,6 @@ module Ci
track_duration
do
variables
=
pipeline
.
variables_builder
.
scoped_variables
(
self
,
environment:
environment
,
dependencies:
dependencies
)
variables
.
concat
(
predefined_variables
)
unless
pipeline
.
predefined_vars_in_builder_enabled?
variables
.
concat
(
project
.
predefined_variables
)
variables
.
concat
(
pipeline
.
predefined_variables
)
variables
.
concat
(
runner
.
predefined_variables
)
if
runnable?
&&
runner
...
...
@@ -71,24 +70,6 @@ module Ci
end
end
def
predefined_variables
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
variables
|
variables
.
append
(
key:
'CI_JOB_NAME'
,
value:
name
)
variables
.
append
(
key:
'CI_JOB_STAGE'
,
value:
stage
)
variables
.
append
(
key:
'CI_JOB_MANUAL'
,
value:
'true'
)
if
action?
variables
.
append
(
key:
'CI_PIPELINE_TRIGGERED'
,
value:
'true'
)
if
trigger_request
variables
.
append
(
key:
'CI_NODE_INDEX'
,
value:
self
.
options
[
:instance
].
to_s
)
if
self
.
options
&
.
include?
(
:instance
)
variables
.
append
(
key:
'CI_NODE_TOTAL'
,
value:
ci_node_total_value
.
to_s
)
# legacy variables
variables
.
append
(
key:
'CI_BUILD_NAME'
,
value:
name
)
variables
.
append
(
key:
'CI_BUILD_STAGE'
,
value:
stage
)
variables
.
append
(
key:
'CI_BUILD_TRIGGERED'
,
value:
'true'
)
if
trigger_request
variables
.
append
(
key:
'CI_BUILD_MANUAL'
,
value:
'true'
)
if
action?
end
end
def
kubernetes_variables
::
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
collection
|
# Should get merged with the cluster kubeconfig in deployment_variables, see
...
...
@@ -123,13 +104,5 @@ module Ci
def
secret_project_variables
(
environment:
expanded_environment_name
)
project
.
ci_variables_for
(
ref:
git_ref
,
environment:
environment
)
end
private
def
ci_node_total_value
parallel
=
self
.
options
&
.
dig
(
:parallel
)
parallel
=
parallel
.
dig
(
:total
)
if
parallel
.
is_a?
(
Hash
)
parallel
||
1
end
end
end
config/feature_flags/development/ci_predefined_vars_in_builder.yml
deleted
100644 → 0
View file @
ad43a0f2
---
name
:
ci_predefined_vars_in_builder
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72348
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/231300
milestone
:
'
14.4'
type
:
development
group
:
group::pipeline authoring
default_enabled
:
false
lib/gitlab/ci/variables/builder.rb
View file @
31aa6433
...
...
@@ -12,7 +12,7 @@ module Gitlab
def
scoped_variables
(
job
,
environment
:,
dependencies
:)
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
variables
|
variables
.
concat
(
predefined_variables
(
job
))
if
pipeline
.
predefined_vars_in_builder_enabled?
variables
.
concat
(
predefined_variables
(
job
))
end
end
...
...
spec/lib/gitlab/ci/variables/builder_spec.rb
View file @
31aa6433
...
...
@@ -24,15 +24,5 @@ RSpec.describe Gitlab::Ci::Variables::Builder do
expect
(
names
).
to
include
(
*
keys
)
end
end
context
'feature flag disabled'
do
before
do
stub_feature_flags
(
ci_predefined_vars_in_builder:
false
)
end
it
'returns no variables'
do
expect
(
subject
.
map
{
|
env
|
env
[
:key
]
}).
to
be_empty
end
end
end
end
spec/models/ci/build_spec.rb
View file @
31aa6433
...
...
@@ -3421,10 +3421,6 @@ RSpec.describe Ci::Build do
end
describe
'#scoped_variables'
do
before
do
pipeline
.
clear_memoization
(
:predefined_vars_in_builder_enabled
)
end
it
'records a prometheus metric'
do
histogram
=
double
(
:histogram
)
expect
(
::
Gitlab
::
Ci
::
Pipeline
::
Metrics
).
to
receive
(
:pipeline_builder_scoped_variables_histogram
)
...
...
@@ -3522,22 +3518,6 @@ RSpec.describe Ci::Build do
build
.
scoped_variables
end
context
'when ci builder feature flag is disabled'
do
before
do
stub_feature_flags
(
ci_predefined_vars_in_builder:
false
)
end
it
'does not delegate to the variable builders'
do
expect_next_instance_of
(
Gitlab
::
Ci
::
Variables
::
Builder
)
do
|
builder
|
expect
(
builder
).
not_to
receive
(
:predefined_variables
)
end
build
.
scoped_variables
end
it_behaves_like
'calculates scoped_variables'
end
end
describe
'#simple_variables_without_dependencies'
do
...
...
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