This is an automated email from the ASF dual-hosted git repository.

kszucs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new d584b8d7a1 ARROW-16665: [Release] Update binary submit to track binary 
submission tasks on automatically created PR (#13612)
d584b8d7a1 is described below

commit d584b8d7a1c1a4ee1a658bcf9cde9f3a85ae172b
Author: Raúl Cumplido <[email protected]>
AuthorDate: Mon Jul 25 10:05:04 2022 +0200

    ARROW-16665: [Release] Update binary submit to track binary submission 
tasks on automatically created PR (#13612)
    
    This PR updated the binary submission job to also generate badges to track 
the jobs on the newly created PR to track release verification tasks.
    I have tested locally with the following:
    ```
    archery crossbow submit \
        --no-fetch \
        --job-prefix raul-testing-tracking-crossbow-job \
        --arrow-version 8.0.0-rc0 \
        --arrow-remote "https://github.com/apache/arrow"; \
        --arrow-branch apache-arrow-8.0.0 \
        --group example \
        --track-on-pr-titled "WIP: Investigate verify rc linux failures"
    ```
    and the comments generated can be seen on the expected PR: 
https://github.com/apache/arrow/pull/13478#issuecomment-1184509765
    I've had an issue with the submission of jobs due to a CROSSBOW token but 
this is for the `queue.push()` which hasn't been changed.
    
    Authored-by: Raúl Cumplido <[email protected]>
    Signed-off-by: Krisztián Szűcs <[email protected]>
---
 dev/archery/archery/crossbow/cli.py  | 37 +++++++++++++++++++++++++++++++++++-
 dev/archery/archery/crossbow/core.py |  2 +-
 dev/release/03-binary-submit.sh      |  9 +++++++++
 3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/dev/archery/archery/crossbow/cli.py 
b/dev/archery/archery/crossbow/cli.py
index 04312208c1..8bdc490958 100644
--- a/dev/archery/archery/crossbow/cli.py
+++ b/dev/archery/archery/crossbow/cli.py
@@ -22,7 +22,7 @@ import click
 
 from .core import Config, Repo, Queue, Target, Job, CrossbowError
 from .reports import (ChatReport, Report, ReportUtils, ConsoleReport,
-                      EmailReport)
+                      EmailReport, CommentReport)
 from ..utils.source import ArrowSources
 
 
@@ -285,6 +285,41 @@ def status(obj, job_name, fetch, task_filters):
     report.show(output)
 
 
[email protected]()
[email protected]('--arrow-remote', '-r', default=None,
+              help='Set GitHub remote explicitly, which is going to be cloned '
+                   'on the CI services. Note, that no validation happens '
+                   'locally. Examples: https://github.com/apache/arrow or '
+                   'https://github.com/raulcd/arrow.')
[email protected]('--crossbow', '-c', default='ursacomputing/crossbow',
+              help='Crossbow repository on github to use')
[email protected]('--fetch/--no-fetch', default=True,
+              help='Fetch references (branches and tags) from the remote')
[email protected]('--github-token', envvar='ARROW_GITHUB_API_TOKEN',
+              help='OAuth token to create comments in the arrow repo. '
+                   'Only necessary if --track-on-pr-titled is set.')
[email protected]('--job-name', required=True)
[email protected]('--pr-title', required=True,
+              help='Track the job submitted on PR with given title')
[email protected]_obj
+def report_pr(obj, arrow_remote, crossbow, fetch, github_token, job_name,
+              pr_title):
+    arrow = obj['arrow']
+    queue = obj['queue']
+    if fetch:
+        queue.fetch()
+    job = queue.get(job_name)
+
+    report = CommentReport(job, crossbow_repo=crossbow)
+    target_arrow = Repo(path=arrow.path, remote_url=arrow_remote)
+    pull_request = target_arrow.github_pr(title=pr_title,
+                                          github_token=github_token,
+                                          create=False)
+    # render the response comment's content on the PR
+    pull_request.create_comment(report.show())
+    click.echo(f'Job is tracked on PR {pull_request.html_url}')
+
+
 @crossbow.command()
 @click.argument('prefix', required=True)
 @click.option('--fetch/--no-fetch', default=True,
diff --git a/dev/archery/archery/crossbow/core.py 
b/dev/archery/archery/crossbow/core.py
index 4053c3219e..49f915ec82 100644
--- a/dev/archery/archery/crossbow/core.py
+++ b/dev/archery/archery/crossbow/core.py
@@ -542,7 +542,7 @@ class Repo:
                         'Unsupported upload method {}'.format(method)
                     )
 
-    def github_pr(self, title, head, base="master", body=None,
+    def github_pr(self, title, head=None, base="master", body=None,
                   github_token=None, create=False):
         github_token = github_token or self.github_token
         repo = self.as_github_repo(github_token=github_token)
diff --git a/dev/release/03-binary-submit.sh b/dev/release/03-binary-submit.sh
index b22a54bfd8..47fd7ad49f 100755
--- a/dev/release/03-binary-submit.sh
+++ b/dev/release/03-binary-submit.sh
@@ -43,3 +43,12 @@ archery crossbow submit \
     --arrow-remote "https://github.com/${ARROW_REPOSITORY}"; \
     --arrow-branch ${ARROW_BRANCH} \
     --group packaging
+
+# archery will add a comment to the automatically generated PR to track
+# the submitted jobs
+job_name=$(archery crossbow latest-prefix ${crossbow_job_prefix})
+archery crossbow report-pr \
+    --no-fetch \
+    --arrow-remote "https://github.com/${ARROW_REPOSITORY}"; \
+    --job-name ${job_name} \
+    --pr-title "WIP: [Release] Verify ${release_candidate_branch}"

Reply via email to