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
265605b4
Commit
265605b4
authored
Aug 10, 2021
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lm-fix-ssjn' into 'master'
Fix stage_dependent_jobs See merge request gitlab-org/gitlab!67337
parents
456f28e5
ddeda755
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
10 deletions
+138
-10
app/services/ci/after_requeue_job_service.rb
app/services/ci/after_requeue_job_service.rb
+1
-1
spec/services/ci/after_requeue_job_service_spec.rb
spec/services/ci/after_requeue_job_service_spec.rb
+13
-9
spec/services/ci/pipeline_processing/test_cases/dag_test_manual_same_and_different_stage_needs.yml
..._cases/dag_test_manual_same_and_different_stage_needs.yml
+54
-0
spec/services/ci/pipeline_processing/test_cases/dag_test_manual_same_stage_needs.yml
...rocessing/test_cases/dag_test_manual_same_stage_needs.yml
+70
-0
No files found.
app/services/ci/after_requeue_job_service.rb
View file @
265605b4
...
@@ -38,7 +38,7 @@ module Ci
...
@@ -38,7 +38,7 @@ module Ci
end
end
def
stage_dependent_jobs
(
processable
)
def
stage_dependent_jobs
(
processable
)
skipped_jobs
(
processable
).
scheduling_type_stage
.
after_stage
(
processable
.
stage_idx
)
skipped_jobs
(
processable
).
after_stage
(
processable
.
stage_idx
)
end
end
def
needs_dependent_jobs
(
processable
)
def
needs_dependent_jobs
(
processable
)
...
...
spec/services/ci/after_requeue_job_service_spec.rb
View file @
265605b4
...
@@ -8,37 +8,41 @@ RSpec.describe Ci::AfterRequeueJobService do
...
@@ -8,37 +8,41 @@ RSpec.describe Ci::AfterRequeueJobService do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage_idx:
0
,
name:
'build'
)
}
let!
(
:test1
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
stage_idx:
1
)
}
let!
(
:test1
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
stage_idx:
1
)
}
let!
(
:test2
)
{
create
(
:ci_build
,
:skipped
,
pipeline:
pipeline
,
stage_idx:
1
)
}
let!
(
:test2
)
{
create
(
:ci_build
,
:skipped
,
pipeline:
pipeline
,
stage_idx:
1
)
}
let!
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage_idx:
0
,
name:
'build'
)
}
let!
(
:test3
)
{
create
(
:ci_build
,
:skipped
,
:dependent
,
pipeline:
pipeline
,
stage_idx:
1
,
needed:
build
)
}
let!
(
:deploy
)
{
create
(
:ci_build
,
:skipped
,
:dependent
,
pipeline:
pipeline
,
stage_idx:
2
,
needed:
test3
)
}
subject
(
:execute_service
)
{
described_class
.
new
(
project
,
user
).
execute
(
build
)
}
subject
(
:execute_service
)
{
described_class
.
new
(
project
,
user
).
execute
(
build
)
}
it
'marks subsequent skipped jobs as processable'
do
it
'marks subsequent skipped jobs as processable'
do
expect
(
test1
.
reload
).
to
be_success
expect
(
test1
.
reload
).
to
be_success
expect
(
test2
.
reload
).
to
be_skipped
expect
(
test2
.
reload
).
to
be_skipped
expect
(
test3
.
reload
).
to
be_skipped
expect
(
deploy
.
reload
).
to
be_skipped
execute_service
execute_service
expect
(
test1
.
reload
).
to
be_success
expect
(
test1
.
reload
).
to
be_success
expect
(
test2
.
reload
).
to
be_created
expect
(
test2
.
reload
).
to
be_created
expect
(
test3
.
reload
).
to
be_created
expect
(
deploy
.
reload
).
to
be_created
end
end
context
'when there is a job need from the same stage'
do
context
'when there is a job need from the same stage'
do
let!
(
:test
3
)
do
let!
(
:test
4
)
do
create
(
:ci_build
,
create
(
:ci_build
,
:skipped
,
:skipped
,
:dependent
,
pipeline:
pipeline
,
pipeline:
pipeline
,
stage_idx:
0
,
stage_idx:
0
,
scheduling_type: :dag
)
scheduling_type: :dag
,
end
needed:
build
)
before
do
create
(
:ci_build_need
,
build:
test3
,
name:
'build'
)
end
end
it
'marks subsequent skipped jobs as processable'
do
it
'marks subsequent skipped jobs as processable'
do
expect
{
execute_service
}.
to
change
{
test
3
.
reload
.
status
}.
from
(
'skipped'
).
to
(
'created'
)
expect
{
execute_service
}.
to
change
{
test
4
.
reload
.
status
}.
from
(
'skipped'
).
to
(
'created'
)
end
end
context
'with ci_same_stage_job_needs FF disabled'
do
context
'with ci_same_stage_job_needs FF disabled'
do
...
@@ -47,7 +51,7 @@ RSpec.describe Ci::AfterRequeueJobService do
...
@@ -47,7 +51,7 @@ RSpec.describe Ci::AfterRequeueJobService do
end
end
it
'does nothing with the build'
do
it
'does nothing with the build'
do
expect
{
execute_service
}.
not_to
change
{
test
3
.
reload
.
status
}
expect
{
execute_service
}.
not_to
change
{
test
4
.
reload
.
status
}
end
end
end
end
end
end
...
...
spec/services/ci/pipeline_processing/test_cases/dag_test_manual_same_and_different_stage_needs.yml
0 → 100644
View file @
265605b4
config
:
stages
:
[
first
,
second
,
third
]
job_a
:
when
:
manual
stage
:
first
script
:
-
echo
job_b
:
when
:
manual
stage
:
second
script
:
-
echo
job_c
:
needs
:
[
"
job_b"
]
stage
:
third
script
:
-
echo
job_d
:
needs
:
[
"
job_a"
]
stage
:
third
script
:
-
echo
init
:
expect
:
pipeline
:
skipped
stages
:
first
:
skipped
second
:
skipped
third
:
skipped
jobs
:
job_a
:
manual
job_b
:
manual
job_c
:
skipped
job_d
:
skipped
transitions
:
-
event
:
play
jobs
:
[
job_b
]
expect
:
pipeline
:
pending
stages
:
first
:
skipped
second
:
pending
third
:
pending
jobs
:
job_a
:
manual
job_b
:
pending
job_c
:
created
job_d
:
skipped
spec/services/ci/pipeline_processing/test_cases/dag_test_manual_same_stage_needs.yml
0 → 100644
View file @
265605b4
config
:
stages
:
[
first
,
second
,
third
,
fourth
]
first_job
:
stage
:
first
script
:
-
echo
second_job
:
stage
:
second
script
:
-
echo
when
:
manual
third_job
:
stage
:
third
needs
:
[
"
second_job"
]
script
:
-
echo
fourth_job
:
stage
:
fourth
needs
:
[
"
third_job"
]
script
:
-
echo
init
:
expect
:
pipeline
:
pending
stages
:
first
:
pending
second
:
created
third
:
created
fourth
:
created
jobs
:
first_job
:
pending
second_job
:
created
third_job
:
created
fourth_job
:
created
transitions
:
-
event
:
success
jobs
:
[
first_job
]
expect
:
pipeline
:
success
stages
:
first
:
success
second
:
skipped
third
:
skipped
fourth
:
skipped
jobs
:
first_job
:
success
second_job
:
manual
third_job
:
skipped
fourth_job
:
skipped
-
event
:
play
jobs
:
[
second_job
]
expect
:
pipeline
:
running
stages
:
first
:
success
second
:
pending
third
:
skipped
fourth
:
skipped
jobs
:
first_job
:
success
second_job
:
pending
third_job
:
created
fourth_job
:
created
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