Merge pull request #1136 from DeterminateSystems/github-status-cached-evals

GithubStatus: try pushing statuses for cached buildqueued/buildfinished events
This commit is contained in:
Graham Christensen 2022-01-31 09:11:37 -05:00 committed by GitHub
commit 94ed9ed7ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@ sub toGithubState {
} }
sub common { sub common {
my ($self, $topbuild, $dependents, $finished) = @_; my ($self, $topbuild, $dependents, $finished, $cachedEval) = @_;
my $cfg = $self->{config}->{githubstatus}; my $cfg = $self->{config}->{githubstatus};
my @config = defined $cfg ? ref $cfg eq "ARRAY" ? @$cfg : ($cfg) : (); my @config = defined $cfg ? ref $cfg eq "ARRAY" ? @$cfg : ($cfg) : ();
my $baseurl = $self->{config}->{'base_uri'} || "http://localhost:3000"; 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 @inputs = defined $inputs_cfg ? ref $inputs_cfg eq "ARRAY" ? @$inputs_cfg : ($inputs_cfg) : ();
my %seen = map { $_ => {} } @inputs; my %seen = map { $_ => {} } @inputs;
while (my $eval = $evals->next) { while (my $eval = $evals->next) {
if (defined($cachedEval) && $cachedEval->id != $eval->id) {
next;
}
my $sendStatus = sub { my $sendStatus = sub {
my ($input, $owner, $repo, $rev) = @_; my ($input, $owner, $repo, $rev) = @_;
@ -129,4 +132,14 @@ sub buildFinished {
common(@_, 1); 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; 1;