Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix combined queues and remove broken retry log link for multi repo queues #165

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions homu/html/queue.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ <h1>Homu queue - {% if repo_url %}<a href="{{repo_url}}" target="_blank">{{repo_
</tbody>
</table>

{% if not multiple %}
<p><a href="../retry_log/{{repo_label}}">Open retry log</a></p>
{% endif %}

<script src="../assets/jquery.min.js"></script>
<script src="../assets/jquery.dataTables.min.js"></script>
Expand Down
23 changes: 13 additions & 10 deletions homu/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,28 @@ def result(repo_label, pull):

@get('/queue/<repo_label:path>')
def queue(repo_label):
if repo_label not in g.cfg['repo'] and repo_label != 'all':
abort(404)

if repo_label == 'all':
labels = g.repos.keys()
else:
labels = repo_label.split('+')
if any(label not in g.cfg['repo'] for label in labels):
abort(404)
Comment on lines +121 to +126
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggestion could be applied to remove the support for combining queues with + but keep the all queue

Suggested change
if repo_label == 'all':
labels = g.repos.keys()
else:
labels = repo_label.split('+')
if any(label not in g.cfg['repo'] for label in labels):
abort(404)
if repo_label == 'all':
labels = g.repos.keys()
elif repo_label in g.cfg['repo']:
labels = [repo_label]
else:
abort(404)


logger = g.logger.getChild('queue')

lazy_debug(logger, lambda: 'repo_label: {}'.format(repo_label))

single_repo_closed = None
treeclosed_src = None
if repo_label == 'all':
labels = g.repos.keys()
multiple = True
repo_url = None
else:
labels = repo_label.split('+')
multiple = len(labels) > 1
if repo_label in g.repos and g.repos[repo_label].treeclosed >= 0:
repo_url = None
multiple = len(labels) > 1

if not multiple:
if g.repos[repo_label].treeclosed >= 0:
single_repo_closed = g.repos[repo_label].treeclosed
treeclosed_src = g.repos[repo_label].treeclosed_src

repo_url = 'https://github.com/{}/{}'.format(
g.cfg['repo'][repo_label]['owner'],
g.cfg['repo'][repo_label]['name'])
Expand Down