Skip to content

Add support for configuring --target-branch in gitlab-housekeeper

Dylan Griffith requested to merge support-branch-from-in-housekeeper into master

What does this MR do and why?

The gitlab-housekeeper is a tool for automatically creating merge requests for common housekeeping tasks.

This MR adds the ability to pass --target-branch to gitlab-housekeeper. This allows the gitlab-housekeeper to create MRs in projects which don't use master as the default branch. When we first implemented this we were only using it in gitlab-org/gitlab so we hardcoded master but now we make it configurable so it can be used elsewhere.

How to test

  1. Create a new branch from master called some-branch
  2. Create a commit with anything in the some-branch
  3. Checkout this MR branch
  4. Add a new keep using the example in the README https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper#how-to-implement-a-keep
  5. Run the keep like:
    bundle exec gitlab-housekeeper -k Keeps::PrettyUselessKeep -d --target-branch some-branch
  6. Checkout the branch it created
    git checkout pretty-useless-keep-new_file1
  7. Confirm that it did indeed branch from some-branch by looking for your commit in the logs
    git log -n 2

MR acceptance checklist

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

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Dylan Griffith

Merge request reports