From ef362e92d14e08a1921880d2b733414d3b841701 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 10 Jan 2022 20:33:47 -0500 Subject: [PATCH] GithubStatus: try pushing statuses for cached buildqueued/buildfinished events --- src/lib/Hydra/Plugin/GithubStatus.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/Plugin/GithubStatus.pm b/src/lib/Hydra/Plugin/GithubStatus.pm index 05a35ca2..fe791533 100644 --- a/src/lib/Hydra/Plugin/GithubStatus.pm +++ b/src/lib/Hydra/Plugin/GithubStatus.pm @@ -26,7 +26,7 @@ sub toGithubState { } sub common { - my ($self, $topbuild, $dependents, $finished) = @_; + my ($self, $topbuild, $dependents, $finished, $cachedEval) = @_; my $cfg = $self->{config}->{githubstatus}; my @config = defined $cfg ? ref $cfg eq "ARRAY" ? @$cfg : ($cfg) : (); my $baseurl = $self->{config}->{'base_uri'} || "http://localhost:3000"; @@ -58,6 +58,9 @@ sub common { my @inputs = defined $inputs_cfg ? ref $inputs_cfg eq "ARRAY" ? @$inputs_cfg : ($inputs_cfg) : (); my %seen = map { $_ => {} } @inputs; while (my $eval = $evals->next) { + if (defined($cachedEval) && $cachedEval->id != $eval->id) { + next; + } my $sendStatus = sub { my ($input, $owner, $repo, $rev) = @_; @@ -129,4 +132,14 @@ sub buildFinished { common(@_, 1); } +sub cachedBuildQueued { + my ($self, $evaluation, $build) = @_; + common($self, $build, [], 0, $evaluation); +} + +sub cachedBuildFinished { + my ($self, $evaluation, $build) = @_; + common($self, $build, [], 1, $evaluation); +} + 1;