Add endpoint to generate a shields.io badge
[?]
Dec 24, 2020, 2:44 PM
2E23VP5JOIJSVVVFIER2WEWFKBHKJ3F2O6NKPGMCTMPZ2XQ6XN7QCDependencies
- [2]
LX326CB7Add hydra OpenAPI description (#750) - [3]
NZXX6PLDRemove the Jobs table - [*]
DEMSSSB2* Controller for jobs which inherits all actions in ListBuilds. So - [*]
ODNCGFQ5* Improved the navigation bar: don't include all projects (since that - [*]
NQJFHYBIjob: create a prometheus endpoint
Change contents
- edit in hydra-api.yaml at line 387
/job/{project-id}/{jobset-id}/{job-id}/shield:get:summary: Generate data for a shields.io badgeparameters:- name: project-idin: pathdescription: project identifierrequired: trueschema:type: string- name: jobset-idin: pathdescription: jobset identifierrequired: trueschema:type: string- name: job-idin: pathdescription: job identifierrequired: trueschema:type: stringresponses:'200':description: see <a href="https://shields.io/endpoint">https://shields.io/endpoint</a> on how to use thiscontent:application/json:examples:shield-success:value:color: greenschemaVersion: 1label: hydra buildmessage: passing - edit in src/lib/Hydra/Controller/Job.pm at line 29
}sub shield :Chained('job') PathPart('shield') Args(0) {my ($self, $c) = @_;my $job = $c->stash->{job};my $lastBuild = $c->stash->{jobset}->builds->find({ job => $job, finished => 1 },{ order_by => 'id DESC', rows => 1, columns => [@buildListColumns] });notFound($c, "No latest build for job ‘$job’.") unless defined $lastBuild;my $color =$lastBuild->buildstatus == 0 ? "green" :$lastBuild->buildstatus == 4 ? "yellow" :"red";my $message =$lastBuild->buildstatus == 0 ? "passing" :$lastBuild->buildstatus == 4 ? "cancelled" :"failing";$c->response->content_type('application/json');$c->stash->{'plain'} = {data => scalar (JSON::Any->objToJson({schemaVersion => 1,label => "hydra build",color => $color,message => $message,}))};$c->forward('Hydra::View::Plain'); - edit in src/lib/Hydra/Controller/Job.pm at line 64[6.1][7.22]