forked from lix-project/hydra
GithubStatus: $build -> $topbuild, $b -> $build (perlcritic)
This commit is contained in:
parent
5c9d8794b1
commit
b4f9807290
|
@ -25,32 +25,32 @@ sub toGithubState {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub common {
|
sub common {
|
||||||
my ($self, $build, $dependents, $finished) = @_;
|
my ($self, $topbuild, $dependents, $finished) = @_;
|
||||||
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";
|
||||||
|
|
||||||
# Find matching configs
|
# Find matching configs
|
||||||
foreach my $b ($build, @{$dependents}) {
|
foreach my $build ($topbuild, @{$dependents}) {
|
||||||
my $jobName = showJobName $b;
|
my $jobName = showJobName $build;
|
||||||
my $evals = $build->jobsetevals;
|
my $evals = $topbuild->jobsetevals;
|
||||||
my $ua = LWP::UserAgent->new();
|
my $ua = LWP::UserAgent->new();
|
||||||
|
|
||||||
foreach my $conf (@config) {
|
foreach my $conf (@config) {
|
||||||
next unless $jobName =~ /^$conf->{jobs}$/;
|
next unless $jobName =~ /^$conf->{jobs}$/;
|
||||||
# Don't send out "pending" status updates if the build is already finished
|
# Don't send out "pending" status updates if the build is already finished
|
||||||
next if !$finished && $b->finished == 1;
|
next if !$finished && $build->finished == 1;
|
||||||
|
|
||||||
my $contextTrailer = $conf->{excludeBuildFromContext} ? "" : (":" . $b->id);
|
my $contextTrailer = $conf->{excludeBuildFromContext} ? "" : (":" . $build->id);
|
||||||
my $github_job_name = $jobName =~ s/-pr-\d+//r;
|
my $github_job_name = $jobName =~ s/-pr-\d+//r;
|
||||||
my $extendedContext = $conf->{context} // "continuous-integration/hydra:" . $jobName . $contextTrailer;
|
my $extendedContext = $conf->{context} // "continuous-integration/hydra:" . $jobName . $contextTrailer;
|
||||||
my $shortContext = $conf->{context} // "ci/hydra:" . $github_job_name . $contextTrailer;
|
my $shortContext = $conf->{context} // "ci/hydra:" . $github_job_name . $contextTrailer;
|
||||||
my $context = $conf->{useShortContext} ? $shortContext : $extendedContext;
|
my $context = $conf->{useShortContext} ? $shortContext : $extendedContext;
|
||||||
my $body = encode_json(
|
my $body = encode_json(
|
||||||
{
|
{
|
||||||
state => $finished ? toGithubState($b->buildstatus) : "pending",
|
state => $finished ? toGithubState($build->buildstatus) : "pending",
|
||||||
target_url => "$baseurl/build/" . $b->id,
|
target_url => "$baseurl/build/" . $build->id,
|
||||||
description => $conf->{description} // "Hydra build #" . $b->id . " of $jobName",
|
description => $conf->{description} // "Hydra build #" . $build->id . " of $jobName",
|
||||||
context => $context
|
context => $context
|
||||||
});
|
});
|
||||||
my $inputs_cfg = $conf->{inputs};
|
my $inputs_cfg = $conf->{inputs};
|
||||||
|
|
Loading…
Reference in a new issue