summaryrefslogtreecommitdiffstats
path: root/extensions/BMO
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-04-19 15:50:38 +0200
committerDylan William Hardison <dylan@hardison.net>2017-04-19 21:44:08 +0200
commit356bfe73b9b25c9cdf86dd9e125f411824db74fc (patch)
tree9e8fab91e2acf210a405b351e2e60c4ec6abdc7e /extensions/BMO
parentf04f94b31b39d3c93ab8723dc2061b04f9a28863 (diff)
downloadbugzilla-356bfe73b9b25c9cdf86dd9e125f411824db74fc.tar.gz
bugzilla-356bfe73b9b25c9cdf86dd9e125f411824db74fc.tar.xz
Bug 1357809 - Add endpoints for future cloud-services integration
Diffstat (limited to 'extensions/BMO')
-rw-r--r--extensions/BMO/Extension.pm36
1 files changed, 36 insertions, 0 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 40ab8424e..1bf6ebf8c 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -57,6 +57,8 @@ use List::Util qw(first);
use Scalar::Util qw(blessed);
use Sys::Syslog qw(:DEFAULT);
use Text::Balanced qw( extract_bracketed extract_multiple );
+use File::Slurp qw(read_file);
+use JSON::XS;
use Bugzilla::Extension::BMO::Constants;
use Bugzilla::Extension::BMO::FakeBug;
@@ -2522,7 +2524,41 @@ sub _check_default_product_security_group {
sub install_filesystem {
my ($self, $args) = @_;
my $files = $args->{files};
+ my $create_files = $args->{create_files};
my $extensions_dir = bz_locations()->{extensionsdir};
+ $create_files->{__lbheartbeat__} = {
+ perms => Bugzilla::Install::Filesystem::WS_SERVE,
+ contents => 'This mission is too important for me to allow you to jeopardize it.',
+ };
+
+
+ # version.json needs to have a source attribute pointing to
+ # our repository. We already have this information in the (static)
+ # contribute.json file, so parse that in
+ my $json = JSON::XS->new->pretty->utf8->canonical();
+ my $contribute = eval {
+ $json->decode(scalar read_file(bz_locations()->{cgi_path} . "/contribute.json"));
+ };
+ my $commit = `git rev-parse HEAD`;
+ chomp $commit;
+
+ if (!$contribute) {
+ die "Missing or invalid contribute.json file";
+ }
+
+ my $version_obj = {
+ source => $contribute->{repository}{url},
+ version => BUGZILLA_VERSION,
+ commit => $commit // "unknown",
+ build => $ENV{BUGZILLA_CI_BUILD} // "unknown",
+ };
+
+ $create_files->{'version.json'} = {
+ overwrite => 1,
+ perms => Bugzilla::Install::Filesystem::WS_SERVE,
+ contents => $json->encode($version_obj),
+ };
+
$files->{"$extensions_dir/BMO/bin/migrate-github-pull-requests.pl"} = {
perms => Bugzilla::Install::Filesystem::OWNER_EXECUTE
};