DEVOPS

Pre-merge check that flags risky cache-key changes on GitLab MRs

On every GitLab merge request, detects edits to cache keys, lockfiles, or base images that would invalidate the build cache, estimates the rebuild cost from historical data.

CategoryDevOps
Enginesim
Difficultyintermediate
Triggerevent
Steps5
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerGitLab merge request opened or updatedGitLabGitLab
  • ActionFetch diff and detect cache-key changesGitLabGitLab
  • LogicRisky cache-invalidating change present?
  • ActionEstimate rebuild penalty from historyPostgreSQLPostgres
  • OutputComment warning on the merge requestGitLabGitLab

What it does

When a merge request opens or updates, this flow scans the diff for changes that invalidate the build cache: altered `cache:key` values, new lockfile hashes, or a bumped Docker base image. It looks up how long uncached builds historically took, estimates the added minutes, and leaves an inline warning comment on the MR so the author sees the cost before merging.

When to use it

Use it to shift cache regressions left. Most cache breaks ship by accident in routine dependency bumps; a clear pre-merge heads-up lets the author confirm the change is intentional or scope the cache key more tightly.

How it works

  1. 1A GitLab merge-request webhook fires on open or update.
  2. 2The flow fetches the MR diff and detects cache-invalidating edits.
  3. 3A branch decides whether any risky change is present.
  4. 4If so, it queries Postgres for historical cached-vs-uncached build durations to estimate the penalty.
  5. 5It posts a warning comment on the MR naming the change and the expected slowdown.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect GitLabRepos, MRs, pipelines, registry.
  2. 2
    Connect PostgresAny Postgres URL — query, write, migrate.
  3. 3
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  4. 4
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  5. 5
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.