Skip to content
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
31 changes: 31 additions & 0 deletions hydra-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,24 @@ paths:
schema:
$ref: '#/components/schemas/JobsetEvalBuilds'

/eval/{eval-id}/errors:
get:
summary: Retrieves the evaluation error information for an evaluation identified by eval id
parameters:
- name: eval-id
in: path
description: eval identifier
required: true
schema:
type: integer
responses:
'200':
description: evaluation error details
content:
application/json:
schema:
$ref: '#/components/schemas/JobsetEvalErrors'

/jobset/{project-id}/{jobset-id}/latest-eval:
get:
summary: Redirects to the latest finished evaluation for a jobset
Expand Down Expand Up @@ -951,6 +969,19 @@ components:
additionalProperties:
$ref: '#/components/schemas/Build'

JobsetEvalErrors:
type: object
properties:
id:
type: integer
description: The evaluation identifier
has_error:
type: boolean
description: Indicates whether this evaluation contains an error
errormsg:
type: string
description: The evaluation error message text, if an error exists

JobsetOverview:
type: array
items:
Expand Down
19 changes: 17 additions & 2 deletions subprojects/hydra/lib/Hydra/Controller/JobsetEval.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,24 @@ sub errors_GET {

$c->stash->{template} = 'eval-error.tt';

$c->stash->{eval} = $c->model('DB::JobsetEvals')->find($c->stash->{eval}->id, { prefetch => 'evaluationerror' });
my $eval = $c->model('DB::JobsetEvals')->find(
$c->stash->{eval}->id,
{ prefetch => 'evaluationerror' }
);

$c->stash->{eval} = $eval;

my $error_obj = $eval->evaluationerror;
Comment on lines +98 to +105

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This works as well, at least if you re-add

    $c->stash->{eval} = $c->model('DB::JobsetEvals')->find(
        $c->stash->{eval}->id,
        { prefetch => 'evaluationerror' }
    );

But I would like to see a human opinion on this matter. I don't know enough Perl to trust a clanker with it.

Comment thread
kmein marked this conversation as resolved.
my $err_str = $error_obj ? $error_obj->errormsg : '';
Comment thread
kmein marked this conversation as resolved.
my $has_error = ($err_str ne '') ? \1 : \0;
Comment on lines +106 to +107

@kmein kmein Mar 18, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope:

DBIx::Class::Row::get_column(): No such column 'has_error' on Hydra::Model::DB::EvaluationErrors at /home/kfm/src/hydra/subprojects/hydra/script/../lib/Hydra/Controller/JobsetEval.pm line 107


my $response = {
id => $eval->id,
has_error => $has_error,
errormsg => $err_str,
Comment thread
kmein marked this conversation as resolved.
};
Comment on lines +107 to +113

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not doing $has_error any more. And having real booleans in the JSON makes sense.

Comment on lines +109 to +113

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Previously, the JSON API of this endpoint was not specified at all in the OpenAPI schema. (Of course, this does not mean it wasn't relied upon, though it's unlikely given that it did exactly the same thing as the normal JobsetEval endpoint without /errors). I've added OpenAPI docs now.


$self->status_ok($c, entity => $c->stash->{eval});
$self->status_ok($c, entity => $response);
}

sub create_jobset : Chained('evalChain') PathPart('create-jobset') Args(0) {
Expand Down
Loading