]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/ptl-tool: allow not pushing branch to ceph-ci 57529/head
authorRishabh Dave <ridave@redhat.com>
Thu, 16 May 2024 16:57:10 +0000 (22:27 +0530)
committerRishabh Dave <ridave@redhat.com>
Mon, 20 May 2024 05:35:13 +0000 (11:05 +0530)
Sometimes we need a branch but don't want to launch builds on shaman for
it. For such cases, provide an option that allows not pushing the branch
to ceph-ci.

Creating a branch that'll only be passed to "teuthology-suite" option
"--suite-branch" is an example of such a case.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/script/ptl-tool.py

index 970dae7b81bb84d3e5e7aabe66cae8838ea8de39..110a318a4ec625ade86038bb2d8d8c58d794efad 100755 (executable)
 # ...
 #
 #
+# Merging all PRs labeled 'wip-pdonnell-testing' into a new test branch but
+# NOT pushing that branch to ceph-ci repo (pushing to ceph-ci repo usually
+# happens only when we use --create-qa or --update-qa):
+#
+# $ src/script/ptl-tool.py --pr-label wip-pdonnell-testing --branch main --no-push-ci
+# Adding labeled PR #18805 to PR list
+# Adding labeled PR #18774 to PR list
+# Adding labeled PR #18600 to PR list
+# Will merge PRs: [18805, 18774, 18600]
+# Detaching HEAD onto base: main
+# Merging PR #18805
+# Merging PR #18774
+# Merging PR #18600
+# Checked out new branch wip-pdonnell-testing-20171108.054517
+# Created tag testing/wip-pdonnell-testing-20171108.054517
+#
+#
 # Merging PR #1234567 and #2345678 into a new test branch with a testing label added to the PR:
 #
 # $ src/script/ptl-tool.py 1234567 2345678 --label wip-pdonnell-testing
 # Merging PR #18192
 # Leaving HEAD detached; no branch anchors your commit
 
-
 # TODO
 # Look for check failures?
 
@@ -477,8 +493,9 @@ def build_branch(args):
         if args.qa_tags:
             custom_fields.append({'id': REDMINE_CUSTOM_FIELD_ID_QA_TAGS, 'value': args.qa_tags})
 
-        G.git.push(CI_REMOTE_URL, branch) # for shaman
-        G.git.push(CI_REMOTE_URL, tag.name) # for archival
+        if not args.no_push_ci:
+            G.git.push(CI_REMOTE_URL, branch) # for shaman
+            G.git.push(CI_REMOTE_URL, tag.name) # for archival
         origin_url = f'{BASE_PROJECT}/{CI_REPO}/commits/{tag.name}'
         custom_fields.append({'id': REDMINE_CUSTOM_FIELD_ID_GIT_BRANCH, 'value': origin_url})
 
@@ -548,6 +565,8 @@ def main():
     parser.add_argument('--qa-tags', dest='qa_tags', action='store', help='QA tags for tracker')
     parser.add_argument('--stop-at-built', dest='stop_at_built', action='store_true', help='stop execution when branch is built')
     parser.add_argument('--update-qa', dest='update_qa', action='store', help='update QA run ticket')
+    parser.add_argument('--no-push-ci', dest='no_push_ci', action='store_true',
+                        help='don\'t push branch to ceph-ci repo')
     parser.add_argument('prs', metavar="PR", type=int, nargs='*', help='Pull Requests to merge')
     args = parser.parse_args(argv)