Backend: Error when fetching pipeline jobs after trigger job has been retried
Summary
The following discussion from !110670 (merged) should be addressed:
I don't think it's related to the current MR, but I faced an issue: after doing a few retries, I cannot access the
jobs
tab of my upstream pipeline. It fails with 500 from GraphQl, complaining aboutundefined method '+' for nil:NilClass
on ci/status/build/retried. The related specs run successfully though. I think it could be worth investigating.
How to reproduce
-
Enable
ci_recreate_downstream_pipeline
-
Update
.gitlab-ci.yml
with a trigger job config. Sample config file :
trigger_job:
stage: build
trigger: 'group-a/project-6'
-
Run the pipeline.
-
In the Pipeline View, click the retry button on the trigger job.
-
After the job is retried, go to the "Jobs" tab, refresh the page and you will see the following:
See a recording of the bug in action:
Screen_Recording_2023-02-07_at_11.28.55_AMFurther details
The error occurs after retrying a trigger job at least once via the Pipeline view.
The error appears to stem from @status.status_tooltip
producing a nil value at lib/gitlab/ci/status/build/retried.rb:9
class Retried < Status::Extended
def status_tooltip
@status.status_tooltip + " (retried)"
end
Proposal
Investigate the root cause of why @status.status_tooltip
for a retried trigger job produces a nil value at the time of calling and implement a fix.
Investigation
It was observed that @status.status_tooltip
draws its value from the label
method, which uses the bridge's description value. Unlike the label
method in lib/gitlab/ci/status/external/common.rb
, the bridge label does not have a fallback value in case description is nil, so the following solution was proposed:
--- a/lib/gitlab/ci/status/bridge/common.rb
+++ b/lib/gitlab/ci/status/bridge/common.rb
@@ -6,7 +6,7 @@ module Status
module Bridge
module Common
def label
- subject.description
+ subject.description.presence || super
end
def has_details?
Implementation
backend | MR |
---|---|
Update CI bridge status label to use core label as fallback | !111639 (merged) |