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
836a7e86
Commit
836a7e86
authored
Sep 17, 2021
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log scheduled pipeline creation failure
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
905e6500
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
app/workers/run_pipeline_schedule_worker.rb
app/workers/run_pipeline_schedule_worker.rb
+9
-2
spec/workers/run_pipeline_schedule_worker_spec.rb
spec/workers/run_pipeline_schedule_worker_spec.rb
+15
-0
No files found.
app/workers/run_pipeline_schedule_worker.rb
View file @
836a7e86
...
...
@@ -27,8 +27,9 @@ class RunPipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker
user
,
ref:
schedule
.
ref
)
.
execute!
(
:schedule
,
ignore_skip_ci:
true
,
save_on_errors:
false
,
schedule:
schedule
)
rescue
Ci
::
CreatePipelineService
::
CreateError
# no-op. This is a user operation error such as corrupted .gitlab-ci.yml.
rescue
Ci
::
CreatePipelineService
::
CreateError
=>
e
# This is a user operation error such as corrupted .gitlab-ci.yml. Log the error for debugging purpose.
log_extra_metadata_on_done
(
:pipeline_creation_error
,
e
)
rescue
StandardError
=>
e
error
(
schedule
,
e
)
end
...
...
@@ -37,10 +38,16 @@ class RunPipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker
def
error
(
schedule
,
error
)
failed_creation_counter
.
increment
log_error
(
schedule
,
error
)
track_error
(
schedule
,
error
)
end
def
log_error
(
schedule
,
error
)
Gitlab
::
AppLogger
.
error
"Failed to create a scheduled pipeline. "
\
"schedule_id:
#{
schedule
.
id
}
message:
#{
error
.
message
}
"
end
def
track_error
(
schedule
,
error
)
Gitlab
::
ErrorTracking
.
track_and_raise_for_dev_exception
(
error
,
issue_url:
'https://gitlab.com/gitlab-org/gitlab-foss/issues/41231'
,
...
...
spec/workers/run_pipeline_schedule_worker_spec.rb
View file @
836a7e86
...
...
@@ -68,5 +68,20 @@ RSpec.describe RunPipelineScheduleWorker do
worker
.
perform
(
pipeline_schedule
.
id
,
user
.
id
)
end
end
context
'when pipeline cannot be created'
do
before
do
allow
(
Ci
::
CreatePipelineService
).
to
receive
(
:new
)
{
raise
Ci
::
CreatePipelineService
::
CreateError
}
end
it
'logging a pipeline error'
do
expect
(
worker
)
.
to
receive
(
:log_extra_metadata_on_done
)
.
with
(
:pipeline_creation_error
,
an_instance_of
(
Ci
::
CreatePipelineService
::
CreateError
))
.
and_call_original
worker
.
perform
(
pipeline_schedule
.
id
,
user
.
id
)
end
end
end
end
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