From 7713f540bbd7a6a139c59d4e414f286bb64f16cd Mon Sep 17 00:00:00 2001 From: Tomas Hrcka Date: Oct 20 2023 08:10:54 +0000 Subject: [releng] Move distgit branches removal sop from infra to releng Signed-off-by: Tomas Hrcka --- diff --git a/modules/releng_misc_guide/pages/sop_remote_dist_git_branches.adoc b/modules/releng_misc_guide/pages/sop_remote_dist_git_branches.adoc index 0ff5f89..5413899 100644 --- a/modules/releng_misc_guide/pages/sop_remote_dist_git_branches.adoc +++ b/modules/releng_misc_guide/pages/sop_remote_dist_git_branches.adoc @@ -1,43 +1,96 @@ -== Remove dist-git branches += How to remove a git branch in a dist-git repository -=== Description +Historically we did not allow to remove git branches in dist-git repository, but +FESCo recently approved their removal *if and only if* all the commits in the +branch to be deleted can be reached from another branch. +This is a requirement to ensure that if any of the commits were used in a build, +we still have the commit accessible and thus we are able to reproduce the build +if needed. -Release Engineering is often asked by maintainers to remove branches in -dist-git by maintainers. +There is a script in the releng repository to use to check if a branch can +safely be deleted. -=== Action +So here are the steps to follow to remove the branch `` from the package +``. -. Log into batcave01 +. Clone the releng repo if you do not already have it: + -.... -ssh @batcave01.iad2.fedoraproject.org -.... -. Get root shell -. Log into pkgs01.iad2.fedoraproject.org : +---- +git clone https://pagure.io/releng.git +---- + +. Pull the latest changes: ++ +---- +pushd releng && git pull --rebase && popd +---- + +. Clone the `` package locally: ++ +---- +fedpkg clone +---- + +. Checkout the branch: + -.... +---- +cd clone && git checkout +---- + +. Run the script: ++ +---- +python ../releng/scripts/distgit-branch-unused.py +---- ++ +(If needed, see the ``--help`` of the script for more information) + + +. If the script returns that the branch is safe to delete: + +.. Go to pkgs01 as root ++ +---- ssh pkgs01.iad2.fedoraproject.org -.... -. Change to the package's directory +---- + +.. Go to the git repository: + -.... -cd /srv/git/rpms/.git/ -.... -. Remove the branch +---- +cd /srv/git/repositories//.git +---- + +.. Move the head of the branch (this allows to recover it later if needed): + -.... -git branch -D -.... +-- + +---- +mv refs/heads/ heads_ +---- -=== Verification +Sometimes the ref is in the `packed-refs` file, in that case: + +---- +grep packed-refs > heads_ +---- + +Then remove the line from `packed-refs` file +-- + +. On your local clone of ``, check that the branch was deleted upstream: ++ +-- -To verify just list the branches. +---- +git fetch -p +---- -.... -git branch -.... +This should show something like: -=== Consider Before Running +---- +$ git fetch -p +From ssh://pkgs.fedoraproject.org// +- [deleted] (none) -> origin/ +---- -Make sure that the branch in question isn't one of our pre-created -branches `f??/rawhide`, `olpc?/rawhide`, `el?/rawhide` +--