Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

disable_publish_for_branches: new configuration option

OBS currently disables publishing for any new branch in order to avoid
using disk space and bandwidth to carry out publishing. For small private
installations, it can make sense to avoid that, and inherit the publish
flags from the parent project instead.

Bug: openSUSE#596
  • Loading branch information...
commit 0f508c3ba2d80853b43d0004fe832d537def7ab8 1 parent a1f3bb2
@smcv authored
View
9 docs/api/api/configuration.rng
@@ -133,6 +133,15 @@
</choice>
</element>
</optional>
+ <optional>
+ <element name="disable_publish_for_branches">
+ <!-- When a user creates a new project as a side-effect of branching a package, disable publishing that project? The default is "on" to save disk space and bandwidth. -->
+ <choice>
+ <value>on</value>
+ <value>off</value>
+ </choice>
+ </element>
+ </optional>
<!-- webui only stuff -->
<optional>
View
3  src/api/app/models/configuration.rb
@@ -27,8 +27,9 @@ class Configuration < ActiveRecord::Base
:cleanup_after_days => nil,
:theme => CONFIG['theme'],
:cleanup_empty_projects => nil,
+ :disable_publish_for_branches => nil,
}
- ON_OFF_OPTIONS = [ :anonymous, :default_access_disabled, :allow_user_to_create_home_project, :disallow_group_creation, :change_password, :hide_private_options, :gravatar, :download_on_demand, :enforce_project_keys, :cleanup_empty_projects ]
+ ON_OFF_OPTIONS = [ :anonymous, :default_access_disabled, :allow_user_to_create_home_project, :disallow_group_creation, :change_password, :hide_private_options, :gravatar, :download_on_demand, :enforce_project_keys, :cleanup_empty_projects, :disable_publish_for_branches ]
class << self
def map_value(key, value)
View
18 src/api/app/models/project.rb
@@ -1070,13 +1070,21 @@ def branch_to_repositories_from(project, pkg_to_enable, extend_names=nil)
end
pkg_to_enable.enable_for_repository(repoName) if pkg_to_enable
end
- # take over flags, but explicit disable publishing by default and enable building. Ommiting also lock or we can not create packages
+ # Take over flags, but enable building.
+ # By default, disable 'publish' to save space and bandwidth, but this
+ # can be turned off for small installations.
+ # Also omit 'lock' or we cannot create packages.
+ disable_publish_for_branches = ::Configuration.first.disable_publish_for_branches
project.flags.each do |f|
- unless %w(build publish lock).include?(f.flag)
- self.flags.create(status: f.status, flag: f.flag, architecture: f.architecture, repo: f.repo)
- end
+ next if %w(build lock).include?(f.flag)
+ next if f.flag == 'publish' and disable_publish_for_branches
+
+ self.flags.create(status: f.status, flag: f.flag, architecture: f.architecture, repo: f.repo)
+ end
+
+ if disable_publish_for_branches
+ self.flags.create(:status => 'disable', :flag => 'publish') unless self.flags.find_by_flag_and_status( 'publish', 'disable' )
end
- self.flags.create(:status => 'disable', :flag => 'publish') unless self.flags.find_by_flag_and_status( 'publish', 'disable' )
end
def open_requests_with_project_as_source_or_target
View
9 src/api/db/migrate/20140219185200_disable_publish_for_branches.rb
@@ -0,0 +1,9 @@
+class DisablePublishForBranches < ActiveRecord::Migration
+ def self.up
+ add_column :configurations, :disable_publish_for_branches, :boolean, :default => true
+ end
+
+ def self.down
+ remove_column :configurations, :disable_publish_for_branches
+ end
+end
View
3  src/api/db/structure.sql
@@ -345,6 +345,7 @@ CREATE TABLE `configurations` (
`obs_url` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`cleanup_after_days` int(11) DEFAULT NULL,
`cleanup_empty_projects` tinyint(1) DEFAULT '1',
+ `disable_publish_for_branches` tinyint(1) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@@ -1445,6 +1446,8 @@ INSERT INTO schema_migrations (version) VALUES ('20140210114542');
INSERT INTO schema_migrations (version) VALUES ('20140218174400');
+INSERT INTO schema_migrations (version) VALUES ('20140219185200');
+
INSERT INTO schema_migrations (version) VALUES ('21');
INSERT INTO schema_migrations (version) VALUES ('22');
View
1  src/backend/BSXML.pm
@@ -1472,6 +1472,7 @@ our $configuration = [
'no_proxy',
'theme',
'cleanup_empty_projects',
+ 'disable_publish_for_branches',
[ 'schedulers' =>
[ 'arch' ],
],
Please sign in to comment.
Something went wrong with that request. Please try again.