From 778fc03570431bc75fd2cfc21dc62505d1d66c34 Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Tue, 4 Jun 2019 09:39:04 +0200 Subject: [PATCH] Allow to search builds by hash Currently, a full store path has to be provided to search in builds. This patch permits to search jobs with a output path or derivation hash. Usecase: we are building Docker images with Hydra. The tag of the Docker image is the hash of the image output path. This patch would allow us to find back the build job from the tag of a running container image. --- src/lib/Hydra/Controller/Root.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index fcc62138..41f6305c 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -422,11 +422,11 @@ sub search :Local Args(0) { # Perform build search in separate queries to prevent seq scan on buildoutputs table. $c->stash->{builds} = [ $c->model('DB::Builds')->search( - { "buildoutputs.path" => trim($query) }, + { "buildoutputs.path" => { ilike => "%$query%" } }, { order_by => ["id desc"], join => ["buildoutputs"] } ) ]; $c->stash->{buildsdrv} = [ $c->model('DB::Builds')->search( - { "drvpath" => trim($query) }, + { "drvpath" => { ilike => "%$query%" } }, { order_by => ["id desc"] } ) ]; $c->stash->{resource} = { projects => $c->stash->{projects},