]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script/clean-ci: allow specifying custom remote name to push/fetch 61755/head
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 11 Feb 2025 16:07:24 +0000 (11:07 -0500)
committerPatrick Donnelly <pdonnell@ibm.com>
Tue, 11 Feb 2025 16:07:24 +0000 (11:07 -0500)
Github actions want to use remote==origin because of how ceph-ci is checked
out.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/script/clean-ci

index 5a2b84c8493ce42b8b43e4de571f94e9a3d734d7..555cdc346b6e9083e0aad56008d34b1449c997d9 100755 (executable)
@@ -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=<relative time>]\n' "$0"
+                printf '%s: [--dry-run] [--since=<relative date>] [--remote=<remote>]\n' "$0"
+                printf '\t--since=<relative date> is the same as in date(3) --date switch\n'
+                printf '\t--remote=<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