summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-20 17:47:23 (GMT)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-20 18:16:39 (GMT)
commit28702ef890a19d50c70687903d9f6bdac6ee545c (patch)
treedd32d8b584ef8eda0905f6d7831edcf112a91f85
parent89e093411459637c07ef0a162e8c124daa39d8f0 (diff)
downloadopen-build-service-28702ef890a19d50c70687903d9f6bdac6ee545c.tar.gz
open-build-service-28702ef890a19d50c70687903d9f6bdac6ee545c.tar.xz
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. This is a backport to our 2.3.8-based OBS; the patches I've sent upstream are rather different, because the way OBS deals with configuration has changed significantly. Bug: https://github.com/openSUSE/open-build-service/issues/596 Applied-upstream: no
-rw-r--r--src/api/app/helpers/maintenance_helper.rb19
-rw-r--r--src/api/config/options.yml.example5
2 files changed, 18 insertions, 6 deletions
diff --git a/src/api/app/helpers/maintenance_helper.rb b/src/api/app/helpers/maintenance_helper.rb
index a257b7f..2bd70fc 100644
--- a/src/api/app/helpers/maintenance_helper.rb
+++ b/src/api/app/helpers/maintenance_helper.rb
@@ -837,15 +837,22 @@ module MaintenanceHelper
end
end
if add_repositories
- # 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 = (CONFIG['disable_publish_for_branches'] != false)
p[:link_target_project].flags.each do |f|
- unless [ "build", "publish", "lock" ].include?(f.flag)
- unless tprj.flags.find_by_flag_and_status( f.flag, f.status, f.repo, f.architecture )
- tprj.flags.create(:status => f.status, :flag => f.flag, :architecture => f.architecture, :repo => f.repo)
- end
+ next if [ "build", "lock" ].include?(f.flag)
+ next if f.flag == 'publish' and disable_publish_for_branches
+
+ unless tprj.flags.find_by_flag_and_status( f.flag, f.status, f.repo, f.architecture )
+ tprj.flags.create(:status => f.status, :flag => f.flag, :architecture => f.architecture, :repo => f.repo)
end
end
- tprj.flags.create(:status => "disable", :flag => 'publish') unless tprj.flags.find_by_flag_and_status( 'publish', 'disable' )
+ if disable_publish_for_branches
+ tprj.flags.create(:status => "disable", :flag => 'publish') unless tprj.flags.find_by_flag_and_status( 'publish', 'disable' )
+ end
end
else
# FIXME for remote project instances
diff --git a/src/api/config/options.yml.example b/src/api/config/options.yml.example
index 67cc74a..8a35766 100644
--- a/src/api/config/options.yml.example
+++ b/src/api/config/options.yml.example
@@ -41,3 +41,8 @@ min_votes_for_rating: 3
# If the last package in a project is cleaned up by sourceupdate=cleanup,
# delete the whole project unless this is set to "false"
#cleanup_empty_projects: true
+
+# When a user creates a new project as a side-effect of branching a
+# package, disable publishing that project? The default is "true" to
+# save disk space and bandwidth.
+#disable_publish_for_branches: true