Skip to content

Commit

Permalink
frontend: explain the reason of skipped chroots
Browse files Browse the repository at this point in the history
Fix #2900
  • Loading branch information
FrostyX authored and praiskup committed Sep 18, 2023
1 parent 69b69be commit 5a3ded2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
Add status_reason column
Revision ID: ec3528516b0c
Create Date: 2023-09-15 21:13:43.183755
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ec3528516b0c'
down_revision = 'c6dd61c09256'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('build_chroot',
sa.Column('status_reason', sa.Text(), nullable=True))


def downgrade():
op.drop_column('build_chroot', 'status_reason')
3 changes: 2 additions & 1 deletion frontend/coprs_frontend/coprs/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ def build_state_decoration(state):
"canceled": "The build has been cancelled manually.",
"running": "Build in progress.",
"pending": "Build is waiting in queue for a backend worker.",
"skipped": "This package has already been built previously.",
"skipped": ("This package was skipped, see the reason "
"for each chroot separately."),
"starting": "Backend worker is trying to acquire a builder machine.",
"importing": "Package sources are being imported into Copr DistGit.",
"waiting": "Task is waiting for something else to finish.",
Expand Down
4 changes: 4 additions & 0 deletions frontend/coprs_frontend/coprs/logic/builds_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,10 +1048,14 @@ def finish(chroot, status):

exclusivearch = upd_dict["results"].get("exclusivearch")
if exclusivearch and arch not in exclusivearch:
chroot.status_reason = \
"This chroot was skipped because of ExclusiveArch"
finish(chroot, StatusEnum("skipped"))

excludearch = upd_dict["results"].get("excludearch")
if arch in excludearch:
chroot.status_reason = \
"This chroot was skipped because of ExcludeArch"
finish(chroot, StatusEnum("skipped"))

cls.process_update_callback(build)
Expand Down
1 change: 1 addition & 0 deletions frontend/coprs_frontend/coprs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,7 @@ class BuildChroot(db.Model, TagMixin, helpers.Serializer):
passive_deletes=True))
git_hash = db.Column(db.String(40))
status = db.Column(db.Integer, default=StatusEnum("waiting"))
status_reason = db.Column(db.Text)

started_on = db.Column(db.Integer, index=True)
ended_on = db.Column(db.Integer, index=True)
Expand Down
5 changes: 3 additions & 2 deletions frontend/coprs_frontend/coprs/templates/_helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@
{% endif %}
{% endmacro %}

{% macro build_state_text(state) %}
<span class="build-{{ state }}" title="{{ state | build_state_description }}">
{% macro build_state_text(state, reason=None) %}
<span class="build-{{ state }}"
title="{{ reason or state | build_state_description }}">
{% if state == "importing" %}
<span class="pficon pficon-running"></span> {{ state }}
{% elif state == "pending" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ <h3 class="panel-title">Results</h3>
{% endfor %}
</td>
<td>
{{ build_state_text(chroot.state) }}
{{ build_state_text(chroot.state, chroot.status_reason) }}
</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 5a3ded2

Please sign in to comment.