Skip to content

fix(ci): guard the matrix deployment jobs against an empty job list - #2095

Merged
milandufek merged 1 commit into
masterfrom
md-fix-empty-matrix-deployment-jobs
Aug 25, 2026
Merged

fix(ci): guard the matrix deployment jobs against an empty job list#2095
milandufek merged 1 commit into
masterfrom
md-fix-empty-matrix-deployment-jobs

Conversation

@milandufek

@milandufek milandufek commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Symptom

PR #2092's gate failed twice on a base that already contained #2093 and #2094 (32836679962, 32837479726) — with no failing job anywhere. Every job was success or skipped, yet ready-to-merge went red:

✓ prepare-env                          → 🟢 success
❌ gooddata-ruby-lcm-promote-pipeline  → 🔴 failure

alls-green received "gooddata-ruby-lcm-promote-pipeline": {"result": "failure", "outputs": {}} while all 15 of its visible children were green or skipped.

Root cause

wait-for-deployment builds its matrix from build-helmreleases.outputs.staging_helmreleases and never checked it for '[]'. A matrix expanding to zero combinations cannot produce a job, so the reusable-workflow call reports failure.

The evidence lines up exactly:

  • build-helmreleases logged There is nothing to update for chart lcm-bricks in cluster 62, skipping..., and staging_hrs=$(echo "$hrs_per_cluster" | jq -c '."62" // []') therefore emitted staging_helmreleases=[].
  • The pipeline defines 16 jobs. 15 have a check run on the merge-queue commit (936ec244). The one missing entirely is wait-for-deployment — note that promote-to-stable, lcm-integration-e2e and the rest are all present as skipped, so absence here is distinct from being skipped.
  • No wait-for-deployment entry exists in the downloaded run log archive either.

Why it appeared only after #2094

This is not a regression from #2094 — that PR removed the failure that was masking it.

wait-for-deployment's condition includes !contains(needs.*.result, 'failure'), and create-staging-pr is one of its needs.

create-staging-pr wait-for-deployment if matrix evaluated? outcome
before #2094 failure (empty commit) false no job skippedrun 32728855771
after #2094 success (correct no-op) true yes → [] job cannot be created → parent failure

staging_helmreleases is empty whenever stg1 already runs the built chart — the normal state after an earlier attempt delivered its staging PR, which is what gitops-deployments#26557 did here at 11:07Z on 24 Aug.

Fix

Apply the convention the rest of this file already follows. services-build (lines 98-99) and helm-charts-build (151-152) both guard with != '[]' && != ''; the two jobs consuming build-helmreleases outputs were the only ones that did not.

create-auto-merge-prod-pr has the identical defect on updated_prod_cluster_names. It is latent in this repo because the gate sets AUTO_MERGE: false, but it is live for any consumer that auto-merges into an already up-to-date production cluster — so it is fixed here too rather than left to be rediscovered.

After this change all six matrix jobs are guarded:

  dockerfiles-validation       matrix<-images                     guard=YES
  charts-validation            matrix<-charts                     guard=YES
  services-build               matrix<-images                     guard=YES
  helm-charts-build            matrix<-charts                     guard=YES
  wait-for-deployment          matrix<-staging_helmreleases       guard=YES
  create-auto-merge-prod-pr    matrix<-updated_prod_cluster_names guard=YES

Expected effect on #2092

wait-for-deployment skips cleanly → lcm-integration-e2e skips → promote-to-stable runs (it needs only build-helmreleases), publishing stable/lcm-bricks:2.0.9create-manual-merge-prod-pr opens a real prod PR → ready-to-merge passes via allowed-skips.

⚠️ Staging verification is still skipped in that path. 2.0.9 did deploy to stg1 on 24 Aug, but wait-for-deployment never got a runner that run, so the rollout was never confirmed green. Check the stg1 lcm-bricks HelmRelease is Ready before merging the prod PR.

Note on upstream

These workflows are a verbatim fork of gooddata/github-actions/.github/workflows/ii-*, which 23 other repos consume. Upstream still carries this bug plus the two fixed in #2093 and #2094. Worth porting all three.

Testing

lcm-pipeline.yaml parses (ruby -ryaml, 16 jobs). Every strategy.matrix job was enumerated programmatically and checked for a matching != '[]' guard — output above. The empty-matrix path is only exercisable by a real chart change through the merge queue; #2092 is that change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved deployment workflow reliability by skipping wait and production PR steps when no Helm releases are available.
    • Added checks to prevent these steps from running with empty release lists.

wait-for-deployment builds its matrix from
build-helmreleases.outputs.staging_helmreleases, and
create-auto-merge-prod-pr from updated_prod_cluster_names. Neither checked
the value for '[]' first, unlike every other matrix job in this file
(services-build and helm-charts-build both guard on != '[]' && != '').

A matrix that expands to zero combinations cannot produce a job, so the
reusable-workflow call reports failure. On PR #2092 that surfaced as a
gate failure with no failing job anywhere: 15 of the pipeline's 16 jobs
were success or skipped, wait-for-deployment had no check run at all, and
alls-green received gooddata-ruby-lcm-promote-pipeline result=failure with
empty outputs.

The trigger was #2094. Before it, create-staging-pr failed outright when
there was nothing to deploy, so wait-for-deployment's
!contains(needs.*.result, 'failure') was false and the job was skipped
before its matrix was ever evaluated -- it showed up as 'skipped' in run
32728855771. Once create-staging-pr correctly succeeded on a no-op, the
condition passed, the matrix was evaluated for the first time in this
state, and it was empty. #2094 did not introduce this, it removed the
failure that was masking it.

staging_helmreleases is empty whenever stg1 already runs the built chart,
which is the normal state after a previous attempt delivered its staging
PR -- gitops-deployments#26557 in this case.

create-auto-merge-prod-pr carries the same defect. It is latent here
because the gate sets AUTO_MERGE: false, but it is live for any consumer
that auto-merges into an already up-to-date production cluster.

JIRA: GRIF-518
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 781dd6a9-894b-473d-aa2f-3620e24caaa5

📥 Commits

Reviewing files that changed from the base of the PR and between d227561 and 07f8f9b.

📒 Files selected for processing (1)
  • .github/workflows/lcm-pipeline.yaml

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The workflow adds checks that prevent deployment wait and automatic production PR jobs from running when their related output lists are empty arrays or empty strings.

Changes

LCM output guards

Layer / File(s) Summary
Output-presence conditions
.github/workflows/lcm-pipeline.yaml
The deployment wait job requires a nonempty staging_helmreleases value. The automatic production PR job requires a nonempty updated_prod_cluster_names value.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 07f8f

The change makes empty CI deployment matrices skip cleanly instead of reporting a false failure; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: santos1709

Poem

A rabbit checks the release list bright
Empty arrays stay out of sight
Staging waits when names are there
Production PRs hop with care
Clean outputs guide the night

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing matrix deployment jobs from running with an empty job list.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)


Comment @coderabbitai help to get the list of available commands.

@milandufek
milandufek enabled auto-merge August 25, 2026 10:55

@zhabba zhabba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪖

@milandufek
milandufek added this pull request to the merge queue Aug 25, 2026
Merged via the queue into master with commit 01073cf Aug 25, 2026
27 of 28 checks passed
@milandufek
milandufek deleted the md-fix-empty-matrix-deployment-jobs branch August 25, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants