Skip to content

Pass push options to merge request pipelines creation

Fabio Pitino requested to merge skip-ci-push-option-for-mr-pipelines-2 into master

What does this MR do and why?

Related to #349362 (closed)

This is a second part of !87030 (merged) given that adding a parameter to a sidekiq worker requires a multi-step deployment. In this MR we are passing the push options from Git::BranchPushService to UpdateMergeRequestsWorker and to MergeRequests::CreatePipelineWorker in case of async pipeline creation.

This allows to finally have the merge request pipelines recognizing push options and be skipped properly.

Screenshots or screen recordings

I had to lower the resolution in order to upload the video

skip-ci-on-rebase3

Before After
image image

image

How to set up and validate locally

  • Setup merge request pipelines in .gitlab-ci.yml. commit to a new branch and open a merge request for the changes.
mr-job:
  script: echo
  only: [merge-requests]
normal-job:
  script: echo
  • Ensure the merge request pipeline is created with mr-job only.

  • make a change to main branch. Separate file should be sufficient.

  • The MR should show that it's 1 commit behind the target branch.

  • Use the rebase API to with skip_ci: true

    • curl --request PUT -d skip_ci=true --header "PRIVATE-TOKEN: $GITLAB_LOCALHOST_TOKEN" http://localhost:3000/api/v4/projects/20/merge_requests/2/rebase
  • Ensure that 2 pipelines were skipped: 1 branch pipeline and 1 merge request pipeline

image

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Fabio Pitino

Merge request reports

Loading