Compare commits

...

16 Commits

Author SHA1 Message Date
Janne Heß
d288e401ba Add option to disable search 2026-01-05 22:48:44 +01:00
Janne Heß
41daeb3cc9 Merge pull request #1553 from NixOS/dependabot/github_actions/actions/checkout-6
build(deps): bump actions/checkout from 3 to 6
2026-01-05 15:25:52 +00:00
Janne Heß
3b1b5009f3 Merge pull request #1552 from NixOS/dependabot/github_actions/peter-evans/create-pull-request-8
build(deps): bump peter-evans/create-pull-request from 5 to 8
2026-01-05 15:23:08 +00:00
dependabot[bot]
54699ae671 build(deps): bump actions/checkout from 3 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-05 15:00:59 +00:00
dependabot[bot]
503871bac4 build(deps): bump peter-evans/create-pull-request from 5 to 8
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5 to 8.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v5...v8)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-05 15:00:54 +00:00
Janne Heß
6dde18cb5e Merge pull request #1551 from knedlsepp/fix-scmdiff
Fix broken api/scmdiff endpoint
2026-01-05 13:37:12 +00:00
Josef Kemetmüller
e0f65d4d3d Fix broken api/scmdiff endpoint
Same fix as in #1215, which got accidentally removed in #1506.
2026-01-05 14:16:47 +01:00
Janne Heß
5e2e9672cf Merge pull request #1549 from NixOS/feat/github-diffs
feat: Offload git diffs to GitHub
2026-01-05 13:10:00 +00:00
Janne Heß
650871b586 Merge pull request #602 from kquick/pathinput_freq
Allow PathInput to take an optional frequency parameter.
2026-01-04 19:09:26 +00:00
Janne Heß
b2030cd4ef Merge pull request #1294 from arianvp/patch-2
Document redirects in Hydra API
2026-01-04 18:55:13 +00:00
Janne Heß
44780c786e Merge branch 'master' into pathinput_freq 2026-01-04 19:05:05 +01:00
Arian van Putten
b88b06dd3c Document redirects in Hydra API
This documents useful redirects that Hydra exposes
2026-01-04 19:01:31 +01:00
Janne Heß
f1b26134d7 feat: Offload git diffs to GitHub
If we are on GitHub, use their scm diff by default which is more
feature-rich and offloads the diff work to stronger infrastructure
2026-01-04 15:49:25 +01:00
Kevin Quick
23fa93c5f8 Better update of timeout for the PathInput handler. 2020-06-09 09:00:02 -07:00
Kevin Quick
66730993fc Reconcile with changes from pullreq #775 2020-06-09 08:55:46 -07:00
Kevin Quick
25d1e8900a Allow PathInput to take an optional frequency parameter.
The previous version hard-coded the cache check frequency to 30
seconds.  This meant that the path was checked very frequently (max of
30 seconds and the evaluation period of the job), which could be
problematic for URL PathInput specifications, and especially ones that
are automatically updated frequently without *each* update necessarily
being interesting (an example: the haskell hackage index file.)
2020-06-09 08:48:22 -07:00
8 changed files with 170 additions and 18 deletions

View File

@@ -16,7 +16,7 @@ jobs:
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v31

View File

@@ -11,12 +11,12 @@ jobs:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
- name: Update flake inputs
run: nix flake update
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v8
with:
commit-message: "flake.lock: Update"
title: "Update flake inputs"

View File

@@ -574,6 +574,131 @@ paths:
schema:
$ref: '#/components/schemas/JobsetEvalBuilds'
/jobset/{project-id}/{jobset-id}/latest-eval:
get:
summary: Redirects to the latest finished evaluation for a jobset
parameters:
- name: project-id
in: path
description: project identifier
required: true
schema:
type: string
- name: jobset-id
in: path
description: jobset identifier
required: true
schema:
type: string
responses:
'302':
description: the evaluation to redirect to
headers:
Location:
example: /eval/1?name={jobset-id}
schema:
type: string
/job/{project-id}/{jobset-id}/{job-id}/latest:
get:
summary: Redirects to the latest succesful build for a job
parameters:
- name: project-id
in: path
description: project identifier
required: true
schema:
type: string
- name: jobset-id
in: path
description: jobset identifier
required: true
schema:
type: string
- name: job-id
in: path
description: job identifier
required: true
schema:
type: string
responses:
'302':
description: the build to redirect to
headers:
Location:
example: /build/1
schema:
type: string
/job/{project-id}/{jobset-id}/{job-id}/latest-for/{system}:
get:
summary: Redirects to the latest succesful build for a job
parameters:
- name: project-id
in: path
description: project identifier
required: true
schema:
type: string
- name: jobset-id
in: path
description: jobset identifier
required: true
schema:
type: string
- name: job-id
in: path
description: job identifier
required: true
schema:
type: string
- name: system
in: path
description: system
required: true
schema:
type: string
example: x86_64-linux
responses:
'302':
description: the build to redirect to
headers:
Location:
example: /build/1
schema:
type: string
/job/{project-id}/{jobset-id}/{job-id}/latest-finished:
get:
summary: Redirects to the latest succesful build for a job from a finished evaluation
parameters:
- name: project-id
in: path
description: project identifier
required: true
schema:
type: string
- name: jobset-id
in: path
description: jobset identifier
required: true
schema:
type: string
- name: job-id
in: path
description: job identifier
required: true
schema:
type: string
responses:
'302':
description: the build to redirect to
headers:
Location:
example: /build/1
schema:
type: string
components:
schemas:

View File

@@ -220,11 +220,11 @@ sub scmdiff : Path('/api/scmdiff') Args(0) {
my $clonePath = getSCMCacheDir . "/git/" . sha256_hex($uri);
die if ! -d $clonePath;
my ($stdout1, $stderr1);
run3(['git', '-C', $clonePath, 'log', "$rev1..$rev2"], \undef, \$stdout1, \$stderr1);
run3(['git', '--git-dir', '.git', '-C', $clonePath, 'log', "$rev1..$rev2"], \undef, \$stdout1, \$stderr1);
$diff .= $stdout1 if $? == 0;
my ($stdout2, $stderr2);
run3(['git', '-C', $clonePath, 'diff', "$rev1..$rev2"], \undef, \$stdout2, \$stderr2);
run3(['git', '--git-dir', '.git', '-C', $clonePath, 'diff', "$rev1..$rev2"], \undef, \$stdout2, \$stderr2);
$diff .= $stdout2 if $? == 0;
}

View File

@@ -495,6 +495,9 @@ sub steps :Local Args(0) {
sub search :Local Args(0) {
my ($self, $c) = @_;
badRequest($c, "Search is disabled in this Hydra instance") if $c->config->{disable_search};
$c->stash->{template} = 'search.tt';
my $query = trim $c->request->params->{"query"};

View File

@@ -12,19 +12,31 @@ sub supportedInputTypes {
$inputTypes->{'path'} = 'Local path or URL';
}
sub _parseValue {
# The input is a local path or URL, optionally followed by a
# time period specified in seconds.
my ($config, $value) = @_;
my @parts = split ' ', $value;
(my $uri, my $freq) = @parts;
# By default don't check a path more often than every 30 seconds,
# but the second path argument can change that value or the global
# path_input_cache_validity_seconds configuration, in that order.
my $timeout = defined $freq ? $freq : ($config->{path_input_cache_validity_seconds} // 30);
return ($uri, $timeout);
}
sub fetchInput {
my ($self, $type, $name, $value) = @_;
return undef if $type ne "path";
my $uri = $value;
my ($uri, $timeout) = _parseValue($self->{config}, $value);
my $timestamp = time;
my $sha256;
my $storePath;
my $timeout = $self->{config}->{path_input_cache_validity_seconds} // 30;
# Some simple caching: don't check a path more than once every N seconds.
(my $cachedInput) = $self->{db}->resultset('CachedPathInputs')->search(
{srcpath => $uri, lastseen => {">", $timestamp - $timeout}},

View File

@@ -347,13 +347,23 @@ BLOCK renderDiffUri;
url = res.0;
branch = res.1;
IF bi1.type == "hg" || bi1.type == "git" %]
<a target="_blank" [% HTML.attributes(href => c.uri_for('/api/scmdiff', {
uri = url,
rev1 = bi1.revision,
rev2 = bi2.revision,
type = bi1.type,
branch = branch
})) %]>[% HTML.escape(contents) %]</a>
[% IF url.substr(0, 19) == "https://github.com/" %]
<a target="_blank" [% HTML.attributes(href =>
url
_ "/compare/"
_ bi1.revision
_ "..."
_ bi2.revision,
) %]>[% HTML.escape(contents) %]</a>
[% ELSE %]
<a target="_blank" [% HTML.attributes(href => c.uri_for('/api/scmdiff', {
uri = url,
rev1 = bi1.revision,
rev2 = bi2.revision,
type = bi1.type,
branch = branch
})) %]>[% HTML.escape(contents) %]</a>
[% END %]
[% ELSE;
contents;
END;

View File

@@ -121,9 +121,11 @@
[% END %]
[% IF showPrivate %]
<form class="form-inline" action="[% c.uri_for('/search') %]">
<input name="query" type="text" class="form-control" placeholder="Search" [% HTML.attributes(value => c.req.params.query) %]/>
</form>
[% UNLESS c.config.disable_search %]
<form class="form-inline" action="[% c.uri_for('/search') %]">
<input name="query" type="text" class="form-control" placeholder="Search" [% HTML.attributes(value => c.req.params.query) %]/>
</form>
[% END %]
[% END %]
<ul class="navbar-nav">