]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
script/ptl-tool: add --stop-at-built flag
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 11 Apr 2024 13:23:30 +0000 (09:23 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 11 Apr 2024 16:34:03 +0000 (12:34 -0400)
To make modifications to the branch before it is tagged and a branch name
created.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/script/ptl-tool.py

index 176f61f22c8c786555a86a3468aed38a277dea30..f16d5ac547a8b7df9dc49bab20866a3f459fca84 100755 (executable)
@@ -113,6 +113,7 @@ import logging
 import os
 import re
 import requests
+import signal
 import sys
 
 from os.path import expanduser
@@ -360,6 +361,11 @@ def build_branch(args):
                 sys.exit(1)
             log.info("Labeled PR #{pr} {label}".format(pr=pr, label=label))
 
+    if args.stop_at_built:
+        log.warning("Stopping execution (SIGSTOP) with built branch for further modification. Foreground when execution should resume (typically `fg`).")
+        signal.raise_signal(signal.SIGSTOP)
+        log.warning("Resuming execution.")
+
     # If the branch is 'HEAD', leave HEAD detached (but use "main" for commit message)
     if branch == 'HEAD':
         log.info("Leaving HEAD detached; no branch anchors your commits")
@@ -400,6 +406,7 @@ def main():
     parser.add_argument('--label', dest='label', action='store', default=default_label, help='label PRs for testing')
     parser.add_argument('--pr-label', dest='pr_label', action='store', help='label PRs for testing')
     parser.add_argument('--no-credits', dest='credits', action='store_false', help='skip indication search (Reviewed-by, etc.)')
+    parser.add_argument('--stop-at-built', dest='stop_at_built', action='store_true', help='stop execution when branch is built')
     parser.add_argument('prs', metavar="PR", type=int, nargs='*', help='Pull Requests to merge')
     args = parser.parse_args(argv)
     return build_branch(args)