Skip to content

Apache DataFusion SQL Query Engine

ARROW-8097: [Dev] Comment bot's crossbow command acts on the master branch

Krisztián Szűcs3b7451b9fb8b
diff --git a/.github/workflows/comment_bot.yml b/.github/workflows/comment_bot.yml
index 4b473287f0..d501d97131 100644
--- a/.github/workflows/comment_bot.yml
+++ b/.github/workflows/comment_bot.yml
@@ -26,19 +26,14 @@ on:
jobs:
- debug:
- name: Debug
+ listen:
+ name: Listen!
runs-on: ubuntu-latest
steps:
- name: Checkout Arrow
uses: actions/checkout@v2
with:
path: arrow
- # in order to generate version number based on git we need the tags
- # fetched but checkout@v2 doesn't do that by default
- - name: Featch Arrow tags
- working-directory: arrow
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
# because libgit2 is a dependency of crossbow so prefer conda
- name: Setup Conda
uses: s-weigand/setup-conda@v1
diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py
index 29204ae791..e15ff21dde 100644
--- a/dev/archery/archery/bot.py
+++ b/dev/archery/archery/bot.py
@@ -19,6 +19,7 @@ import operator
import shlex
from pathlib import Path
from functools import partial
+import tempfile
import click
import github
@@ -258,20 +259,34 @@ def submit(obj, task, group, dry_run):
See groups defined in arrow/dev/tasks/tests.yml
"""
+ git = Git()
+
+ # construct crossbow arguments
args = []
for g in group:
args.extend(['-g', g])
for t in task:
args.append(t)
- # clone crossbow
- git = Git()
- git.clone('https://github.com/{}'.format(obj['crossbow_repo']), 'crossbow')
+ # pygithub pull request object
+ pr = obj['pull']
+ crossbow_url = 'https://github.com/{}'.format(obj['crossbow_repo'])
+
+ with tempfile.TemporaryDirectory() as tmpdir:
+ tmpdir = Path(tmpdir)
+ arrow = tmpdir / 'arrow'
+ queue = tmpdir / 'crossbow'
+
+ # clone arrow, crossbow and checkout the pull request's branch
+ git.clone('--branch', pr.head.ref, pr.head.repo.clone_url, str(arrow))
+ git.clone(crossbow_url, str(queue))
- # submit the crossbow tasks
- result = Path('result.yml').resolve()
- xbow = Crossbow('arrow/dev/tasks/crossbow.py')
- xbow.run('--output-file', str(result), 'submit', *args)
+ # submit the crossbow tasks
+ result = Path('result.yml').resolve()
+ xbow = Crossbow(str(arrow / 'dev' / 'tasks' / 'crossbow.py'))
+ xbow.run('--queue-path', str(queue),
+ '--output-file', str(result),
+ 'submit', *args)
# parse the result yml describing the submitted job
yaml = YAML()
@@ -283,4 +298,4 @@ def submit(obj, task, group, dry_run):
response = formatter.render(job)
# send the response
- obj['pull'].create_issue_comment(response)
+ pr.create_issue_comment(response)