From 96a514c16906a99e7b8569bb3e8362701c22edd5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 May 2020 12:39:21 +0200 Subject: [PATCH] Remove the "releases" feature We haven't used this in many years (it was really only used for nix and patchelf releases). --- doc/dev-notes.txt | 18 ---- doc/manual/api.xml | 5 +- src/lib/Hydra/Controller/Build.pm | 29 ----- src/lib/Hydra/Controller/JobsetEval.pm | 36 ------- src/lib/Hydra/Controller/Project.pm | 33 ------ src/lib/Hydra/Controller/Release.pm | 81 -------------- src/lib/Hydra/Schema/Builds.pm | 19 +--- src/lib/Hydra/Schema/Projects.pm | 35 +----- src/lib/Hydra/Schema/ReleaseMembers.pm | 141 ------------------------- src/lib/Hydra/Schema/Releases.pm | 125 ---------------------- src/root/build.tt | 30 ------ src/root/edit-release.tt | 62 ----------- src/root/project.tt | 33 ------ src/root/release.tt | 29 ----- src/script/hydra-update-gc-roots | 7 -- src/sql/hydra.sql | 33 +----- src/sql/update-dbix.pl | 2 - 17 files changed, 6 insertions(+), 712 deletions(-) delete mode 100644 src/lib/Hydra/Controller/Release.pm delete mode 100644 src/lib/Hydra/Schema/ReleaseMembers.pm delete mode 100644 src/lib/Hydra/Schema/Releases.pm delete mode 100644 src/root/edit-release.tt delete mode 100644 src/root/release.tt diff --git a/doc/dev-notes.txt b/doc/dev-notes.txt index 36ec193f..caadb57d 100644 --- a/doc/dev-notes.txt +++ b/doc/dev-notes.txt @@ -25,24 +25,6 @@ $ hydra-create-user root --role create-projects -* Creating a release set: - - insert into ReleaseSets(project, name) values('patchelf', 'unstable'); - insert into ReleaseSetJobs(isPrimary, project, release, job, attrs, description) values(1, 'patchelf', 'unstable', 'tarball', 'officialRelease=false', 'Source distribution'); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'unstable', 'build', 'system=i686-linux', 'Build on i686-linux'); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'unstable', 'build', 'system=x86_64-linux', 'Build on x86_64-linux'); - insert into ReleaseSetJobs(project, release, job, attrs, description, mayFail) values('patchelf', 'unstable', 'rpm_fedora9i386', '', 'Fedora 9 (i386)', 1); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'unstable', 'rpm_fedora10i386', '', 'Fedora 10 (i386)'); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'unstable', 'deb_ubuntu804i386', '', 'Ubuntu 8.04 (i386)'); - - insert into ReleaseSets(project, name) values('patchelf', 'stable'); - insert into ReleaseSetJobs(isPrimary, project, release, job, attrs, description) values(1, 'patchelf', 'stable', 'tarball', 'officialRelease=true', 'Source distribution'); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'stable', 'build', 'system=i686-linux', 'Build on i686-linux'); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'stable', 'build', 'system=x86_64-linux', 'Build on x86_64-linux'); - insert into ReleaseSetJobs(project, release, job, attrs, description, mayFail) values('patchelf', 'stable', 'rpm_fedora9i386', '', 'Fedora 9 (i386)', 1); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'stable', 'rpm_fedora10i386', '', 'Fedora 10 (i386)'); - insert into ReleaseSetJobs(project, release, job, attrs, description) values('patchelf', 'stable', 'deb_ubuntu804i386', '', 'Ubuntu 8.04 (i386)'); - * Changing the priority of a scheduled build: update buildschedulinginfo set priority = 200 where id = ; diff --git a/doc/manual/api.xml b/doc/manual/api.xml index 435af049..6656d98b 100644 --- a/doc/manual/api.xml +++ b/doc/manual/api.xml @@ -66,7 +66,6 @@ Content-Type: application/json { "displayname": "Acoda", "name": "acoda", - "releases": [], "description": "Acoda is a tool set for automatic data migration along an evolving data model", "enabled": 0, "owner": "sander", @@ -78,7 +77,6 @@ Content-Type: application/json { "displayname": "cabal2nix", "name": "cabal2nix", - "releases": [], "description": "Convert Cabal files into Nix build instructions", "enabled": 0, "owner": "simons@cryp.to", @@ -129,8 +127,7 @@ Content-Type: application/json ], "name": "hydra", "enabled": 1, - "owner": "eelco", - "releases": [] + "owner": "eelco" } diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 53c74527..75e3c0c5 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -554,35 +554,6 @@ sub bump : Chained('buildChain') PathPart('bump') { } -sub add_to_release : Chained('buildChain') PathPart('add-to-release') Args(0) { - my ($self, $c) = @_; - - my $build = $c->stash->{build}; - - requireProjectOwner($c, $build->project); - - my $releaseName = trim $c->request->params->{name}; - - my $release = $build->project->releases->find({name => $releaseName}); - - error($c, "This project has no release named `$releaseName'.") unless $release; - - error($c, "This build is already a part of release `$releaseName'.") - if $release->releasemembers->find({build => $build->id}); - - foreach my $output ($build->buildoutputs) { - error($c, "This build is no longer available.") unless isValidPath $output->path; - registerRoot $output->path; - } - - $release->releasemembers->create({build => $build->id, description => $build->description}); - - $c->flash->{successMsg} = "Build added to project $releaseName."; - - $c->res->redirect($c->uri_for($self->action_for("build"), $c->req->captures)); -} - - sub get_info : Chained('buildChain') PathPart('api/get-info') Args(0) { my ($self, $c) = @_; my $build = $c->stash->{build}; diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index 35e89e85..41c5471d 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -130,42 +130,6 @@ sub view_GET { } -sub release : Chained('evalChain') PathPart('release') Args(0) { - my ($self, $c) = @_; - my $eval = $c->stash->{eval}; - - requireProjectOwner($c, $c->stash->{project}); - - my @builds = $eval->builds; - - my $releaseName; - $releaseName ||= $_->releasename foreach @builds; - - # If no release name has been defined by any of the builds, compose one of the project name and evaluation id - $releaseName = $eval->get_column('project') . "-" . $eval->id unless defined $releaseName; - - my $release; - - $c->model('DB')->schema->txn_do(sub { - - $release = $c->stash->{project}->releases->create( - { name => $releaseName - , timestamp => time - }); - - foreach my $build (@builds) { - $release->releasemembers->create( - { build => $build->id - , description => $build->description - }) if $build->buildstatus == 0; - } - }); - - $c->res->redirect($c->uri_for($c->controller('Release')->action_for('view'), - [$c->stash->{project}->name, $release->name])); -} - - sub create_jobset : Chained('evalChain') PathPart('create-jobset') Args(0) { my ($self, $c) = @_; my $eval = $c->stash->{eval}; diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index 51b31a0d..c74e9073 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -29,8 +29,6 @@ sub project_GET { $c->stash->{template} = 'project.tt'; $c->stash->{jobsets} = [jobsetOverview($c, $c->stash->{project})]; - $c->stash->{releases} = [$c->stash->{project}->releases->search({}, - {order_by => ["timestamp DESC"]})]; $self->status_ok($c, entity => $c->stash->{project}); } @@ -182,35 +180,4 @@ sub get_builds : Chained('projectChain') PathPart('') CaptureArgs(0) { } -sub create_release : Chained('projectChain') PathPart('create-release') Args(0) { - my ($self, $c) = @_; - requireProjectOwner($c, $c->stash->{project}); - $c->stash->{template} = 'edit-release.tt'; - $c->stash->{create} = 1; -} - - -sub create_release_submit : Chained('projectChain') PathPart('create-release/submit') Args(0) { - my ($self, $c) = @_; - - requireProjectOwner($c, $c->stash->{project}); - - my $releaseName = $c->request->params->{name}; - - my $release; - $c->model('DB')->schema->txn_do(sub { - # Note: $releaseName is validated in updateRelease, which will - # abort the transaction if the name isn't valid. - $release = $c->stash->{project}->releases->create( - { name => $releaseName - , timestamp => time - }); - Hydra::Controller::Release::updateRelease($c, $release); - }); - - $c->res->redirect($c->uri_for($c->controller('Release')->action_for('view'), - [$c->stash->{project}->name, $release->name])); -} - - 1; diff --git a/src/lib/Hydra/Controller/Release.pm b/src/lib/Hydra/Controller/Release.pm deleted file mode 100644 index 06edf45b..00000000 --- a/src/lib/Hydra/Controller/Release.pm +++ /dev/null @@ -1,81 +0,0 @@ -package Hydra::Controller::Release; - -use strict; -use warnings; -use base 'Catalyst::Controller'; -use Hydra::Helper::Nix; -use Hydra::Helper::CatalystUtils; - - -sub release : Chained('/') PathPart('release') CaptureArgs(2) { - my ($self, $c, $projectName, $releaseName) = @_; - - $c->stash->{project} = $c->model('DB::Projects')->find($projectName) - or notFound($c, "Project $projectName doesn't exist."); - - $c->stash->{release} = $c->stash->{project}->releases->find({name => $releaseName}) - or notFound($c, "Release $releaseName doesn't exist."); -} - - -sub view : Chained('release') PathPart('') Args(0) { - my ($self, $c) = @_; - $c->stash->{template} = 'release.tt'; - $c->stash->{members} = [$c->stash->{release}->releasemembers->search({}, - {order_by => ["description"]})]; -} - - -sub updateRelease { - my ($c, $release) = @_; - - my $releaseName = trim $c->request->params->{name}; - error($c, "Invalid release name: $releaseName") - unless $releaseName =~ /^$relNameRE$/; - - $release->update( - { name => $releaseName - , description => trim $c->request->params->{description} - }); - - $release->releasemembers->delete; - foreach my $param (keys %{$c->request->params}) { - next unless $param =~ /^member-(\d+)-description$/; - my $buildId = $1; - my $description = trim $c->request->params->{"member-$buildId-description"}; - $release->releasemembers->create({ build => $buildId, description => $description }); - } -} - - -sub edit : Chained('release') PathPart('edit') Args(0) { - my ($self, $c) = @_; - requireProjectOwner($c, $c->stash->{project}); - $c->stash->{template} = 'edit-release.tt'; - $c->stash->{members} = [$c->stash->{release}->releasemembers->search({}, - {order_by => ["description"]})]; -} - - -sub submit : Chained('release') PathPart('submit') Args(0) { - my ($self, $c) = @_; - - requireProjectOwner($c, $c->stash->{project}); - - if (($c->request->params->{action} || "") eq "delete") { - $c->model('DB')->schema->txn_do(sub { - $c->stash->{release}->delete; - }); - $c->res->redirect($c->uri_for($c->controller('Project')->action_for('project'), - [$c->stash->{project}->name])); - } else { - $c->model('DB')->schema->txn_do(sub { - updateRelease($c, $c->stash->{release}); - }); - $c->res->redirect($c->uri_for($self->action_for("view"), - [$c->stash->{project}->name, $c->stash->{release}->name])); - } -} - - -1; diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index fdbc5ed6..99996a96 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -529,21 +529,6 @@ __PACKAGE__->belongs_to( { is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" }, ); -=head2 releasemembers - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "releasemembers", - "Hydra::Schema::ReleaseMembers", - { "foreign.build" => "self.id" }, - undef, -); - =head2 aggregates Type: many_to_many @@ -573,8 +558,8 @@ __PACKAGE__->many_to_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:34:25 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EEXlcKN/ydXJ129vT0jTUw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-06 12:32:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3IyFj/9Zf/hvmhBY4U/IBQ __PACKAGE__->has_many( "dependents", diff --git a/src/lib/Hydra/Schema/Projects.pm b/src/lib/Hydra/Schema/Projects.pm index 038ccdc7..f1c6c89e 100644 --- a/src/lib/Hydra/Schema/Projects.pm +++ b/src/lib/Hydra/Schema/Projects.pm @@ -247,36 +247,6 @@ __PACKAGE__->has_many( undef, ); -=head2 releasemembers - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "releasemembers", - "Hydra::Schema::ReleaseMembers", - { "foreign.project" => "self.name" }, - undef, -); - -=head2 releases - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "releases", - "Hydra::Schema::Releases", - { "foreign.project" => "self.name" }, - undef, -); - =head2 starredjobs Type: has_many @@ -303,8 +273,8 @@ Composing rels: L -> username __PACKAGE__->many_to_many("usernames", "projectmembers", "username"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pcF/8351zyo9VL6N5eimdQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-06 12:32:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dEIVgrFGilPfITprs6nYuA my %hint = ( columns => [ @@ -316,7 +286,6 @@ my %hint = ( "owner" ], relations => { - releases => "name", jobsets => "name" } ); diff --git a/src/lib/Hydra/Schema/ReleaseMembers.pm b/src/lib/Hydra/Schema/ReleaseMembers.pm deleted file mode 100644 index 6c6e8a0e..00000000 --- a/src/lib/Hydra/Schema/ReleaseMembers.pm +++ /dev/null @@ -1,141 +0,0 @@ -use utf8; -package Hydra::Schema::ReleaseMembers; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Hydra::Schema::ReleaseMembers - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 COMPONENTS LOADED - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->load_components("+Hydra::Component::ToJSON"); - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("releasemembers"); - -=head1 ACCESSORS - -=head2 project - - data_type: 'text' - is_foreign_key: 1 - is_nullable: 0 - -=head2 release_ - - data_type: 'text' - is_foreign_key: 1 - is_nullable: 0 - -=head2 build - - data_type: 'integer' - is_foreign_key: 1 - is_nullable: 0 - -=head2 description - - data_type: 'text' - is_nullable: 1 - -=cut - -__PACKAGE__->add_columns( - "project", - { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, - "release_", - { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, - "build", - { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, - "description", - { data_type => "text", is_nullable => 1 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=item * L - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("project", "release_", "build"); - -=head1 RELATIONS - -=head2 build - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "build", - "Hydra::Schema::Builds", - { id => "build" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, -); - -=head2 project - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "project", - "Hydra::Schema::Projects", - { name => "project" }, - { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, -); - -=head2 release - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "release", - "Hydra::Schema::Releases", - { name => "release_", project => "project" }, - { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, -); - - -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:k4z2YeB4gRAeAP6hmR93sQ - -1; diff --git a/src/lib/Hydra/Schema/Releases.pm b/src/lib/Hydra/Schema/Releases.pm deleted file mode 100644 index 8cfb19e1..00000000 --- a/src/lib/Hydra/Schema/Releases.pm +++ /dev/null @@ -1,125 +0,0 @@ -use utf8; -package Hydra::Schema::Releases; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Hydra::Schema::Releases - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 COMPONENTS LOADED - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->load_components("+Hydra::Component::ToJSON"); - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("releases"); - -=head1 ACCESSORS - -=head2 project - - data_type: 'text' - is_foreign_key: 1 - is_nullable: 0 - -=head2 name - - data_type: 'text' - is_nullable: 0 - -=head2 timestamp - - data_type: 'integer' - is_nullable: 0 - -=head2 description - - data_type: 'text' - is_nullable: 1 - -=cut - -__PACKAGE__->add_columns( - "project", - { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, - "name", - { data_type => "text", is_nullable => 0 }, - "timestamp", - { data_type => "integer", is_nullable => 0 }, - "description", - { data_type => "text", is_nullable => 1 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("project", "name"); - -=head1 RELATIONS - -=head2 project - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "project", - "Hydra::Schema::Projects", - { name => "project" }, - { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, -); - -=head2 releasemembers - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "releasemembers", - "Hydra::Schema::ReleaseMembers", - { - "foreign.project" => "self.project", - "foreign.release_" => "self.name", - }, - undef, -); - - -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:b4M/tHOhsy234tgTf+wqjQ - -1; diff --git a/src/root/build.tt b/src/root/build.tt index a18ad16e..63c11a5f 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -137,12 +137,6 @@ END;
  • Cancel
  • Bump up
  • [% END %] - [% IF available && project.releases %] - [% INCLUDE menuItem - uri = "#add-to-release" - title = "Add to release" - modal = 1 %] - [% END %] [% END %] @@ -496,30 +490,6 @@ END; -[% IF c.user_exists && available && project.releases %] - -[% END %] - -