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
af23fa47
Commit
af23fa47
authored
Aug 28, 2021
by
Stan Hu
Committed by
Lee Tickett
Aug 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'stuck-ci-jobs-worker-optimize-running' into 'master'"
This reverts merge request !68891 Changelog: other
parent
4a3dbc31
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
35 deletions
+13
-35
app/models/commit_status.rb
app/models/commit_status.rb
+1
-1
app/workers/stuck_ci_jobs_worker.rb
app/workers/stuck_ci_jobs_worker.rb
+4
-6
config/feature_flags/development/ci_new_query_for_running_stuck_jobs.yml
...flags/development/ci_new_query_for_running_stuck_jobs.yml
+0
-8
spec/workers/stuck_ci_jobs_worker_spec.rb
spec/workers/stuck_ci_jobs_worker_spec.rb
+8
-20
No files found.
app/models/commit_status.rb
View file @
af23fa47
...
@@ -58,8 +58,8 @@ class CommitStatus < Ci::ApplicationRecord
...
@@ -58,8 +58,8 @@ class CommitStatus < Ci::ApplicationRecord
scope
:in_pipelines
,
->
(
pipelines
)
{
where
(
pipeline:
pipelines
)
}
scope
:in_pipelines
,
->
(
pipelines
)
{
where
(
pipeline:
pipelines
)
}
scope
:eager_load_pipeline
,
->
{
eager_load
(
:pipeline
,
project:
{
namespace: :route
})
}
scope
:eager_load_pipeline
,
->
{
eager_load
(
:pipeline
,
project:
{
namespace: :route
})
}
scope
:with_pipeline
,
->
{
joins
(
:pipeline
)
}
scope
:with_pipeline
,
->
{
joins
(
:pipeline
)
}
scope
:created_at_before
,
->
(
date
)
{
where
(
'ci_builds.created_at < ?'
,
date
)
}
scope
:updated_at_before
,
->
(
date
)
{
where
(
'ci_builds.updated_at < ?'
,
date
)
}
scope
:updated_at_before
,
->
(
date
)
{
where
(
'ci_builds.updated_at < ?'
,
date
)
}
scope
:created_at_before
,
->
(
date
)
{
where
(
'ci_builds.created_at < ?'
,
date
)
}
scope
:updated_before
,
->
(
lookback
:,
timeout
:)
{
scope
:updated_before
,
->
(
lookback
:,
timeout
:)
{
where
(
'(ci_builds.created_at BETWEEN ? AND ?) AND (ci_builds.updated_at BETWEEN ? AND ?)'
,
lookback
,
timeout
,
lookback
,
timeout
)
where
(
'(ci_builds.created_at BETWEEN ? AND ?) AND (ci_builds.updated_at BETWEEN ? AND ?)'
,
lookback
,
timeout
,
lookback
,
timeout
)
}
}
...
...
app/workers/stuck_ci_jobs_worker.rb
View file @
af23fa47
...
@@ -63,12 +63,10 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker
...
@@ -63,12 +63,10 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker
end
end
def
running_timed_out_builds
def
running_timed_out_builds
if
Feature
.
enabled?
(
:ci_new_query_for_running_stuck_jobs
)
Ci
::
Build
.
running
.
where
(
# rubocop: disable CodeReuse/ActiveRecord
running_builds
=
Ci
::
Build
.
running
.
created_at_before
(
BUILD_RUNNING_OUTDATED_TIMEOUT
.
ago
).
order
(
created_at: :asc
,
project_id: :asc
)
# rubocop: disable CodeReuse/ActiveRecord
'ci_builds.updated_at < ?'
,
Ci
::
Build
.
id_in
(
running_builds
).
updated_at_before
(
BUILD_RUNNING_OUTDATED_TIMEOUT
.
ago
)
BUILD_RUNNING_OUTDATED_TIMEOUT
.
ago
else
)
Ci
::
Build
.
running
.
updated_at_before
(
BUILD_RUNNING_OUTDATED_TIMEOUT
.
ago
)
end
end
end
def
try_obtain_lease
def
try_obtain_lease
...
...
config/feature_flags/development/ci_new_query_for_running_stuck_jobs.yml
deleted
100644 → 0
View file @
4a3dbc31
---
name
:
ci_new_query_for_running_stuck_jobs
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68891
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/339264
milestone
:
'
14.3'
type
:
development
group
:
group::pipeline execution
default_enabled
:
false
spec/workers/stuck_ci_jobs_worker_spec.rb
View file @
af23fa47
...
@@ -186,7 +186,6 @@ RSpec.describe StuckCiJobsWorker do
...
@@ -186,7 +186,6 @@ RSpec.describe StuckCiJobsWorker do
end
end
end
end
shared_examples
'job is running'
do
context
'when job is running'
do
context
'when job is running'
do
let
(
:status
)
{
'running'
}
let
(
:status
)
{
'running'
}
...
@@ -202,17 +201,6 @@ RSpec.describe StuckCiJobsWorker do
...
@@ -202,17 +201,6 @@ RSpec.describe StuckCiJobsWorker do
it_behaves_like
'job is unchanged'
it_behaves_like
'job is unchanged'
end
end
end
end
end
it_behaves_like
'job is running'
context
'when ci_new_query_for_running_stuck_jobs feature flag is disabled'
do
before
do
stub_feature_flags
(
ci_new_query_for_running_stuck_jobs:
false
)
end
it_behaves_like
'job is running'
end
%w(success skipped failed canceled)
.
each
do
|
status
|
%w(success skipped failed canceled)
.
each
do
|
status
|
context
"when job is
#{
status
}
"
do
context
"when job is
#{
status
}
"
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