Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/archery/archery/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def submit(obj, tasks, groups, params, arrow_version):
groups=groups, params=params)

# add the job to the crossbow queue and push to the remote repository
queue.put(job, prefix="actions")
queue.put(job, prefix="actions", increment_job_id=False)
queue.push()

# render the response comment's content
Expand Down
16 changes: 13 additions & 3 deletions dev/archery/archery/crossbow/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import mimetypes
import subprocess
import textwrap
import uuid
from io import StringIO
from pathlib import Path
from datetime import date
Expand Down Expand Up @@ -564,6 +565,11 @@ def _next_job_id(self, prefix):
latest_id = self._latest_prefix_id(prefix)
return '{}-{}'.format(prefix, latest_id + 1)

def _new_hex_id(self, prefix):
"""Append a new id to branch's identifier based on the prefix"""
hex_id = uuid.uuid4().hex[:10]
return '{}-{}'.format(prefix, hex_id)

def latest_for_prefix(self, prefix):
prefix_date = self._prefix_contains_date(prefix)
if prefix.startswith("nightly") and not prefix_date:
Expand Down Expand Up @@ -617,16 +623,20 @@ def get(self, job_name):
job.queue = self
return job

def put(self, job, prefix='build'):
def put(self, job, prefix='build', increment_job_id=True):
if not isinstance(job, Job):
raise CrossbowError('`job` must be an instance of Job')
if job.branch is not None:
raise CrossbowError('`job.branch` is automatically generated, '
'thus it must be blank')

# auto increment and set next job id, e.g. build-85
job._queue = self
job.branch = self._next_job_id(prefix)
if increment_job_id:
# auto increment and set next job id, e.g. build-85
job.branch = self._next_job_id(prefix)
else:
# set new branch to something unique, e.g. build-41d017af40
job.branch = self._new_hex_id(prefix)

# create tasks' branches
for task_name, task in job.tasks.items():
Expand Down