Add source filter to newest_first method in the Pipeline model

What does this MR do and why?

Add source filter to newest_first method in the Pipeline model

This fixes the post-merge pipeline widget status showing the latest pipeline regardless of its source

References

Screenshots or screen recordings

How to set up and validate locally

  1. Setup a project with the following pipeline configuration
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" 
    - if: $CI_COMMIT_BRANCH

branchpipeline: 
  script:
    - cat nonexistentfile.yml 
  except:
    - schedules
    - merge_requests

mrpipeline:
  script:
    - sleep 5
  only:
    - merge_requests 

schedulepipeline: 
  script:
    - sleep 5
  only:
    - schedules
  1. Create an MR and merge it to this project, take note of the post-merge pipeline ID
  2. Create a pipeline schedule and either wait for it to run or hit the play button in the pipeline schedule to start it
  3. Go back to the MR and see that the pipeline ID didn't change for the post-merge pipeline status widget

Screenshot_2025-04-30_at_10.14.19_a.m.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jose Ivan Vargas

Merge request reports

Loading