From: Patrick Donnelly Date: Tue, 11 Feb 2025 16:07:24 +0000 (-0500) Subject: script/clean-ci: allow specifying custom remote name to push/fetch X-Git-Tag: v20.0.0~190^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b079a079ea395f8e636e988813169899a438fa39;p=ceph.git script/clean-ci: allow specifying custom remote name to push/fetch Github actions want to use remote==origin because of how ceph-ci is checked out. Signed-off-by: Patrick Donnelly --- diff --git a/src/script/clean-ci b/src/script/clean-ci index 5a2b84c8493ce..555cdc346b6e9 100755 --- a/src/script/clean-ci +++ b/src/script/clean-ci @@ -1,13 +1,14 @@ #!/bin/bash -# clean-ci [--dry-run] [--since="relative date"] +# clean-ci [--dry-run] [--since="relative date"] [--remote=remote] # # Cleanup the ceph-ci.git repository branch list by deleting any branch with a # HEAD commit date older than (by default) 3 months. set -e -CEPH_CI=git@github.com:ceph/ceph-ci.git +CEPH_CI=https://github.com/ceph/ceph-ci.git +REMOTE=git@github.com:ceph/ceph-ci.git DRY_RUN=0 SINCE="3 months ago" @@ -37,7 +38,7 @@ function iterate_ci { # Fetch the refs, shallow printf '%s' "$REFS" | \ cut -f2 | \ - git fetch --quiet --depth=1 --refetch --filter=blob:none --stdin "$CEPH_CI" + git fetch --quiet --depth=1 --refetch --filter=blob:none --stdin "$REMOTE" declare -a TO_DELETE @@ -72,12 +73,14 @@ function iterate_ci { } function main { - eval set -- $(getopt --name "$0" --options 'h' --longoptions 'help,dry-run,since:' -- "$@") + eval set -- $(getopt --name "$0" --options 'h' --longoptions 'help,dry-run,since:,remote:' -- "$@") while [ "$#" -gt 0 ]; do case "$1" in -h|--help) - printf '%s: [--dry-run] [--since=]\n' "$0" + printf '%s: [--dry-run] [--since=] [--remote=]\n' "$0" + printf '\t--since= is the same as in date(3) --date switch\n' + printf '\t--remote= is the remote name for ceph-ci to fetch/push to, by default: %s\n' "$REMOTE" exit 0 ;; --dry-run) @@ -88,6 +91,10 @@ function main { SINCE="$2" shift 2 ;; + --remote) + REMOTE="$2" + shift 2 + ;; --) shift break