Skip to content

Commit

Permalink
[frontend] support for import (copr-dist-git per-task) logs
Browse files Browse the repository at this point in the history
  • Loading branch information
clime committed Mar 8, 2016
1 parent 9e53dd6 commit 7623ba5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend/coprs_frontend/config/copr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ SEND_EMAILS = True
PUBLIC_COPR_HOSTNAME = "copr.fedoraproject.org"

DIST_GIT_URL = "http://copr-dist-git-dev.fedorainfracloud.org/cgit/"
COPR_DIST_GIT_LOGS_URL = "http://copr-dist-git-dev.fedorainfracloud.org/per-task-logs"

# primary
LOG_FILENAME = "/var/log/copr/frontend.log"
Expand Down
1 change: 1 addition & 0 deletions frontend/coprs_frontend/config/copr_devel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ENFORCE_PROTOCOL_FOR_FRONTEND_URL = "http"
PUBLIC_COPR_HOSTNAME = "copr-fe-dev.cloud.fedoraproject.org"

DIST_GIT_URL = "http://copr-dist-git-dev.fedorainfracloud.org/cgit/"
COPR_DIST_GIT_LOGS_URL = "http://copr-dist-git-dev.fedorainfracloud.org/per-task-logs"

LOG_FILENAME="/tmp/copr_frontend.log"

Expand Down
1 change: 1 addition & 0 deletions frontend/coprs_frontend/coprs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Config(object):
PUBLIC_COPR_HOSTNAME = "copr-fe-dev.cloud.fedoraproject.org"

DIST_GIT_URL = None
COPR_DIST_GIT_LOGS_URL = None

# primary log file
LOG_FILENAME = "/var/log/copr/frontend.log"
Expand Down
15 changes: 15 additions & 0 deletions frontend/coprs_frontend/coprs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,14 @@ def state(self):

return "unknown"

@property
def task_id(self):
return "{}-{}".format(self.build_id, self.name)

@property
def import_task_id(self):
return "{}-{}".format(self.build_id, helpers.chroot_to_branch(self.name))

@property
def dist_git_url(self):
if app.config["DIST_GIT_URL"]:
Expand All @@ -829,6 +837,13 @@ def dist_git_url(self):
self.git_hash)
return None

@property
def import_log_url(self):
if app.config["COPR_DIST_GIT_LOGS_URL"]:
return "{}/{}.log".format(app.config["COPR_DIST_GIT_LOGS_URL"],
self.import_task_id)
return None

@property
def result_dir_url(self):
return "/".join([app.config["BACKEND_BASE_URL"],
Expand Down
10 changes: 10 additions & 0 deletions frontend/coprs_frontend/coprs/templates/coprs/detail/build.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ <h3 class="panel-title">Results</h3>
<tr>
<th>Chroot Name</th>
<th>Dist Git Source</th>
<th>Import log</th>
<th>Build Time</th>
<th>State</th>
</tr>
Expand Down Expand Up @@ -176,6 +177,15 @@ <h3 class="panel-title">Results</h3>
-
{% endif %}
</td>
<td>
{% if chroot.import_log_url %}
<a href="{{chroot.import_log_url}}">
{{ chroot.import_task_id }}.log
</a>
{% else %}
-
{% endif %}
</td>
<td>
{{ chroot.started_on|time_ago(chroot.ended_on) }}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def dist_git_importing_queue():
else:
user_name = copr.owner.name
task_dict = {
"task_id": "{}-{}".format(task.build.id, helpers.chroot_to_branch(task.mock_chroot.name)),
"task_id": task.import_task_id,
"user": user_name,
"project": task.build.copr.name,

Expand Down Expand Up @@ -143,7 +143,7 @@ def waiting():
user_name = copr.owner.name

record = {
"task_id": "{}-{}".format(task.build.id, task.mock_chroot.name),
"task_id": task.task_id,
"build_id": task.build.id,
"project_owner": user_name,
"project_name": task.build.copr.name,
Expand Down

0 comments on commit 7623ba5

Please sign in to comment.