Provide the last successful build to CI
## Problem Statement
**Teams waste CI/CD compute resources and developer time running unnecessary tests and checks on every pipeline execution because GitLab doesn't provide pipelines with context about what has changed since the last successful build.**
### Impact
**For Developers:**
* **Wasted time:** Every pipeline runs the full test suite even when only a small subset of code changed
* **Slow feedback loops:** Developers wait for irrelevant tests (e.g., backend tests when only CSS changed)
* **Context switching:** Longer pipeline times mean more interruptions and lost focus
**For Organizations:**
* **Compute waste:** Running full test suites on every commit burns CI minutes unnecessarily
* **Cost inefficiency:** Especially painful for large monorepos where a one-line change triggers thousands of tests
* **Scalability bottleneck:** As codebases grow, pipeline times become prohibitive without intelligent optimization
### Root Cause
GitLab CI jobs currently have **no native way to know**:
* What was the last commit that passed all checks?
* What files/paths changed between now and that successful state?
* Whether the current changes are relevant to this specific job's scope?
This forces teams to either:
1. **Accept the waste** and run everything every time
2. **Build complex workarounds** using git commands, artifacts, and custom scripts that are brittle and hard to maintain
3. **Manually configure** `only:changes` rules that are static and don't account for actual success/failure history
### Desired Outcome
**Pipelines should be able to intelligently scope their work based on what actually changed since the last known-good state**, enabling:
* Conditional test execution (only lint changed files)
* Smart job skipping (skip backend tests if only frontend changed)
* Incremental builds and validations
* Faster feedback with lower resource consumption
### Success Criteria
When solved, teams should be able to:
1. Reference `$CI_LAST_SUCCESSFUL_COMMIT` (or similar) in their pipeline configuration
2. Use `git diff $CI_LAST_SUCCESSFUL_COMMIT` to determine changed files
3. Conditionally execute jobs based on actual changes since last success
4. Reduce pipeline execution time by 30-70% for typical incremental changes
5. Lower CI compute costs proportionally to skipped work
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=14566)
</details>
<!--IssueSummary end-->
issue