Show error alert when CI variables cache is unavailable
What does this MR do and why?
This MR improves the user experience when CI/CD variables fail to load on the "Run Pipeline" page due to backend infrastructure issues.
Problem: When Sidekiq is saturated or experiencing high load, the ReactiveCache job for fetching CI config variables gets queued but never executes. Currently, the GraphQL query returns null
, which the frontend treats as "no variables exist" - creating a silent failure where users cannot distinguish between legitimate empty state and an error state.
Solution: This MR adds proper error handling across the stack:
- Backend service now raises an error when cache is not ready
- GraphQL resolver propagates this error to the frontend
- Frontend displays a user-friendly error message
Closes #535560
Screenshots or screen recordings
Before
GraphQL `ciConfigVariables` query response
{
"data": {
"project": {
"id": "gid://gitlab/Project/22",
"ciConfigVariables": null,
"__typename": "Project"
}
}
}
After
GraphQL `ciConfigVariables` query response
{
"errors": [
{
"message": "Failed to retrieve CI configuration variables from cache.",
"locations": [
{
"line": 4,
"column": 5
}
],
"path": [
"project",
"ciConfigVariables"
]
}
],
"data": {
"project": {
"id": "gid://gitlab/Project/22",
"ciConfigVariables": null,
"__typename": "Project"
}
}
}
How to set up and validate locally
Prerequisites
- Ensure GDK is running
- Create a test project with a
.gitlab-ci.yml
that has prefilled variables:
variables:
DEPLOY_ENVIRONMENT:
value: "staging"
description: "The environment to deploy to (staging, production)"
VERSION:
value: "1.0.0"
description: "Version number for the deployment"
stages:
- test
test_job:
stage: test
script:
- echo "Deploying to $DEPLOY_ENVIRONMENT"
- echo "Version $VERSION"
How to setup and validate locally
-
Stop Sidekiq workers:
gdk stop rails-background-jobs
-
Clear the cache for your project:
gdk rails console
In the console:
Rails.cache.clear exit
-
Navigate to the Run Pipeline page:
- Go to your project
- Click Build → Pipelines → Run pipeline
-
Verify the error is displayed:
- You should see an alert banner with the message: "Failed to retrieve CI configuration variables from cache."
- Previously, the page would show no variables without any indication of an error
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.