added newsitems, added some admin options to clear various caches.

[?]
Apr 27, 2010, 1:29 PM
ZWCTAZGLJZQNTYWTC2XQUKMILJF6JGDL5IND6QNYWK4FIGMLRFXAC

Dependencies

  • [2] GPHLV42M * Allow the description of a release member to be edited, and to
  • [3] KSVD6RAP * hydra: queue stats (nr running builds / nr queued builds)
  • [4] KNU2FBIG * hydra: order project list on name
  • [5] 2M7J26V4 inital version of links to diff in scm
  • [6] RFE6T5LG * Store jobset evaluations in the database explicitly. This includes
  • [7] PC6UOHH7 add some stats to jobsets in project view
  • [8] CLJQCY2X * Store info about all the build actions and allow them to be
  • [9] BHZXGT2H * Channels: provide an index page that lists all the packages in the
  • [10] R5D7DZPE
  • [11] GNIEG2GC * Disambiguate jobs by jobset name. I.e. jobs with the same name in
  • [12] 3HCBU2FA
  • [13] SHBLLAVH * More global substitution.
  • [14] M552HLIA * Support variant builds.
  • [15] 37R34XJO * Negative caching: don't perform a build if a dependency already
  • [16] S5PV6IIM * Represent jobs explicitly in the DB.
  • [17] 67P45PY4
  • [18] TWVSALRL * Allow the maximum number of concurrent builds per platform to be
  • [19] ZI535LI6 * hydra: 'new' UI for project/jobset/job/build
  • [20] T2232OBS * Add some DB indices to make the /releases page much faster.
  • [21] 3ZCEPLNO
  • [22] LCKWLQW3 * In Sqlite "release" is now a keyword, so use "release_" instead.
  • [23] GWCV3TQV * BuildInputs table: link to dependencies, include store paths.
  • [24] S66BOMVU * Added authentication.
  • [25] 4D4U5IPY * Allow jobsets to be disabled.
  • [26] 7YBYT2LQ
  • [27] B72GLND4
  • [28] TQKGQ5R3
  • [29] QL55ECJ6 - adapted ui for hydra, more in line with nixos.org website
  • [30] ZVTSOVHN * Support Subversion checkouts.
  • [31] J5UVLXOK * Start of a basic Catalyst web interface.
  • [32] ODNCGFQ5 * Improved the navigation bar: don't include all projects (since that
  • [33] JFZNAYJX * Showing releases.
  • [34] TLZ2SPBR
  • [35] ZEHSSVFG
  • [36] JTRG7RDQ add support for git as jobinput
  • [37] D3DIBMOK * For products that are directories (like manuals), allow a default
  • [38] AHTEIK7G * Added a maintainers field to the Builds table.
  • [39] YAPITGB3 * Boolean inputs.
  • [40] VJHIHMEH * Store the meta.longDescription and meta.license attributes in the
  • [41] X27GNHDV * Basic job info in the database.
  • [42] DVNWJXWW * Generic declaration of build products.
  • [43] YTZOC7C5 * Editing of jobset inputs.
  • [44] OI7GFOZ7 * removed stats from home page. will make global stats page later on
  • [45] FHF6IZJQ * Basic release management: releases are now dynamically computed as
  • [46] BVOPAMLS
  • [47] IK53RV4V
  • [48] 5SHCWE7X * Prevent repeated evaluation of a jobset with the same inputs. This
  • [49] RU7AQO7U * Role-based access control. Only admins can create projects. Only
  • [50] V4RNHJNR * Add a link to each project's homepage. Suggested by karltk.
  • [51] BD3GRK4B * Get rid of "positive failures" and separate log phases.
  • [52] KN3VYE5P * Cleaned up the foreign key constraints.
  • [53] CMU3YKOU * Store the release name.
  • [54] L2E6EVE2 * Merged the Build and Job tables.
  • [55] 6BLUKEQ2 * Caching of "path" inputs, and fake a revision number for those.
  • [56] H7CNGK4O * Log evaluation errors etc. in the DB.
  • [57] RBNQKATL * Adding persistant releases. A release is a named set of builds.
  • [58] 3E6IP3R3 * Add the name of the jobset to ReleaseSetJobs, otherwise we can't
  • [59] S6OISBQ3 * Mark the "current" builds in a jobset, i.e. those corresponding to
  • [60] VHYWSRIS * Add nix version to footer of hydra pages
  • [61] JM3DPYOM generated schema with new dbix class schema loader, grrrrrr
  • [62] PHX2HIVG * Store info about the build inputs in the build record.
  • [63] KOTB7BKV
  • [64] EYNG4EL4 * Regenerate the bindings from a clean sqlite database.
  • [65] ECBA3GQO * Make the schema class names match the case of the SQL table names.
  • [66] P5X4P6VK * Renaming "release sets" to "views" (not finished yet). Having
  • [*] D5QIOJGP * Move everything up one directory.
  • [*] JLDUSNUO * Unify rendering of finished and scheduled builds.
  • [*] N22GPKYT * Put info about logs / build products in the DB.

Change contents

  • file addition: Admin.pm (----------)
    [68.188]
    package Hydra::Controller::Admin;
    use strict;
    use warnings;
    use base 'Catalyst::Controller';
    use Hydra::Helper::Nix;
    use Hydra::Helper::CatalystUtils;
    sub admin : Path('/admin') Args(0) {
    my ($self, $c) = @_;
    requireAdmin($c);
    $c->stash->{template} = 'admin.tt';
    }
    sub clearfailedcache : Path('/admin/clear-failed-cache') Args(0) {
    my ($self, $c) = @_;
    requireAdmin($c);
    my $r = `nix-store --clear-failed-paths '*'`;
    $c->res->redirect("/admin");
    }
    sub clearevalcache : Path('/admin/clear-eval-cache') Args(0) {
    my ($self, $c) = @_;
    requireAdmin($c);
    print "Clearing evaluation cache\n";
    $c->model('DB::JobsetInputHashes')->delete_all;
    $c->res->redirect("/admin");
    }
    sub clearvcscache : Path('/admin/clear-vcs-cache') Args(0) {
    my ($self, $c) = @_;
    requireAdmin($c);
    print "Clearing path cache\n";
    $c->model('DB::CachedPathInputs')->delete_all;
    print "Clearing git cache\n";
    $c->model('DB::CachedGitInputs')->delete_all;
    print "Clearing subversion cache\n";
    $c->model('DB::CachedSubversionInputs')->delete_all;
    $c->res->redirect("/admin");
    }
    sub managenews : Path('/admin/news') Args(0) {
    my ($self, $c) = @_;
    requireAdmin($c);
    $c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, {order_by => 'createtime DESC'})];
    $c->stash->{template} = 'news.tt';
    }
    sub news_submit : Path('/admin/news/submit') Args(0) {
    my ($self, $c) = @_;
    requireAdmin($c);
    requirePost($c);
    my $contents = trim $c->request->params->{"contents"};
    my $createtime = time;
    $c->model('DB::NewsItems')->create({
    createtime => $createtime,
    contents => $contents,
    author => $c->user->username
    });
    $c->res->redirect("/admin/news");
    }
    sub news_delete : Path('/admin/news/delete') Args(1) {
    my ($self, $c, $id) = @_;
    requireAdmin($c);
    txn_do($c->model('DB')->schema, sub {
    my $newsItem = $c->model('DB::NewsItems')->find($id)
    or notFound($c, "Newsitem with id $id doesn't exist.");
    $newsItem->delete;
    });
    $c->res->redirect("/admin/news");
    }
    1;
  • replacement in src/lib/Hydra/Controller/Root.pm at line 19
    [8.172][3.0:1]()
    [8.172]
    [3.1]
  • edit in src/lib/Hydra/Controller/Root.pm at line 30
    [4.91]
    [69.52]
    $c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })];
  • file addition: NewsItems.pm (----------)
    [68.477]
    package Hydra::Schema::NewsItems;
    # Created by DBIx::Class::Schema::Loader
    # DO NOT MODIFY THE FIRST PART OF THIS FILE
    use strict;
    use warnings;
    use base 'DBIx::Class::Core';
    =head1 NAME
    Hydra::Schema::NewsItems
    =cut
    __PACKAGE__->table("NewsItems");
    =head1 ACCESSORS
    =head2 id
    data_type: integer
    default_value: undef
    is_auto_increment: 1
    is_nullable: 0
    size: undef
    =head2 contents
    data_type: text
    default_value: undef
    is_nullable: 0
    size: undef
    =head2 createtime
    data_type: integer
    default_value: undef
    is_nullable: 0
    size: undef
    =head2 author
    data_type: text
    default_value: undef
    is_foreign_key: 1
    is_nullable: 0
    size: undef
    =cut
    __PACKAGE__->add_columns(
    "id",
    {
    data_type => "integer",
    default_value => undef,
    is_auto_increment => 1,
    is_nullable => 0,
    size => undef,
    },
    "contents",
    {
    data_type => "text",
    default_value => undef,
    is_nullable => 0,
    size => undef,
    },
    "createtime",
    {
    data_type => "integer",
    default_value => undef,
    is_nullable => 0,
    size => undef,
    },
    "author",
    {
    data_type => "text",
    default_value => undef,
    is_foreign_key => 1,
    is_nullable => 0,
    size => undef,
    },
    );
    __PACKAGE__->set_primary_key("id");
    =head1 RELATIONS
    =head2 author
    Type: belongs_to
    Related object: L<Hydra::Schema::Users>
    =cut
    __PACKAGE__->belongs_to("author", "Hydra::Schema::Users", { username => "author" }, {});
    # Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-04-27 15:13:51
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SX13YZYhf5Uz5KZGphG/+w
    use Hydra::Helper::Nix;
    # !!! Ugly, should be generated.
    my $hydradbi = getHydraDBPath;
    if ($hydradbi =~ m/^dbi:Pg/) {
    __PACKAGE__->sequence('newsitems_id_seq');
    }
    1;
  • edit in src/lib/Hydra/Schema/Projects.pm at line 120
    [8.20640]
    [8.20640]
    =head2 projectmembers
    Type: has_many
    Related object: L<Hydra::Schema::ProjectMembers>
    =cut
    __PACKAGE__->has_many(
    "projectmembers",
    "Hydra::Schema::ProjectMembers",
    { "foreign.project" => "self.name" },
    );
  • replacement in src/lib/Hydra/Schema/Projects.pm at line 248
    [8.3685][6.5257:5399]()
    # Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-03-05 13:07:45
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SXJ+FzgNDad87OKSBH2qrg
    [8.3685]
    [8.3827]
    # Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-04-20 11:21:42
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1VZpwwaEdEJzrrV31ErPzw
    # These lines were loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Projects.pm' found in @INC.
    # They are now part of the custom portion of this file
    # for you to hand-edit. If you do not either delete
    # this section or remove that file from @INC, this section
    # will be repeated redundantly when you re-create this
    # file again via Loader! See skip_load_external to disable
    # this feature.
  • edit in src/lib/Hydra/Schema/Projects.pm at line 258
    [8.3828]
    [8.3919]
    # You can replace this text with custom content, and it will be preserved on regeneration
  • edit in src/lib/Hydra/Schema/Users.pm at line 1
    [8.3258]
    [8.3259]
    package Hydra::Schema::Users;
    # Created by DBIx::Class::Schema::Loader
    # DO NOT MODIFY THE FIRST PART OF THIS FILE
    use strict;
    use warnings;
    use base 'DBIx::Class::Core';
    =head1 NAME
    Hydra::Schema::Users
    =cut
    __PACKAGE__->table("Users");
    =head1 ACCESSORS
    =head2 username
    data_type: text
    default_value: undef
    is_nullable: 0
    size: undef
    =head2 fullname
    data_type: text
    default_value: undef
    is_nullable: 1
    size: undef
    =head2 emailaddress
    data_type: text
    default_value: undef
    is_nullable: 0
    size: undef
    =head2 password
    data_type: text
    default_value: undef
    is_nullable: 0
    size: undef
    =head2 emailonerror
    data_type: integer
    default_value: 0
    is_nullable: 0
    size: undef
    =cut
    __PACKAGE__->add_columns(
    "username",
    {
    data_type => "text",
    default_value => undef,
    is_nullable => 0,
    size => undef,
    },
    "fullname",
    {
    data_type => "text",
    default_value => undef,
    is_nullable => 1,
    size => undef,
    },
    "emailaddress",
    {
    data_type => "text",
    default_value => undef,
    is_nullable => 0,
    size => undef,
    },
    "password",
    {
    data_type => "text",
    default_value => undef,
    is_nullable => 0,
    size => undef,
    },
    "emailonerror",
    { data_type => "integer", default_value => 0, is_nullable => 0, size => undef },
    );
    __PACKAGE__->set_primary_key("username");
    =head1 RELATIONS
    =head2 userroles
    Type: has_many
    Related object: L<Hydra::Schema::UserRoles>
    =cut
    __PACKAGE__->has_many(
    "userroles",
    "Hydra::Schema::UserRoles",
    { "foreign.username" => "self.username" },
    );
    =head2 projects
    Type: has_many
    Related object: L<Hydra::Schema::Projects>
    =cut
    __PACKAGE__->has_many(
    "projects",
    "Hydra::Schema::Projects",
    { "foreign.owner" => "self.username" },
    );
    =head2 projectmembers
    Type: has_many
    Related object: L<Hydra::Schema::ProjectMembers>
    =cut
    __PACKAGE__->has_many(
    "projectmembers",
    "Hydra::Schema::ProjectMembers",
    { "foreign.username" => "self.username" },
    );
    =head2 newsitems
    Type: has_many
    Related object: L<Hydra::Schema::NewsItems>
    =cut
    __PACKAGE__->has_many(
    "newsitems",
    "Hydra::Schema::NewsItems",
    { "foreign.author" => "self.username" },
    );
    # Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-04-27 15:13:51
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:C5uoz6EYyYL442zRYmXkyw
    # These lines were loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Users.pm' found in @INC.
    # They are now part of the custom portion of this file
    # for you to hand-edit. If you do not either delete
    # this section or remove that file from @INC, this section
    # will be repeated redundantly when you re-create this
    # file again via Loader! See skip_load_external to disable
    # this feature.
  • edit in src/lib/Hydra/Schema/Users.pm at line 289
    [8.4019]
    # End of lines loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Users.pm'
    # These lines were loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Users.pm' found in @INC.
    # They are now part of the custom portion of this file
    # for you to hand-edit. If you do not either delete
    # this section or remove that file from @INC, this section
    # will be repeated redundantly when you re-create this
    # file again via Loader! See skip_load_external to disable
    # this feature.
    # You can replace this text with custom content, and it will be preserved on regeneration
    1;
  • file addition: admin.tt (----------)
    [68.1486]
    [% WRAPPER layout.tt title="Admin" %]
    [% PROCESS common.tt %]
    <h1>Admin</h1>
    <ul>
    <li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Project').action_for('create')) content = "Create project" %]</li>
    <li>Caching
    <ul>
    <li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('clearfailedcache')) content = "Clear failed builds cache" confirmmsg = "Are you sure you want to clear the failed builds cache?" %]</li>
    <li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('clearevalcache')) content = "Clear evaluation cache" confirmmsg = "Are you sure you want to clear the evaluation cache?" %]</li>
    <li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('clearvcscache')) content = "Clear VCS caches" confirmmsg = "Are you sure you want to clear the VCS caches?" %]</li>
    </ul>
    </li>
    <li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('managenews')) content = "News" %]</li>
    </ul>
    [% END %]
  • replacement in src/root/common.tt at line 177
    [8.6972][8.6972:7067]()
    [% IF uri %]<a [% HTML.attributes(href => uri) %]>[% content %]</a>[% ELSE; content; END -%]
    [8.6972]
    [8.7067]
    [% IF uri %]<a [% HTML.attributes(href => uri) %][% IF confirmmsg %]onclick="javascript:return confirm('[% confirmmsg %]')"[% END %]>[% content %]</a>[% ELSE; content; END -%]
  • replacement in src/root/layout.tt at line 93
    [8.2333][8.2333:2422]()
    <em>Hydra [% HTML.escape(version) %] (using [% HTML.escape(nixVersion) %]).</em>
    [8.2333]
    [8.2422]
    <em><a href="http://nixos.org/hydra" target="_new">Hydra</a> [% HTML.escape(version) %] (using [% HTML.escape(nixVersion) %]).</em>
  • file addition: news.tt (----------)
    [68.1486]
    [% WRAPPER layout.tt title="News items" %]
    [% PROCESS common.tt %]
    [% USE String %]
    <h1>News items</h1>
    [% IF newsItems.size == 0 %]
    <p>No news items</p>
    [% ELSE %]
    <table>
    <thead><th>Date</th><th>Contents</th><th></th></thead>
    <tbody>
    [% FOREACH i IN newsItems %]
    [% contents = String.new(i.contents) %]
    <tr>
    <td>[% INCLUDE renderDateTime timestamp=i.createtime %]</td>
    <td>[% contents.replace('\n','<br />\n') %]</td>
    <td>[ [% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('news_delete') i.id) content = "Delete" confirmmsg = "Are you sure you want to delete this news item?" %] ]</td>
    </tr>
    [% END %]
    </tbody>
    </table>
    [% END %]
    <form action="[% c.uri_for('/admin/news/submit') %]" method="post">
    <h2>Add news item</h2>
    <p>
    <textarea class="longString" name="contents"></textarea>
    </p>
    <p>
    <button type="submit">Post</button>
    </p>
    </form>
    [% END %]
  • edit in src/root/overview.tt at line 3
    [8.19139]
    [8.19140]
    [% IF newItems.size != 0 %]
    <div class="newsbar">
    [% FOREACH i IN newsItems %]
    [% contents = String.new(i.contents) %]
    <p><b>[% INCLUDE renderDateTime timestamp=i.createtime %]</b> <tt>by [% i.author.fullname %]</tt> <br/>[% contents.replace('\n','<br />\n') %]
    [% END %]
    </div>
    [% END %]
  • edit in src/root/overview.tt at line 45
    [8.20476][8.20476:20477]()
  • edit in src/root/static/css/hydra.css at line 187
    [2.1126]
    [2.1126]
    width: 40em;
    }
    textarea.longString {
  • edit in src/root/static/css/hydra.css at line 215
    [7.1423]
    .newsbar {
    background-color:#D9E3EA;
    border:1px solid #999999;
    float:right;
    font-size:x-small;
    margin:0 0 0.5em 0.5em;
    overflow:hidden;
    padding:0.5em;
    width:30em;
    }
  • edit in src/root/topbar.tt at line 36
    [8.7675][8.327586:327678]()
    [% INCLUDE makeLink
    uri = "http://nixos.org/hydra"
    title = "About" %]
  • edit in src/root/topbar.tt at line 37
    [8.7704]
    [8.7704]
    [% IF c.check_user_roles('admin') %]
    [% INCLUDE makeLink
    uri = c.uri_for(c.controller('Admin').action_for('admin'))
    title = "Admin" %]
    [% END %]
  • edit in src/sql/hydra.sql at line 459
    [5.864]
    [5.864]
    );
    create table NewsItems (
    #ifdef POSTGRESQL
    id serial primary key not null,
    #else
    id integer primary key autoincrement not null,
    #endif
    contents text not null,
    createTime integer not null,
    author text not null,
    foreign key (author) references Users(userName) on delete cascade on update cascade