Created
September 18, 2013 20:46
-
-
Save amackey/6615429 to your computer and use it in GitHub Desktop.
Subversion post-commit hook that talks to JIRA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use SVN::Hooks; | |
use SVN::Hooks::CheckJira; | |
use WWW::Mechanize; | |
CHECK_JIRA_CONFIG("http://www.hostname.com:8080", "username", "password", qr/(.*)/ms); | |
CHECK_JIRA(qr/./ => { require => 0, | |
post_action => sub { | |
my ($jira, $svnlook, @keys) = @_; | |
my $msg = $svnlook->log_msg(); | |
if ($msg =~ m/^#comment/ms) { | |
my $comment = sprintf(<<EOM, $svnlook->repo(), $svnlook->rev(), $msg); | |
[auto-msg] new %s revision %s : | |
%s | |
check the Subversion tab for more details! | |
EOM | |
for my $key (@keys) { | |
$jira->addComment($key, $comment); | |
} | |
} | |
# attempt to fire the SVN indexer | |
my $mech = WWW::Mechanize->new(); | |
$mech->get("http://www.hostname.com:8080/secure/UpdateDatabaseServer!startIndexer.jspa"); | |
$mech->submit_form(fields => { os_username => "admin_username", | |
os_password => "admin_password", | |
}); | |
}, | |
}, | |
); | |
run_hook($0, @ARGV); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment