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
5e509cf7
Commit
5e509cf7
authored
Aug 12, 2021
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes ci_same_stage_job_needs ff
Changelog: other
parent
0bdfe446
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
8 additions
and
87 deletions
+8
-87
app/services/ci/after_requeue_job_service.rb
app/services/ci/after_requeue_job_service.rb
+3
-10
config/feature_flags/development/ci_same_stage_job_needs.yml
config/feature_flags/development/ci_same_stage_job_needs.yml
+0
-8
doc/ci/yaml/index.md
doc/ci/yaml/index.md
+1
-2
lib/gitlab/ci/pipeline/seed/build.rb
lib/gitlab/ci/pipeline/seed/build.rb
+1
-6
lib/gitlab/ci/yaml_processor.rb
lib/gitlab/ci/yaml_processor.rb
+3
-13
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
+0
-10
spec/lib/gitlab/ci/pipeline/seed/pipeline_spec.rb
spec/lib/gitlab/ci/pipeline/seed/pipeline_spec.rb
+0
-4
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+0
-24
spec/services/ci/after_requeue_job_service_spec.rb
spec/services/ci/after_requeue_job_service_spec.rb
+0
-10
No files found.
app/services/ci/after_requeue_job_service.rb
View file @
5e509cf7
...
@@ -10,17 +10,10 @@ module Ci
...
@@ -10,17 +10,10 @@ module Ci
private
private
def
process_subsequent_jobs
(
processable
)
def
process_subsequent_jobs
(
processable
)
if
Feature
.
enabled?
(
:ci_same_stage_job_needs
,
processable
.
project
,
default_enabled: :yaml
)
(
stage_dependent_jobs
(
processable
)
|
needs_dependent_jobs
(
processable
))
(
stage_dependent_jobs
(
processable
)
|
needs_dependent_jobs
(
processable
))
.
each
do
|
processable
|
.
each
do
|
processable
|
process
(
processable
)
process
(
processable
)
end
end
else
skipped_jobs
(
processable
).
after_stage
(
processable
.
stage_idx
)
.
find_each
do
|
job
|
process
(
job
)
end
end
end
end
def
reset_source_bridge
(
processable
)
def
reset_source_bridge
(
processable
)
...
...
config/feature_flags/development/ci_same_stage_job_needs.yml
deleted
100644 → 0
View file @
0bdfe446
---
name
:
ci_same_stage_job_needs
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59668
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/328253
milestone
:
'
14.1'
type
:
development
group
:
group::pipeline authoring
default_enabled
:
true
doc/ci/yaml/index.md
View file @
5e509cf7
...
@@ -1560,8 +1560,7 @@ production:
...
@@ -1560,8 +1560,7 @@ production:
-
In
[
GitLab 14.1 and later
](
https://gitlab.com/gitlab-org/gitlab/-/issues/30632
)
you
-
In
[
GitLab 14.1 and later
](
https://gitlab.com/gitlab-org/gitlab/-/issues/30632
)
you
can refer to jobs in the same stage as the job you are configuring. This feature is
can refer to jobs in the same stage as the job you are configuring. This feature is
enabled on GitLab.com and ready for production use. On self-managed
[
GitLab 14.2 and later
](
https://gitlab.com/gitlab-org/gitlab/-/issues/30632
)
enabled on GitLab.com and ready for production use. On self-managed
[
GitLab 14.2 and later
](
https://gitlab.com/gitlab-org/gitlab/-/issues/30632
)
this feature is available by default. To hide the feature, ask an administrator to
this feature is available by default.
[
disable the `ci_same_stage_job_needs` flag
](
../../administration/feature_flags.md
)
.
-
In GitLab 14.0 and older, you can only refer to jobs in earlier stages.
-
In GitLab 14.0 and older, you can only refer to jobs in earlier stages.
-
In GitLab 13.9 and older, if
`needs:`
refers to a job that might not be added to
-
In GitLab 13.9 and older, if
`needs:`
refers to a job that might not be added to
a pipeline because of
`only`
,
`except`
, or
`rules`
, the pipeline might fail to create.
a pipeline because of
`only`
,
`except`
, or
`rules`
, the pipeline might fail to create.
...
...
lib/gitlab/ci/pipeline/seed/build.rb
View file @
5e509cf7
...
@@ -15,12 +15,7 @@ module Gitlab
...
@@ -15,12 +15,7 @@ module Gitlab
@context
=
context
@context
=
context
@pipeline
=
context
.
pipeline
@pipeline
=
context
.
pipeline
@seed_attributes
=
attributes
@seed_attributes
=
attributes
@stages_for_needs_lookup
=
if
Feature
.
enabled?
(
:ci_same_stage_job_needs
,
@pipeline
.
project
,
default_enabled: :yaml
)
@stages_for_needs_lookup
=
(
previous_stages
+
[
current_stage
]).
compact
(
previous_stages
+
[
current_stage
]).
compact
else
previous_stages
end
@needs_attributes
=
dig
(
:needs_attributes
)
@needs_attributes
=
dig
(
:needs_attributes
)
@resource_group_key
=
attributes
.
delete
(
:resource_group_key
)
@resource_group_key
=
attributes
.
delete
(
:resource_group_key
)
@job_variables
=
@seed_attributes
.
delete
(
:job_variables
)
@job_variables
=
@seed_attributes
.
delete
(
:job_variables
)
...
...
lib/gitlab/ci/yaml_processor.rb
View file @
5e509cf7
...
@@ -47,10 +47,8 @@ module Gitlab
...
@@ -47,10 +47,8 @@ module Gitlab
validate_job!
(
name
,
job
)
validate_job!
(
name
,
job
)
end
end
if
::
Feature
.
enabled?
(
:ci_same_stage_job_needs
,
@opts
[
:project
],
default_enabled: :yaml
)
YamlProcessor
::
Dag
.
check_circular_dependencies!
(
@jobs
)
YamlProcessor
::
Dag
.
check_circular_dependencies!
(
@jobs
)
end
end
end
def
validate_job!
(
name
,
job
)
def
validate_job!
(
name
,
job
)
validate_job_stage!
(
name
,
job
)
validate_job_stage!
(
name
,
job
)
...
@@ -103,17 +101,9 @@ module Gitlab
...
@@ -103,17 +101,9 @@ module Gitlab
job_stage_index
=
stage_index
(
name
)
job_stage_index
=
stage_index
(
name
)
dependency_stage_index
=
stage_index
(
dependency
)
dependency_stage_index
=
stage_index
(
dependency
)
if
::
Feature
.
enabled?
(
:ci_same_stage_job_needs
,
@opts
[
:project
],
default_enabled: :yaml
)
unless
dependency_stage_index
.
present?
&&
dependency_stage_index
<=
job_stage_index
unless
dependency_stage_index
.
present?
&&
dependency_stage_index
<=
job_stage_index
error!
(
"
#{
name
}
job:
#{
dependency_type
}
#{
dependency
}
is not defined in current or prior stages"
)
error!
(
"
#{
name
}
job:
#{
dependency_type
}
#{
dependency
}
is not defined in current or prior stages"
)
end
end
else
# A dependency might be defined later in the configuration
# with a stage that does not exist
unless
dependency_stage_index
.
present?
&&
dependency_stage_index
<
job_stage_index
error!
(
"
#{
name
}
job:
#{
dependency_type
}
#{
dependency
}
is not defined in prior stages"
)
end
end
end
end
def
stage_index
(
name
)
def
stage_index
(
name
)
...
...
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
View file @
5e509cf7
...
@@ -1140,16 +1140,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
...
@@ -1140,16 +1140,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
it
'does not have errors'
do
it
'does not have errors'
do
expect
(
subject
.
errors
).
to
be_empty
expect
(
subject
.
errors
).
to
be_empty
end
end
context
'when ci_same_stage_job_needs FF is disabled'
do
before
do
stub_feature_flags
(
ci_same_stage_job_needs:
false
)
end
it
'has errors'
do
expect
(
subject
.
errors
).
to
contain_exactly
(
"'rspec' job needs 'build' job, but 'build' is not in any previous stage"
)
end
end
end
end
context
'when using 101 needs'
do
context
'when using 101 needs'
do
...
...
spec/lib/gitlab/ci/pipeline/seed/pipeline_spec.rb
View file @
5e509cf7
...
@@ -34,10 +34,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Pipeline do
...
@@ -34,10 +34,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Pipeline do
described_class
.
new
(
seed_context
,
stages_attributes
)
described_class
.
new
(
seed_context
,
stages_attributes
)
end
end
before
do
stub_feature_flags
(
ci_same_stage_job_needs:
false
)
end
describe
'#stages'
do
describe
'#stages'
do
it
'returns the stage resources'
do
it
'returns the stage resources'
do
stages
=
seed
.
stages
stages
=
seed
.
stages
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
5e509cf7
...
@@ -590,14 +590,6 @@ module Gitlab
...
@@ -590,14 +590,6 @@ module Gitlab
end
end
it_behaves_like
'has warnings and expected error'
,
/build job: need test is not defined in current or prior stages/
it_behaves_like
'has warnings and expected error'
,
/build job: need test is not defined in current or prior stages/
context
'with ci_same_stage_job_needs FF disabled'
do
before
do
stub_feature_flags
(
ci_same_stage_job_needs:
false
)
end
it_behaves_like
'has warnings and expected error'
,
/build job: need test is not defined in prior stages/
end
end
end
end
end
end
end
...
@@ -1809,14 +1801,6 @@ module Gitlab
...
@@ -1809,14 +1801,6 @@ module Gitlab
let
(
:dependencies
)
{
[
'deploy'
]
}
let
(
:dependencies
)
{
[
'deploy'
]
}
it_behaves_like
'returns errors'
,
'test1 job: dependency deploy is not defined in current or prior stages'
it_behaves_like
'returns errors'
,
'test1 job: dependency deploy is not defined in current or prior stages'
context
'with ci_same_stage_job_needs FF disabled'
do
before
do
stub_feature_flags
(
ci_same_stage_job_needs:
false
)
end
it_behaves_like
'returns errors'
,
'test1 job: dependency deploy is not defined in prior stages'
end
end
end
context
'when a job depends on another job that references a not-yet defined stage'
do
context
'when a job depends on another job that references a not-yet defined stage'
do
...
@@ -2053,14 +2037,6 @@ module Gitlab
...
@@ -2053,14 +2037,6 @@ module Gitlab
let
(
:needs
)
{
[
'deploy'
]
}
let
(
:needs
)
{
[
'deploy'
]
}
it_behaves_like
'returns errors'
,
'test1 job: need deploy is not defined in current or prior stages'
it_behaves_like
'returns errors'
,
'test1 job: need deploy is not defined in current or prior stages'
context
'with ci_same_stage_job_needs FF disabled'
do
before
do
stub_feature_flags
(
ci_same_stage_job_needs:
false
)
end
it_behaves_like
'returns errors'
,
'test1 job: need deploy is not defined in prior stages'
end
end
end
context
'needs and dependencies that are mismatching'
do
context
'needs and dependencies that are mismatching'
do
...
...
spec/services/ci/after_requeue_job_service_spec.rb
View file @
5e509cf7
...
@@ -44,16 +44,6 @@ RSpec.describe Ci::AfterRequeueJobService do
...
@@ -44,16 +44,6 @@ RSpec.describe Ci::AfterRequeueJobService do
it
'marks subsequent skipped jobs as processable'
do
it
'marks subsequent skipped jobs as processable'
do
expect
{
execute_service
}.
to
change
{
test4
.
reload
.
status
}.
from
(
'skipped'
).
to
(
'created'
)
expect
{
execute_service
}.
to
change
{
test4
.
reload
.
status
}.
from
(
'skipped'
).
to
(
'created'
)
end
end
context
'with ci_same_stage_job_needs FF disabled'
do
before
do
stub_feature_flags
(
ci_same_stage_job_needs:
false
)
end
it
'does nothing with the build'
do
expect
{
execute_service
}.
not_to
change
{
test4
.
reload
.
status
}
end
end
end
end
context
'when the pipeline is a downstream pipeline and the bridge is depended'
do
context
'when the pipeline is a downstream pipeline and the bridge is depended'
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