Merge branch 'master' into 29-migrate-to-ruby-2.1
This commit is contained in:
commit
98ca0641ff
|
@ -11,7 +11,7 @@ var _locales = {
|
||||||
'Всего %1 тега',
|
'Всего %1 тега',
|
||||||
'Всего %1 тегов'
|
'Всего %1 тегов'
|
||||||
],
|
],
|
||||||
<%= BuildList::STATUSES.map{|s| "'build_list.status.#{s}':'#{BuildList.human_status(s)}'"}.join(',') %>
|
<%= BuildList::STATUSES.map{|s| "'build_list.status.#{s}': '#{BuildList.human_status(s)}'"}.join(',') %>
|
||||||
},
|
},
|
||||||
<%I18n.locale = :en%>
|
<%I18n.locale = :en%>
|
||||||
'en-us': {
|
'en-us': {
|
||||||
|
@ -23,6 +23,6 @@ var _locales = {
|
||||||
'Total %1 tag',
|
'Total %1 tag',
|
||||||
'Total %1 tags'
|
'Total %1 tags'
|
||||||
],
|
],
|
||||||
<%= BuildList::STATUSES.map{|s| "'build_list.status.#{s}':'#{BuildList.human_status(s)}'"}.join(',') %>
|
<%= BuildList::STATUSES.map{|s| "'build_list.status.#{s}': '#{BuildList.human_status(s)}'"}.join(',') %>
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -16,11 +16,6 @@ class Api::V1::JobsController < Api::V1::BaseController
|
||||||
if current_user.system?
|
if current_user.system?
|
||||||
if task = (Resque.pop('rpm_worker_default') || Resque.pop('rpm_worker'))
|
if task = (Resque.pop('rpm_worker_default') || Resque.pop('rpm_worker'))
|
||||||
@build_list = BuildList.where(:id => task['args'][0]['id']).first
|
@build_list = BuildList.where(:id => task['args'][0]['id']).first
|
||||||
# Temporally
|
|
||||||
if @build_list.build_for_platform.name == 'red3'
|
|
||||||
@build_list.restart_job
|
|
||||||
@build_list = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,7 @@ class Platforms::RepositoriesController < Platforms::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @repository.update_attributes(
|
if @repository.update_attributes params[:repository].slice(:description, :synchronizing_publications).merge(:publish_without_qa => (params[:repository][:publish_without_qa] || @repository.publish_without_qa))
|
||||||
:description => params[:repository][:description],
|
|
||||||
:publish_without_qa => (params[:repository][:publish_without_qa] || @repository.publish_without_qa)
|
|
||||||
)
|
|
||||||
flash[:notice] = I18n.t("flash.repository.updated")
|
flash[:notice] = I18n.t("flash.repository.updated")
|
||||||
redirect_to platform_repository_path(@platform, @repository)
|
redirect_to platform_repository_path(@platform, @repository)
|
||||||
else
|
else
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
:build_for_platform,
|
:build_for_platform,
|
||||||
:user,
|
:user,
|
||||||
:source_packages,
|
:source_packages,
|
||||||
:project
|
:project => :project_statistics
|
||||||
)
|
)
|
||||||
|
|
||||||
@build_server_status = AbfWorker::StatusInspector.projects_status
|
@build_server_status = AbfWorker::StatusInspector.projects_status
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Ability
|
||||||
can([:mass_import, :run_mass_import], Project) if user.platforms.main.find{ |p| local_admin?(p) }.present?
|
can([:mass_import, :run_mass_import], Project) if user.platforms.main.find{ |p| local_admin?(p) }.present?
|
||||||
can :read, Project, :visibility => 'open'
|
can :read, Project, :visibility => 'open'
|
||||||
can [:read, :archive, :membered, :get_id], Project, :owner_type => 'User', :owner_id => user.id
|
can [:read, :archive, :membered, :get_id], Project, :owner_type => 'User', :owner_id => user.id
|
||||||
can [:read, :archive, :membered, :get_id], Project, :owner_type => 'Group', :owner_id => user.group_ids
|
can [:read, :archive, :membered, :get_id], Project, :owner_type => 'Group', :owner_id => user_group_ids
|
||||||
can([:read, :archive, :membered, :get_id], Project, read_relations_for('projects')) {|project| local_reader? project}
|
can([:read, :archive, :membered, :get_id], Project, read_relations_for('projects')) {|project| local_reader? project}
|
||||||
can(:write, Project) {|project| local_writer? project} # for grack
|
can(:write, Project) {|project| local_writer? project} # for grack
|
||||||
can [:update, :sections, :manage_collaborators, :autocomplete_maintainers, :add_member, :remove_member, :update_member, :members], Project do |project|
|
can [:update, :sections, :manage_collaborators, :autocomplete_maintainers, :add_member, :remove_member, :update_member, :members], Project do |project|
|
||||||
|
@ -80,7 +80,7 @@ class Ability
|
||||||
|
|
||||||
can [:read, :log, :owned, :everything], BuildList, :user_id => user.id
|
can [:read, :log, :owned, :everything], BuildList, :user_id => user.id
|
||||||
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
|
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
|
||||||
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
|
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user_group_ids}
|
||||||
can([:read, :log, :everything, :list], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
|
can([:read, :log, :everything, :list], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
|
||||||
|
|
||||||
can(:publish_into_testing, BuildList) { |build_list| can?(:create, build_list) && build_list.save_to_platform.main? }
|
can(:publish_into_testing, BuildList) { |build_list| can?(:create, build_list) && build_list.save_to_platform.main? }
|
||||||
|
@ -108,7 +108,7 @@ class Ability
|
||||||
can([:cancel, :create_container], BuildList) {|build_list| can?(:write, build_list.project)}
|
can([:cancel, :create_container], BuildList) {|build_list| can?(:write, build_list.project)}
|
||||||
|
|
||||||
can [:read, :owned, :related, :members], Platform, :owner_type => 'User', :owner_id => user.id
|
can [:read, :owned, :related, :members], Platform, :owner_type => 'User', :owner_id => user.id
|
||||||
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids
|
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user_group_ids
|
||||||
can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
|
can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
|
||||||
can [:read, :related], Platform, :id => user.repositories.pluck(:platform_id)
|
can [:read, :related], Platform, :id => user.repositories.pluck(:platform_id)
|
||||||
can([:update, :destroy, :change_visibility], Platform) {|platform| owner?(platform) }
|
can([:update, :destroy, :change_visibility], Platform) {|platform| owner?(platform) }
|
||||||
|
@ -118,7 +118,7 @@ class Ability
|
||||||
can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.save_to_platform) || local_admin?(mass_build.save_to_platform)) && !mass_build.stop_build}
|
can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.save_to_platform) || local_admin?(mass_build.save_to_platform)) && !mass_build.stop_build}
|
||||||
|
|
||||||
can [:read, :projects_list, :projects], Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
|
can [:read, :projects_list, :projects], Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
|
||||||
can [:read, :projects_list, :projects], Repository, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
|
can [:read, :projects_list, :projects], Repository, :platform => {:owner_type => 'Group', :owner_id => user_group_ids}
|
||||||
can([:read, :projects_list, :projects], Repository, read_relations_for('repositories')) {|repository| can? :show, repository.platform}
|
can([:read, :projects_list, :projects], Repository, read_relations_for('repositories')) {|repository| can? :show, repository.platform}
|
||||||
can([:read, :projects_list, :projects], Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform}
|
can([:read, :projects_list, :projects], Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform}
|
||||||
can([:create, :edit, :update, :destroy, :projects_list, :projects, :add_project, :remove_project, :regenerate_metadata, :sync_lock_file, :add_repo_lock_file, :remove_repo_lock_file], Repository) {|repository| local_admin? repository.platform}
|
can([:create, :edit, :update, :destroy, :projects_list, :projects, :add_project, :remove_project, :regenerate_metadata, :sync_lock_file, :add_repo_lock_file, :remove_repo_lock_file], Repository) {|repository| local_admin? repository.platform}
|
||||||
|
@ -133,7 +133,7 @@ class Ability
|
||||||
can([:read, :create, :withdraw], Token) {|token| local_admin?(token.subject)}
|
can([:read, :create, :withdraw], Token) {|token| local_admin?(token.subject)}
|
||||||
|
|
||||||
can :read, Product, :platform => {:owner_type => 'User', :owner_id => user.id, :platform_type => 'main'}
|
can :read, Product, :platform => {:owner_type => 'User', :owner_id => user.id, :platform_type => 'main'}
|
||||||
can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user.group_ids, :platform_type => 'main'}
|
can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user_group_ids, :platform_type => 'main'}
|
||||||
can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?}
|
can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?}
|
||||||
can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform and product.platform.main?}
|
can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform and product.platform.main?}
|
||||||
|
|
||||||
|
@ -141,17 +141,17 @@ class Ability
|
||||||
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
|
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
|
||||||
|
|
||||||
can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id}
|
can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id}
|
||||||
can [:read, :create], PrivateUser, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
|
can [:read, :create], PrivateUser, :platform => {:owner_type => 'Group', :owner_id => user_group_ids}
|
||||||
|
|
||||||
can :read, Issue, :project => {:owner_type => 'User', :owner_id => user.id}
|
can :read, Issue, :project => {:owner_type => 'User', :owner_id => user.id}
|
||||||
can :read, Issue, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
|
can :read, Issue, :project => {:owner_type => 'Group', :owner_id => user_group_ids}
|
||||||
can(:read, Issue, read_relations_for('issues', 'projects')) {|issue| can? :read, issue.project rescue nil}
|
can(:read, Issue, read_relations_for('issues', 'projects')) {|issue| can? :read, issue.project rescue nil}
|
||||||
can(:create, Issue) {|issue| can? :read, issue.project}
|
can(:create, Issue) {|issue| can? :read, issue.project}
|
||||||
can(:update, Issue) {|issue| issue.user_id == user.id or local_admin?(issue.project)}
|
can(:update, Issue) {|issue| issue.user_id == user.id or local_admin?(issue.project)}
|
||||||
cannot :manage, Issue, :project => {:has_issues => false} # switch off issues
|
cannot :manage, Issue, :project => {:has_issues => false} # switch off issues
|
||||||
|
|
||||||
can [:read, :commits, :files], PullRequest, :to_project => {:owner_type => 'User', :owner_id => user.id}
|
can [:read, :commits, :files], PullRequest, :to_project => {:owner_type => 'User', :owner_id => user.id}
|
||||||
can [:read, :commits, :files], PullRequest, :to_project => {:owner_type => 'Group', :owner_id => user.group_ids}
|
can [:read, :commits, :files], PullRequest, :to_project => {:owner_type => 'Group', :owner_id => user_group_ids}
|
||||||
can([:read, :commits, :files], PullRequest, read_relations_for('pull_requests', 'to_projects')) {|pull| can? :read, pull.to_project}
|
can([:read, :commits, :files], PullRequest, read_relations_for('pull_requests', 'to_projects')) {|pull| can? :read, pull.to_project}
|
||||||
can :create, PullRequest
|
can :create, PullRequest
|
||||||
can(:update, PullRequest) {|pull| pull.user_id == user.id or local_admin?(pull.to_project)}
|
can(:update, PullRequest) {|pull| pull.user_id == user.id or local_admin?(pull.to_project)}
|
||||||
|
@ -230,7 +230,7 @@ class Ability
|
||||||
["#{table}.#{key} IN (
|
["#{table}.#{key} IN (
|
||||||
SELECT target_id FROM relations WHERE relations.target_type = ? AND
|
SELECT target_id FROM relations WHERE relations.target_type = ? AND
|
||||||
(relations.actor_type = 'User' AND relations.actor_id = ? OR
|
(relations.actor_type = 'User' AND relations.actor_id = ? OR
|
||||||
relations.actor_type = 'Group' AND relations.actor_id IN (?)))", parent.classify, @user, @user.group_ids]
|
relations.actor_type = 'Group' AND relations.actor_id IN (?)))", parent.classify, @user, user_group_ids]
|
||||||
end
|
end
|
||||||
|
|
||||||
def local_reader?(target)
|
def local_reader?(target)
|
||||||
|
@ -246,6 +246,15 @@ class Ability
|
||||||
end
|
end
|
||||||
|
|
||||||
def owner?(target)
|
def owner?(target)
|
||||||
target.owner == @user or @user.own_groups.include?(target.owner)
|
target.owner == @user or user_own_groups.include?(target.owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_own_groups
|
||||||
|
@user_own_groups ||= @user.own_groups
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_group_ids
|
||||||
|
@user_group_ids ||= @user.group_ids
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -157,6 +157,11 @@ class BuildList < ActiveRecord::Base
|
||||||
after_transition :on => :published,
|
after_transition :on => :published,
|
||||||
:do => [:set_version_and_tag, :actualize_packages]
|
:do => [:set_version_and_tag, :actualize_packages]
|
||||||
after_transition :on => :publish, :do => :set_publisher
|
after_transition :on => :publish, :do => :set_publisher
|
||||||
|
after_transition(:on => :publish) do |build_list, transition|
|
||||||
|
if transition.from == BUILD_PUBLISHED_INTO_TESTING
|
||||||
|
build_list.cleanup_packages_from_testing
|
||||||
|
end
|
||||||
|
end
|
||||||
after_transition :on => :cancel, :do => :cancel_job
|
after_transition :on => :cancel, :do => :cancel_job
|
||||||
|
|
||||||
after_transition :on => [:published, :fail_publish, :build_error, :tests_failed], :do => :notify_users
|
after_transition :on => [:published, :fail_publish, :build_error, :tests_failed], :do => :notify_users
|
||||||
|
@ -307,6 +312,27 @@ class BuildList < ActiveRecord::Base
|
||||||
[SUCCESS, BUILD_PUBLISH, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED, BUILD_PUBLISHED_INTO_TESTING, FAILED_PUBLISH_INTO_TESTING].include?(status) && [WAITING_FOR_RESPONSE, FAILED_PUBLISH].include?(container_status)
|
[SUCCESS, BUILD_PUBLISH, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED, BUILD_PUBLISHED_INTO_TESTING, FAILED_PUBLISH_INTO_TESTING].include?(status) && [WAITING_FOR_RESPONSE, FAILED_PUBLISH].include?(container_status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_publish_into_repository?
|
||||||
|
return true if !save_to_repository.synchronizing_publications? || save_to_platform.personal? || project.architecture_dependent?
|
||||||
|
arch_ids = save_to_platform.platform_arch_settings.by_default.pluck(:arch_id)
|
||||||
|
BuildList.where(
|
||||||
|
:project_id => project_id,
|
||||||
|
:save_to_repository_id => save_to_repository_id,
|
||||||
|
:arch_id => arch_ids,
|
||||||
|
:commit_hash => commit_hash,
|
||||||
|
:status => [
|
||||||
|
SUCCESS,
|
||||||
|
BUILD_PUBLISHED,
|
||||||
|
BUILD_PUBLISH,
|
||||||
|
FAILED_PUBLISH,
|
||||||
|
TESTS_FAILED,
|
||||||
|
BUILD_PUBLISHED_INTO_TESTING,
|
||||||
|
BUILD_PUBLISH_INTO_TESTING,
|
||||||
|
FAILED_PUBLISH_INTO_TESTING
|
||||||
|
]
|
||||||
|
).group(:arch_id).count == arch_ids.size
|
||||||
|
end
|
||||||
|
|
||||||
#TODO: Share this checking on product owner.
|
#TODO: Share this checking on product owner.
|
||||||
def can_cancel?
|
def can_cancel?
|
||||||
build_started? || build_pending?
|
build_started? || build_pending?
|
||||||
|
@ -333,7 +359,7 @@ class BuildList < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_auto_publish?
|
def can_auto_publish?
|
||||||
auto_publish? && can_publish? && has_new_packages?
|
auto_publish? && can_publish? && has_new_packages? && can_publish_into_repository?
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_publish?
|
def can_publish?
|
||||||
|
@ -356,7 +382,8 @@ class BuildList < ActiveRecord::Base
|
||||||
|
|
||||||
def average_build_time
|
def average_build_time
|
||||||
return 0 unless project
|
return 0 unless project
|
||||||
project.project_statistics.where(:arch_id => arch_id).pluck(:average_build_time).first || 0
|
@average_build_time ||= project.project_statistics.
|
||||||
|
find{ |ps| ps.arch_id == arch_id }.try(:average_build_time) || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.human_status(status)
|
def self.human_status(status)
|
||||||
|
@ -487,6 +514,14 @@ class BuildList < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cleanup_packages_from_testing
|
||||||
|
AbfWorker::BuildListsPublishTaskManager.cleanup_packages_from_testing(
|
||||||
|
build_for_platform_id,
|
||||||
|
save_to_repository_id,
|
||||||
|
id
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def create_container
|
def create_container
|
||||||
|
|
|
@ -44,9 +44,11 @@ class MassBuild < ActiveRecord::Base
|
||||||
if project = Project.joins(:repositories).where('repositories.id in (?)', save_to_platform.repository_ids).find_by_name(name)
|
if project = Project.joins(:repositories).where('repositories.id in (?)', save_to_platform.repository_ids).find_by_name(name)
|
||||||
begin
|
begin
|
||||||
return if self.reload.stop_build
|
return if self.reload.stop_build
|
||||||
|
increase_rt = increase_release_tag?
|
||||||
arches_list.each do |arch|
|
arches_list.each do |arch|
|
||||||
rep_id = (project.repository_ids & save_to_platform.repository_ids).first
|
rep_id = (project.repository_ids & save_to_platform.repository_ids).first
|
||||||
project.build_for self, rep_id, arch
|
project.build_for self, rep_id, arch, 0, increase_rt
|
||||||
|
increase_rt = false
|
||||||
end
|
end
|
||||||
rescue RuntimeError, Exception
|
rescue RuntimeError, Exception
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Project < ActiveRecord::Base
|
||||||
|
|
||||||
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch,
|
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch,
|
||||||
:has_issues, :has_wiki, :maintainer_id, :publish_i686_into_x86_64,
|
:has_issues, :has_wiki, :maintainer_id, :publish_i686_into_x86_64,
|
||||||
:url, :srpms_list, :mass_import, :add_to_repository_id
|
:url, :srpms_list, :mass_import, :add_to_repository_id, :architecture_dependent
|
||||||
attr_readonly :owner_id, :owner_type
|
attr_readonly :owner_id, :owner_type
|
||||||
|
|
||||||
scope :recent, order("lower(#{table_name}.name) ASC")
|
scope :recent, order("lower(#{table_name}.name) ASC")
|
||||||
|
@ -161,7 +161,7 @@ class Project < ActiveRecord::Base
|
||||||
#path #share by NFS
|
#path #share by NFS
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_for(mass_build, repository_id, arch = Arch.find_by_name('i586'), priority = 0)
|
def build_for(mass_build, repository_id, arch = Arch.find_by_name('i586'), priority = 0, increase_rt = false)
|
||||||
build_for_platform = mass_build.build_for_platform
|
build_for_platform = mass_build.build_for_platform
|
||||||
save_to_platform = mass_build.save_to_platform
|
save_to_platform = mass_build.save_to_platform
|
||||||
user = mass_build.user
|
user = mass_build.user
|
||||||
|
@ -179,7 +179,7 @@ class Project < ActiveRecord::Base
|
||||||
default_branch
|
default_branch
|
||||||
end
|
end
|
||||||
|
|
||||||
increase_release_tag(project_version, user, "MassBuild##{mass_build.id}: Increase release tag") if mass_build.increase_release_tag?
|
increase_release_tag(project_version, user, "MassBuild##{mass_build.id}: Increase release tag") if increase_rt
|
||||||
|
|
||||||
build_list = build_lists.build do |bl|
|
build_list = build_lists.build do |bl|
|
||||||
bl.save_to_platform = save_to_platform
|
bl.save_to_platform = save_to_platform
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Repository < ActiveRecord::Base
|
||||||
|
|
||||||
before_destroy :detele_directory
|
before_destroy :detele_directory
|
||||||
|
|
||||||
attr_accessible :name, :description, :publish_without_qa
|
attr_accessible :name, :description, :publish_without_qa, :synchronizing_publications
|
||||||
attr_readonly :name, :platform_id
|
attr_readonly :name, :platform_id
|
||||||
attr_accessor :projects_list
|
attr_accessor :projects_list
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
|
|
||||||
.leftlist= f.label :publish_without_qa, t("activerecord.attributes.repository.publish_without_qa"), :class => :label
|
.leftlist= f.label :publish_without_qa, t("activerecord.attributes.repository.publish_without_qa"), :class => :label
|
||||||
.rightlist= f.check_box :publish_without_qa, :class => 'check_box'
|
.rightlist= f.check_box :publish_without_qa, :class => 'check_box'
|
||||||
|
|
||||||
|
.leftlist= f.label :synchronizing_publications
|
||||||
|
.rightlist= f.check_box :synchronizing_publications
|
||||||
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
.hr
|
.hr
|
||||||
|
|
|
@ -160,6 +160,10 @@
|
||||||
.flash_notify
|
.flash_notify
|
||||||
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
|
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
|
||||||
.both
|
.both
|
||||||
|
%div{'ng-show' => 'build_list.can_publish && build_list.can_publish_in_future && !build_list.can_publish_into_repository'}
|
||||||
|
.flash_notify
|
||||||
|
.alert.alert-error= t('flash.build_list.not_all_build_lists_success')
|
||||||
|
.both
|
||||||
|
|
||||||
- if can?(:cancel, @build_list)
|
- if can?(:cancel, @build_list)
|
||||||
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
|
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
|
||||||
|
|
|
@ -18,6 +18,7 @@ json.build_list do
|
||||||
|
|
||||||
json.extra_build_lists_published @build_list.extra_build_lists_published?
|
json.extra_build_lists_published @build_list.extra_build_lists_published?
|
||||||
json.can_publish_in_future can_publish_in_future?(@build_list)
|
json.can_publish_in_future can_publish_in_future?(@build_list)
|
||||||
|
json.can_publish_into_repository @build_list.can_publish_into_repository?
|
||||||
|
|
||||||
|
|
||||||
json.container_path container_url if @build_list.container_published?
|
json.container_path container_url if @build_list.container_published?
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
.check= f.check_box :is_package, 'ng-model' => 'project.is_package', 'ng-change' => 'project.publish_i686_into_x86_64 = false'
|
.check= f.check_box :is_package, 'ng-model' => 'project.is_package', 'ng-change' => 'project.publish_i686_into_x86_64 = false'
|
||||||
.forcheck= f.label :is_package
|
.forcheck= f.label :is_package
|
||||||
.both
|
.both
|
||||||
|
%div{'ng-show' => 'project.is_package'}
|
||||||
|
.check= f.check_box :architecture_dependent, 'ng-model' => 'project.architecture_dependent'
|
||||||
|
.forcheck= f.label :architecture_dependent
|
||||||
|
.both
|
||||||
- unless [:new, :create].include? act
|
- unless [:new, :create].include? act
|
||||||
#publish_form{'ng-show' => 'project.is_package'}
|
#publish_form{'ng-show' => 'project.is_package'}
|
||||||
.check= f.check_box :publish_i686_into_x86_64, 'ng-model' => 'project.publish_i686_into_x86_64'
|
.check= f.check_box :publish_i686_into_x86_64, 'ng-model' => 'project.publish_i686_into_x86_64'
|
||||||
|
|
|
@ -193,4 +193,5 @@ en:
|
||||||
can_not_published: Build can only be published with status "Build complete"
|
can_not_published: Build can only be published with status "Build complete"
|
||||||
frozen_platform: In case of a repository for package storage with frozen platform allowed only bugfix and security updates
|
frozen_platform: In case of a repository for package storage with frozen platform allowed only bugfix and security updates
|
||||||
wrong_include_repos: Include repos have to belongs to build for platform
|
wrong_include_repos: Include repos have to belongs to build for platform
|
||||||
wrong_commit_hash: Unable find commit '%{commit_hash}' in project
|
wrong_commit_hash: "Unable find commit '%{commit_hash}' in project"
|
||||||
|
not_all_build_lists_success: 'Project has been builded successfully not for all default arches'
|
||||||
|
|
|
@ -180,10 +180,10 @@ ru:
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
build_list:
|
build_list:
|
||||||
saved: Билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}' создан успешно
|
saved: "Билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}' создан успешно"
|
||||||
save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}'
|
save_error: "Не удалось сохранить билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}'"
|
||||||
no_project_version_selected: Выберите какую-нибудь версию
|
no_project_version_selected: Выберите какую-нибудь версию
|
||||||
no_project_version_found: Выбранная версия '%{project_version}' не найдена
|
no_project_version_found: "Выбранная версия '%{project_version}' не найдена"
|
||||||
no_arch_or_platform_selected: Выберите хотя бы одну архитектуру и платформу
|
no_arch_or_platform_selected: Выберите хотя бы одну архитектуру и платформу
|
||||||
wrong_platform: Для основного репозитория (main) может быть выбран только его же основная платформа!
|
wrong_platform: Для основного репозитория (main) может быть выбран только его же основная платформа!
|
||||||
wrong_build_for_platform: Тип платформы "build_for_platform" должен быть "main"
|
wrong_build_for_platform: Тип платформы "build_for_platform" должен быть "main"
|
||||||
|
@ -193,4 +193,5 @@ ru:
|
||||||
can_not_published: Опубликовать сборку можно только со статусом "Собран"
|
can_not_published: Опубликовать сборку можно только со статусом "Собран"
|
||||||
frozen_platform: В случае выбора репозитория для сохранения пакетов из замороженнной платформы разрешены только bugfix и security обновления
|
frozen_platform: В случае выбора репозитория для сохранения пакетов из замороженнной платформы разрешены только bugfix и security обновления
|
||||||
wrong_include_repos: Включаемые репозитории должны принадлежать платформе для сборки
|
wrong_include_repos: Включаемые репозитории должны принадлежать платформе для сборки
|
||||||
wrong_commit_hash: Невозможно найти коммит '%{commit_hash}' в проекте
|
wrong_commit_hash: "Невозможно найти коммит '%{commit_hash}' в проекте"
|
||||||
|
not_all_build_lists_success: Проект собран успешно не для всех дефолтных архитектур
|
||||||
|
|
|
@ -116,6 +116,7 @@ en:
|
||||||
publish_i686_into_x86_64: Publish i686 packages into x86_64 repository (only for rhel)
|
publish_i686_into_x86_64: Publish i686 packages into x86_64 repository (only for rhel)
|
||||||
maintainer: Maintainer of project
|
maintainer: Maintainer of project
|
||||||
maintainer_id: Maintainer of project
|
maintainer_id: Maintainer of project
|
||||||
|
architecture_dependent: Architecture-dependent
|
||||||
errors:
|
errors:
|
||||||
project:
|
project:
|
||||||
uname: The name can only use lower case Latin letters (a-z), numbers (0-9) and underscore (_)
|
uname: The name can only use lower case Latin letters (a-z), numbers (0-9) and underscore (_)
|
||||||
|
|
|
@ -116,6 +116,7 @@ ru:
|
||||||
publish_i686_into_x86_64: Публиковать i686 пакеты в x86_64 репозиторий (только для rhel)
|
publish_i686_into_x86_64: Публиковать i686 пакеты в x86_64 репозиторий (только для rhel)
|
||||||
maintainer_id: Майнтейнер проекта
|
maintainer_id: Майнтейнер проекта
|
||||||
maintainer: Майнтейнер проекта
|
maintainer: Майнтейнер проекта
|
||||||
|
architecture_dependent: Архитектурно-зависимый
|
||||||
errors:
|
errors:
|
||||||
project:
|
project:
|
||||||
uname: В имени можно использовать только строчные символы латинского алфавита (a-z), цифры (0-9) и символ нижнего подчеркивания (_)
|
uname: В имени можно использовать только строчные символы латинского алфавита (a-z), цифры (0-9) и символ нижнего подчеркивания (_)
|
||||||
|
|
|
@ -70,3 +70,4 @@ en:
|
||||||
created_at: Created
|
created_at: Created
|
||||||
updated_at: Updated
|
updated_at: Updated
|
||||||
owner: Owner
|
owner: Owner
|
||||||
|
synchronizing_publications: Publish only on success all build_lists for each arch (checking by commit hash)
|
||||||
|
|
|
@ -70,3 +70,4 @@ ru:
|
||||||
created_at: Создан
|
created_at: Создан
|
||||||
updated_at: Обновлен
|
updated_at: Обновлен
|
||||||
owner: Владелец
|
owner: Владелец
|
||||||
|
synchronizing_publications: Публиковать сборочные листы только при успешной сборке под каждую архитектуру (проверка по хэшу коммита)
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddSynchronizePublicationToRepository < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :repositories, :synchronizing_publications, :boolean, :default => false, :null => false
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddArchitectureDependentToProject < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :projects, :architecture_dependent, :boolean, :default => false, :null => false
|
||||||
|
end
|
||||||
|
end
|
12
db/schema.rb
12
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20131126154305) do
|
ActiveRecord::Schema.define(:version => 20140113215223) do
|
||||||
|
|
||||||
create_table "activity_feeds", :force => true do |t|
|
create_table "activity_feeds", :force => true do |t|
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
|
@ -439,6 +439,7 @@ ActiveRecord::Schema.define(:version => 20131126154305) do
|
||||||
t.integer "maintainer_id"
|
t.integer "maintainer_id"
|
||||||
t.boolean "publish_i686_into_x86_64", :default => false
|
t.boolean "publish_i686_into_x86_64", :default => false
|
||||||
t.string "owner_uname", :null => false
|
t.string "owner_uname", :null => false
|
||||||
|
t.boolean "architecture_dependent", :default => false, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["owner_id", "name", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
add_index "projects", ["owner_id", "name", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
||||||
|
@ -487,12 +488,13 @@ ActiveRecord::Schema.define(:version => 20131126154305) do
|
||||||
add_index "relations", ["target_type", "target_id"], :name => "index_relations_on_target_type_and_target_id"
|
add_index "relations", ["target_type", "target_id"], :name => "index_relations_on_target_type_and_target_id"
|
||||||
|
|
||||||
create_table "repositories", :force => true do |t|
|
create_table "repositories", :force => true do |t|
|
||||||
t.string "description", :null => false
|
t.string "description", :null => false
|
||||||
t.integer "platform_id", :null => false
|
t.integer "platform_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.boolean "publish_without_qa", :default => true
|
t.boolean "publish_without_qa", :default => true
|
||||||
|
t.boolean "synchronizing_publications", :default => false, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "repositories", ["platform_id"], :name => "index_repositories_on_platform_id"
|
add_index "repositories", ["platform_id"], :name => "index_repositories_on_platform_id"
|
||||||
|
|
|
@ -5,7 +5,9 @@ module AbfWorker
|
||||||
%w(PROJECTS_FOR_CLEANUP
|
%w(PROJECTS_FOR_CLEANUP
|
||||||
LOCKED_PROJECTS_FOR_CLEANUP
|
LOCKED_PROJECTS_FOR_CLEANUP
|
||||||
LOCKED_BUILD_LISTS
|
LOCKED_BUILD_LISTS
|
||||||
PACKAGES_FOR_CLEANUP).each do |kind|
|
PACKAGES_FOR_CLEANUP
|
||||||
|
REP_AND_PLS_OF_BUILD_LISTS_FOR_CLEANUP_FROM_TESTING
|
||||||
|
BUILD_LISTS_FOR_CLEANUP_FROM_TESTING).each do |kind|
|
||||||
const_set kind, "#{REDIS_MAIN_KEY}#{kind.downcase.gsub('_', '-')}"
|
const_set kind, "#{REDIS_MAIN_KEY}#{kind.downcase.gsub('_', '-')}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,6 +59,14 @@ module AbfWorker
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cleanup_packages_from_testing(platform_id, repository_id, *build_lists)
|
||||||
|
return if build_lists.blank?
|
||||||
|
rep_pl = "#{repository_id}-#{platform_id}"
|
||||||
|
key = "#{BUILD_LISTS_FOR_CLEANUP_FROM_TESTING}-#{rep_pl}"
|
||||||
|
redis.sadd REP_AND_PLS_OF_BUILD_LISTS_FOR_CLEANUP_FROM_TESTING, rep_pl
|
||||||
|
redis.sadd key, build_lists
|
||||||
|
end
|
||||||
|
|
||||||
def unlock_build_list(build_list)
|
def unlock_build_list(build_list)
|
||||||
redis.lrem LOCKED_BUILD_LISTS, 0, build_list.id
|
redis.lrem LOCKED_BUILD_LISTS, 0, build_list.id
|
||||||
end
|
end
|
||||||
|
@ -212,8 +222,15 @@ module AbfWorker
|
||||||
locked_rep.present? && locked_rep.include?(rep.to_i) ? nil : [rep.to_i, pl.to_i]
|
locked_rep.present? && locked_rep.include?(rep.to_i) ? nil : [rep.to_i, pl.to_i]
|
||||||
end.compact
|
end.compact
|
||||||
|
|
||||||
|
for_cleanup_from_testing = @redis.smembers(REP_AND_PLS_OF_BUILD_LISTS_FOR_CLEANUP_FROM_TESTING).map do |key|
|
||||||
|
next if @redis.scard("#{BUILD_LISTS_FOR_CLEANUP_FROM_TESTING}-#{key}") == 0
|
||||||
|
rep, pl = *key.split('-')
|
||||||
|
locked_rep.present? && locked_rep.include?(rep.to_i) ? nil : [rep.to_i, pl.to_i]
|
||||||
|
end.compact if testing
|
||||||
|
for_cleanup_from_testing ||= []
|
||||||
|
|
||||||
counter = 1
|
counter = 1
|
||||||
available_repos = available_repos.map{ |bl| [bl.save_to_repository_id, bl.build_for_platform_id] } | for_cleanup
|
available_repos = available_repos.map{ |bl| [bl.save_to_repository_id, bl.build_for_platform_id] } | for_cleanup | for_cleanup_from_testing
|
||||||
available_repos.each do |save_to_repository_id, build_for_platform_id|
|
available_repos.each do |save_to_repository_id, build_for_platform_id|
|
||||||
next if RepositoryStatus.not_ready.where(:repository_id => save_to_repository_id, :platform_id => build_for_platform_id).exists?
|
next if RepositoryStatus.not_ready.where(:repository_id => save_to_repository_id, :platform_id => build_for_platform_id).exists?
|
||||||
break if counter > @workers_count
|
break if counter > @workers_count
|
||||||
|
@ -253,12 +270,20 @@ module AbfWorker
|
||||||
packages = JSON.parse packages
|
packages = JSON.parse packages
|
||||||
old_packages[:sources] |= packages['sources']
|
old_packages[:sources] |= packages['sources']
|
||||||
Arch.pluck(:name).each do |arch|
|
Arch.pluck(:name).each do |arch|
|
||||||
old_packages[:binaries][arch.to_sym] |= packages['binaries'][arch]
|
old_packages[:binaries][arch.to_sym] |= packages['binaries'][arch] || []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if testing
|
||||||
|
build_lists_for_cleanup_from_testing = @redis.smembers("#{BUILD_LISTS_FOR_CLEANUP_FROM_TESTING}-#{save_to_repository_id}-#{build_for_platform_id}")
|
||||||
|
BuildList.where(:id => build_lists_for_cleanup_from_testing).each do |b|
|
||||||
|
self.class.fill_packages(b, old_packages, :fullname)
|
||||||
|
end if build_lists_for_cleanup_from_testing.present?
|
||||||
|
end
|
||||||
|
build_lists_for_cleanup_from_testing ||= []
|
||||||
|
|
||||||
bl = build_lists.first
|
bl = build_lists.first
|
||||||
return false if !bl && old_packages[:sources].empty?
|
return false if !bl && old_packages[:sources].empty? && old_packages[:binaries].values.flatten.empty?
|
||||||
|
|
||||||
save_to_repository = Repository.find save_to_repository_id
|
save_to_repository = Repository.find save_to_repository_id
|
||||||
# Checks mirror sync status
|
# Checks mirror sync status
|
||||||
|
@ -300,7 +325,10 @@ module AbfWorker
|
||||||
},
|
},
|
||||||
:repository => {:id => save_to_repository_id},
|
:repository => {:id => save_to_repository_id},
|
||||||
:time_living => 9600, # 160 min
|
:time_living => 9600, # 160 min
|
||||||
:extra => {:repository_status_id => repository_status.id}
|
:extra => {
|
||||||
|
:repository_status_id => repository_status.id,
|
||||||
|
:build_lists_for_cleanup_from_testing => build_lists_for_cleanup_from_testing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packages, build_list_ids, new_sources = self.class.packages_structure, [], {}
|
packages, build_list_ids, new_sources = self.class.packages_structure, [], {}
|
||||||
|
@ -336,6 +364,15 @@ module AbfWorker
|
||||||
@redis.lpush LOCKED_PROJECTS_FOR_CLEANUP, key
|
@redis.lpush LOCKED_PROJECTS_FOR_CLEANUP, key
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rep_pl = "#{save_to_repository_id}-#{build_for_platform_id}"
|
||||||
|
r_key = "#{BUILD_LISTS_FOR_CLEANUP_FROM_TESTING}-#{rep_pl}"
|
||||||
|
build_lists_for_cleanup_from_testing.each do |key|
|
||||||
|
@redis.srem r_key, key
|
||||||
|
end
|
||||||
|
if @redis.scard(r_key) == 0
|
||||||
|
@redis.srem REP_AND_PLS_OF_BUILD_LISTS_FOR_CLEANUP_FROM_TESTING, rep_pl
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,14 @@ module AbfWorker
|
||||||
end
|
end
|
||||||
update_results
|
update_results
|
||||||
elsif !extra['resign'] # Simple publish
|
elsif !extra['resign'] # Simple publish
|
||||||
|
bls = extra['build_lists_for_cleanup_from_testing']
|
||||||
|
if status != COMPLETED && bls.present?
|
||||||
|
AbfWorker::BuildListsPublishTaskManager.cleanup_packages_from_testing(
|
||||||
|
repository_status.platform_id,
|
||||||
|
repository_status.repository_id,
|
||||||
|
bls
|
||||||
|
)
|
||||||
|
end
|
||||||
update_rpm_builds
|
update_rpm_builds
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
|
Loading…
Reference in New Issue