Store build.error_detail in SQL

This should be stored in the SQL database so that the build page
can present the reason why a particular build failed, instead of
just the result "ERROR".

Change-Id: I4dd25546e27b8d3f3a4e049f9980082a3622079f
This commit is contained in:
James E. Blair
2020-02-25 14:38:15 -08:00
parent d97597d517
commit 828d5deb1a
7 changed files with 91 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""add error_detail
Revision ID: 16c1dc9054d0
Revises: 5f183546b39c
Create Date: 2020-02-25 14:04:56.947095
"""
# revision identifiers, used by Alembic.
revision = '16c1dc9054d0'
down_revision = '5f183546b39c'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(table_prefix=''):
op.add_column(
table_prefix + 'zuul_build', sa.Column('error_detail', sa.TEXT()))
def downgrade():
raise Exception("Downgrades not supported")

View File

@@ -300,6 +300,7 @@ class SQLConnection(BaseConnection):
voting = sa.Column(sa.Boolean)
log_url = sa.Column(sa.String(255))
node_name = sa.Column(sa.String(255))
error_detail = sa.Column(sa.TEXT())
buildset = orm.relationship(BuildSetModel, backref="builds")
def createArtifact(self, *args, **kw):

View File

@@ -93,6 +93,7 @@ class SQLReporter(BaseReporter):
voting=build.job.voting,
log_url=log_url,
node_name=build.node_name,
error_detail=build.error_detail,
)
for provides in job.provides: