From ae24e7fb316a2c25b508df23f2ac60fe3a440644 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 12 Apr 2016 15:19:05 -0400 Subject: [PATCH] GithubStatus: Include the full job name and build ID in the context. Build ID can be omitted by setting excludeBuildFromContext in config --- src/lib/Hydra/Plugin/GithubStatus.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/Hydra/Plugin/GithubStatus.pm b/src/lib/Hydra/Plugin/GithubStatus.pm index e84cec3d..7677cbd8 100644 --- a/src/lib/Hydra/Plugin/GithubStatus.pm +++ b/src/lib/Hydra/Plugin/GithubStatus.pm @@ -29,16 +29,18 @@ sub common { my $jobName = showJobName $b; my $evals = $build->jobsetevals; my $ua = LWP::UserAgent->new(); - my $body = encode_json( - { - state => $finished ? toGithubState($b->buildstatus) : "pending", - target_url => "$baseurl/build/" . $b->id, - description => "Hydra build #" . $b->id . " of $jobName", - context => "continuous-integration/hydra" - }); + foreach my $conf (@config) { next unless $jobName =~ /^$conf->{jobs}$/; + my $contextTrailer = $conf->{excludeBuildFromContext} ? "" : (":" . $b->id); + my $body = encode_json( + { + state => $finished ? toGithubState($b->buildstatus) : "pending", + target_url => "$baseurl/build/" . $b->id, + description => "Hydra build #" . $b->id . " of $jobName", + context => "continuous-integration/hydra:" . $jobName . $contextTrailer + }); my $inputs_cfg = $conf->{inputs}; my @inputs = defined $inputs_cfg ? ref $inputs_cfg eq "ARRAY" ? @$inputs_cfg : ($inputs_cfg) : (); my %seen = map { $_ => {} } @inputs;