Include names of committers in HipChat notifications
[?]
Jul 2, 2013, 11:54 AM
NB2VOKIROXTIIIXKPHFHCGO236KPKXWYDSWUWVJF3XBRHRMUIQ4ACDependencies
- [2]
JAH3UPWASupport revision control systems via plugins - [3]
ZDEHAFHVAdd a plugin for HipChat notification - [4]
5EQYVRWEAdd a plugin mechanism - [5]
J5UVLXOK* Start of a basic Catalyst web interface. - [6]
QUTWJR7P* Include more info in notification emails. - [7]
BLVQGJ4LUse OO-style plugins - [8]
NILMMFMYRespect X-Request-Base header coming from a frontend proxy. - [9]
OVR2RWBIhydra-evaluator: Always pick the jobset that hasn't been evaluated longest - [10]
WQXF2T3Dhydra-evaluator: Don't require $HYDRA_CONFIG - [*]
7YBYT2LQ - [*]
N22GPKYT* Put info about logs / build products in the DB.
Change contents
- edit in src/lib/Hydra/Plugin/GitInput.pm at line 14
sub fetchInput {my ($self, $type, $name, $value) = @_;return undef if $type ne "git"; - replacement in src/lib/Hydra/Plugin/GitInput.pm at line 15
(my $uri, my $branch, my $deepClone) = split ' ', $value;$branch = defined $branch ? $branch : "master";my $timestamp = time;my $sha256;my $storePath;# Clone or update a branch of a repository into our SCM cache.sub _cloneRepo {my ($self, $uri, $branch, $deepClone) = @_; - replacement in src/lib/Hydra/Plugin/GitInput.pm at line 33
# This command force the update of the local branch to be in the same as# the remote branch for whatever the repository state is. This command mirror# This command forces the update of the local branch to be in the same as# the remote branch for whatever the repository state is. This command mirrors - edit in src/lib/Hydra/Plugin/GitInput.pm at line 42
($res, $stdout, $stderr) = captureStdoutStderr(600,("git", "rev-parse", "$branch"));die "error getting revision number of Git branch '$branch' at `$uri':\n$stderr" if $res;my ($revision) = split /\n/, $stdout;die "error getting a well-formated revision number of Git branch '$branch' at `$uri':\n$stdout"unless $revision =~ /^[0-9a-fA-F]+$/;my $ref = "refs/heads/$branch"; - edit in src/lib/Hydra/Plugin/GitInput.pm at line 58
return $clonePath;}sub _parseValue {my ($value) = @_;(my $uri, my $branch, my $deepClone) = split ' ', $value;$branch = defined $branch ? $branch : "master";return ($uri, $branch, $deepClone);}sub fetchInput {my ($self, $type, $name, $value) = @_;return undef if $type ne "git";my ($uri, $branch, $deepClone) = _parseValue($value);my $clonePath = $self->_cloneRepo($uri, $branch, $deepClone);my $timestamp = time;my $sha256;my $storePath;my ($res, $stdout, $stderr) = captureStdoutStderr(600,("git", "rev-parse", "$branch"));die "error getting revision number of Git branch '$branch' at `$uri':\n$stderr" if $res;my ($revision) = split /\n/, $stdout;die "error getting a well-formated revision number of Git branch '$branch' at `$uri':\n$stdout"unless $revision =~ /^[0-9a-fA-F]+$/; - edit in src/lib/Hydra/Plugin/GitInput.pm at line 91
my $ref = "refs/heads/$branch"; - edit in src/lib/Hydra/Plugin/GitInput.pm at line 164
sub getCommits {my ($self, $type, $value, $rev1, $rev2) = @_;return [] if $type ne "git";return [] unless $rev1 =~ /^[0-9a-f]+$/;return [] unless $rev2 =~ /^[0-9a-f]+$/;my ($uri, $branch, $deepClone) = _parseValue($value);my $clonePath = $self->_cloneRepo($uri, $branch, $deepClone);my $out;IPC::Run::run(["git", "log", "--pretty=format:%H%x09%an%x09%ae%x09%at", "$rev1..$rev2"], \undef, \$out)or die "cannot get git logs: $?";my $res = [];foreach my $line (split /\n/, $out) {my ($revision, $author, $email, $date) = split "\t", $line;push @$res, { revision => $revision, author => $author, email => $email };}return $res;} - edit in src/lib/Hydra/Plugin/HipChatNotification.pm at line 37
return if scalar keys %rooms == 0;# Determine who broke/fixed the build.my $prevBuild = getPreviousBuild($build);my $nrCommits = 0;my %authors;if ($prevBuild) {foreach my $curInput ($build->buildinputs_builds) {next unless $curInput->type eq "git";my $prevInput = $prevBuild->buildinputs_builds->find({ name => $curInput->name });next unless defined $prevInput;next if $curInput->type ne $prevInput->type;next if $curInput->uri ne $prevInput->uri; - edit in src/lib/Hydra/Plugin/HipChatNotification.pm at line 55
my @commits;foreach my $plugin (@{$self->{plugins}}) {push @commits, @{$plugin->getCommits($curInput->type, $curInput->uri, $prevInput->revision, $curInput->revision)};}foreach my $commit (@commits) {print STDERR "$commit->{revision} by $commit->{author}\n";$authors{$commit->{author}} = $commit->{email};$nrCommits++;}}} - edit in src/lib/Hydra/Plugin/HipChatNotification.pm at line 86
if (scalar keys %authors > 0) {# FIXME: HTML escapingmy @x = map { "<a href='mailto:$authors{$_}'>$_</a>" } (sort keys %authors);$msg .= ", likely due to ";$msg .= "$nrCommits commits by " if $nrCommits > 1;$msg .= join(" or ", scalar @x > 1 ? join(", ", @x[0..scalar @x - 2]) : (), $x[-1]);} - edit in src/lib/Hydra/Plugin/HipChatNotification.pm at line 95
next; - replacement in src/lib/Hydra/Plugin.pm at line 10
my $self = { db => $args{db}, config => $args{config} };my $self = { db => $args{db}, config => $args{config}, plugins => $args{plugins} }; - edit in src/lib/Hydra/Plugin.pm at line 13
}sub instantiate {my ($class, %args) = @_;my $plugins = [];$args{plugins} = $plugins;push @$plugins, $class->plugins(%args);return @$plugins; - edit in src/lib/Hydra/Plugin.pm at line 45
# Get the commits to repository ‘$value’ between revisions ‘$rev1’ and# ‘$rev2’. Each commit should be a hash ‘{ revision = "..."; author =# "..."; email = "..."; }’.sub getCommits {my ($self, $type, $value, $rev1, $rev2) = @_;return [];} - replacement in src/lib/Hydra.pm at line 95
$plugins = [Hydra::Plugin->plugins(db => $class->model('DB'), config => $class->config)];$plugins = [Hydra::Plugin->instantiate(db => $class->model('DB'), config => $class->config)]; - replacement in src/script/hydra-build at line 20
my @plugins = Hydra::Plugin->plugins(db => $db, config => $config);my @plugins = Hydra::Plugin->instantiate(db => $db, config => $config); - replacement in src/script/hydra-evaluator at line 24
my $plugins = [Hydra::Plugin->plugins(db => $db, config => $config)];my $plugins = [Hydra::Plugin->instantiate(db => $db, config => $config)];