Merge branch 'master' into 369-bootstrap
Conflicts: app/views/projects/build_lists/show.html.haml app/views/projects/build_lists/show.json.jbuilder
This commit is contained in:
commit
4ba6506450
|
@ -22,7 +22,7 @@ class Platforms::RepositoriesController < Platforms::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @repository.update_attributes params[:repository].slice(:description, :synchronizing_publications, :forbid_to_publish_builds_not_from).merge(publish_without_qa: (params[:repository][:publish_without_qa] || @repository.publish_without_qa))
|
if @repository.update_attributes params[:repository].slice(:description, :synchronizing_publications, :publish_builds_only_from_branch).merge(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
|
||||||
|
|
|
@ -187,7 +187,7 @@ class Ability
|
||||||
cannot(:cancel, MassBuild) {|mass_build| mass_build.stop_build}
|
cannot(:cancel, MassBuild) {|mass_build| mass_build.stop_build}
|
||||||
|
|
||||||
if @user.system?
|
if @user.system?
|
||||||
can :key_pair, Repository
|
can %i(key_pair add_repo_lock_file remove_repo_lock_file), Repository
|
||||||
else
|
else
|
||||||
cannot :key_pair, Repository
|
cannot :key_pair, Repository
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Advisory < ActiveRecord::Base
|
||||||
after_create :generate_advisory_id
|
after_create :generate_advisory_id
|
||||||
before_save :normalize_references, if: :references_changed?
|
before_save :normalize_references, if: :references_changed?
|
||||||
|
|
||||||
attr_accessible :description
|
attr_accessible :description, :references
|
||||||
|
|
||||||
ID_TEMPLATE = 'ROSA-%<type>s-%<year>d:%<id>04d'
|
ID_TEMPLATE = 'ROSA-%<type>s-%<year>d:%<id>04d'
|
||||||
ID_STRING_TEMPLATE = 'ROSA-%<type>s-%<year>04s:%<id>04s'
|
ID_STRING_TEMPLATE = 'ROSA-%<type>s-%<year>04s:%<id>04s'
|
||||||
|
|
|
@ -598,7 +598,7 @@ class BuildList < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def delayed_add_job_to_abf_worker_queue(*args)
|
def delayed_add_job_to_abf_worker_queue(*args)
|
||||||
restart_job if status == BUILD_PENDING
|
restart_job if valid? && status == BUILD_PENDING
|
||||||
end
|
end
|
||||||
later :delayed_add_job_to_abf_worker_queue, delay: 60, queue: :middle
|
later :delayed_add_job_to_abf_worker_queue, delay: 60, queue: :middle
|
||||||
|
|
||||||
|
@ -606,12 +606,12 @@ class BuildList < ActiveRecord::Base
|
||||||
|
|
||||||
def valid_branch_for_publish?
|
def valid_branch_for_publish?
|
||||||
return true if save_to_platform.personal? ||
|
return true if save_to_platform.personal? ||
|
||||||
save_to_repository.forbid_to_publish_builds_not_from.blank? ||
|
save_to_repository.publish_builds_only_from_branch.blank? ||
|
||||||
( project_version == save_to_repository.forbid_to_publish_builds_not_from )
|
( project_version == save_to_repository.publish_builds_only_from_branch )
|
||||||
|
|
||||||
project.repo.git.native(:branch, {}, '--contains', commit_hash).
|
project.repo.git.native(:branch, {}, '--contains', commit_hash).
|
||||||
gsub(/\*/, '').split(/\n/).map(&:strip).
|
gsub(/\*/, '').split(/\n/).map(&:strip).
|
||||||
include?(save_to_repository.forbid_to_publish_builds_not_from)
|
include?(save_to_repository.publish_builds_only_from_branch)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
class BuildList::Package < ActiveRecord::Base
|
class BuildList::Package < ActiveRecord::Base
|
||||||
PACKAGE_TYPES = %w(source binary)
|
PACKAGE_TYPES = %w(source binary)
|
||||||
|
|
||||||
belongs_to :build_list
|
belongs_to :build_list, touch: true
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
belongs_to :platform
|
belongs_to :platform
|
||||||
|
|
||||||
attr_accessible :fullname, :name, :release, :version, :sha1, :epoch
|
serialize :dependent_packages, Array
|
||||||
|
serialize :dependent_projects, Array
|
||||||
|
|
||||||
|
attr_accessible :fullname, :name, :release, :version, :sha1, :epoch, :dependent_packages
|
||||||
|
|
||||||
validates :build_list_id, :project_id, :platform_id, :fullname,
|
validates :build_list_id, :project_id, :platform_id, :fullname,
|
||||||
:package_type, :name, :release, :version,
|
:package_type, :name, :release, :version,
|
||||||
|
@ -23,6 +26,8 @@ class BuildList::Package < ActiveRecord::Base
|
||||||
scope :like_name, ->(name) { where("#{table_name}.name ILIKE ?", "%#{name}%") if name.present? }
|
scope :like_name, ->(name) { where("#{table_name}.name ILIKE ?", "%#{name}%") if name.present? }
|
||||||
|
|
||||||
before_create :set_epoch
|
before_create :set_epoch
|
||||||
|
before_create :normalize_dependent_packages
|
||||||
|
after_commit(on: :create) { |p| p.find_dependent_projects if p.dependent_packages.present? } # later with resque
|
||||||
|
|
||||||
def assignee
|
def assignee
|
||||||
project.maintainer
|
project.maintainer
|
||||||
|
@ -45,8 +50,17 @@ class BuildList::Package < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_dependent_projects
|
||||||
|
# TODO
|
||||||
|
end
|
||||||
|
later :find_dependent_projects, queue: :middle
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def normalize_dependent_packages
|
||||||
|
self.dependent_packages = dependent_packages.to_s.split(/\s/).select(&:present?)
|
||||||
|
end
|
||||||
|
|
||||||
def set_epoch
|
def set_epoch
|
||||||
self.epoch = nil if epoch.blank? || epoch == 0
|
self.epoch = nil if epoch.blank? || epoch == 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Repository < ActiveRecord::Base
|
||||||
validates :description, presence: true
|
validates :description, presence: true
|
||||||
validates :name, uniqueness: { scope: :platform_id, case_sensitive: false }, presence: true,
|
validates :name, uniqueness: { scope: :platform_id, case_sensitive: false }, presence: true,
|
||||||
format: { with: /\A[a-z0-9_\-]+\z/ }
|
format: { with: /\A[a-z0-9_\-]+\z/ }
|
||||||
validates :forbid_to_publish_builds_not_from, length: { maximum: 255 }
|
validates :publish_builds_only_from_branch, length: { maximum: 255 }
|
||||||
|
|
||||||
scope :recent, -> { order(:name) }
|
scope :recent, -> { order(:name) }
|
||||||
scope :main, -> { where(name: %w(main base)) }
|
scope :main, -> { where(name: %w(main base)) }
|
||||||
|
@ -34,7 +34,7 @@ class Repository < ActiveRecord::Base
|
||||||
:description,
|
:description,
|
||||||
:publish_without_qa,
|
:publish_without_qa,
|
||||||
:synchronizing_publications,
|
:synchronizing_publications,
|
||||||
:forbid_to_publish_builds_not_from
|
:publish_builds_only_from_branch
|
||||||
|
|
||||||
attr_readonly :name, :platform_id
|
attr_readonly :name, :platform_id
|
||||||
attr_accessor :projects_list
|
attr_accessor :projects_list
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
- if @platform.main?
|
- if @platform.main?
|
||||||
.both
|
.both
|
||||||
.leftlist= f.label :forbid_to_publish_builds_not_from
|
.leftlist= f.label :publish_builds_only_from_branch
|
||||||
.rightlist= f.text_field :forbid_to_publish_builds_not_from
|
.rightlist= f.text_field :publish_builds_only_from_branch
|
||||||
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@
|
||||||
method: :put, data: { confirm: t('layout.confirm') },
|
method: :put, data: { confirm: t('layout.confirm') },
|
||||||
class: 'btn btn-primary',
|
class: 'btn btn-primary',
|
||||||
'ng-show' => 'build_list.can_reject_publish'
|
'ng-show' => 'build_list.can_reject_publish'
|
||||||
- if can?(:rerun_tests, @build_list) && (current_user.tester? || current_user.admin?)
|
- if can?(:rerun_tests, @build_list)
|
||||||
= link_to t('layout.build_lists.rerun_tests'),
|
= link_to t('layout.build_lists.rerun_tests'),
|
||||||
rerun_tests_build_list_path(@build_list),
|
rerun_tests_build_list_path(@build_list),
|
||||||
method: :put,
|
method: :put,
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
json.build_list do
|
json.build_list do
|
||||||
json.(@build_list, :id, :container_status, :status)
|
|
||||||
json.(@build_list, :update_type)
|
|
||||||
json.updated_at @build_list.updated_at
|
|
||||||
|
|
||||||
if !@build_list.in_work? && @build_list.started_at
|
if !@build_list.in_work? && @build_list.started_at
|
||||||
json.human_duration @build_list.human_duration
|
json.human_duration @build_list.human_duration
|
||||||
elsif @build_list.in_work?
|
elsif @build_list.in_work?
|
||||||
json.human_duration "#{@build_list.human_current_duration} / #{@build_list.human_average_build_time}"
|
json.human_duration "#{@build_list.human_current_duration} / #{@build_list.human_average_build_time}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
json.cache! [@build_list, current_user], expires_in: 1.minute do
|
||||||
|
json.(@build_list, :id, :container_status, :status)
|
||||||
|
json.(@build_list, :update_type)
|
||||||
|
json.updated_at @build_list.updated_at
|
||||||
|
json.updated_at_utc @build_list.updated_at.strftime('%Y-%m-%d %H:%M:%S UTC')
|
||||||
|
|
||||||
|
|
||||||
json.can_publish can?(:publish, @build_list)
|
json.can_publish can?(:publish, @build_list)
|
||||||
json.can_publish_into_testing can?(:publish_into_testing, @build_list) && @build_list.can_publish_into_testing?
|
json.can_publish_into_testing can?(:publish_into_testing, @build_list) && @build_list.can_publish_into_testing?
|
||||||
json.can_cancel @build_list.can_cancel?
|
json.can_cancel @build_list.can_cancel?
|
||||||
|
@ -50,6 +53,11 @@ json.build_list do
|
||||||
json.packages @build_list.packages do |package|
|
json.packages @build_list.packages do |package|
|
||||||
json.(package, :id, :name, :fullname, :release, :version, :sha1, :epoch)
|
json.(package, :id, :name, :fullname, :release, :version, :sha1, :epoch)
|
||||||
json.url "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}" if package.sha1
|
json.url "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}" if package.sha1
|
||||||
|
|
||||||
|
json.dependent_projects Project.where(id: package.dependent_projects).to_a do |project|
|
||||||
|
json.project_path project_path(project)
|
||||||
|
json.new_project_build_list_path new_project_build_list_path(@project)
|
||||||
|
end
|
||||||
end if @build_list.packages.present?
|
end if @build_list.packages.present?
|
||||||
|
|
||||||
json.item_groups do |group|
|
json.item_groups do |group|
|
||||||
|
@ -61,5 +69,6 @@ json.build_list do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end if @item_groups.present?
|
end if @item_groups.present?
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- if owner.own_projects.exists? name: name
|
- if owner.own_projects.exists? name: name
|
||||||
%p.center
|
%p.center
|
||||||
=t 'layout.projects.already_exists'
|
=t 'layout.projects.already_exists'
|
||||||
=link_to full_name, project_path(@project)
|
=link_to full_name, project_path("#{owner.uname}/#{name}")
|
||||||
- else
|
- else
|
||||||
= form_for @project, url: fork_project_path(@project), html: { class: :form, multipart: true, method: :post } do |f|
|
= form_for @project, url: fork_project_path(@project), html: { class: :form, multipart: true, method: :post } do |f|
|
||||||
= hidden_field_tag :group, owner.id if owner.class == Group
|
= hidden_field_tag :group, owner.id if owner.class == Group
|
||||||
|
|
|
@ -71,4 +71,4 @@ en:
|
||||||
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)
|
synchronizing_publications: Publish only on success all build_lists for each arch (checking by commit hash)
|
||||||
forbid_to_publish_builds_not_from: "Publish builds only from branch"
|
publish_builds_only_from_branch: "Publish builds only from branch"
|
||||||
|
|
|
@ -71,5 +71,5 @@ ru:
|
||||||
updated_at: Обновлен
|
updated_at: Обновлен
|
||||||
owner: Владелец
|
owner: Владелец
|
||||||
synchronizing_publications: Публиковать сборочные листы только при успешной сборке под каждую архитектуру (проверка по хэшу коммита)
|
synchronizing_publications: Публиковать сборочные листы только при успешной сборке под каждую архитектуру (проверка по хэшу коммита)
|
||||||
forbid_to_publish_builds_not_from: "Публикация сборок только из ветки"
|
publish_builds_only_from_branch: "Публикация сборок только из ветки"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
class RenameRepositoriesForbidToPublishBuildsNotFromToPublishBuildsOnlyFromBranch < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_table :repositories do |t|
|
||||||
|
t.rename :forbid_to_publish_builds_not_from, :publish_builds_only_from_branch
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddDependentPackagesAndDependentProjectsToBuildListPackages < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :build_list_packages, :dependent_packages, :text
|
||||||
|
add_column :build_list_packages, :dependent_projects, :text
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20140530193652) do
|
ActiveRecord::Schema.define(version: 20140606193047) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -95,6 +95,8 @@ ActiveRecord::Schema.define(version: 20140530193652) do
|
||||||
t.boolean "actual", default: false
|
t.boolean "actual", default: false
|
||||||
t.string "sha1"
|
t.string "sha1"
|
||||||
t.integer "epoch"
|
t.integer "epoch"
|
||||||
|
t.text "dependent_packages"
|
||||||
|
t.text "dependent_projects"
|
||||||
t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id"
|
t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id"
|
||||||
t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id"
|
t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id"
|
||||||
t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id"
|
t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id"
|
||||||
|
@ -529,7 +531,7 @@ ActiveRecord::Schema.define(version: 20140530193652) do
|
||||||
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
|
t.boolean "synchronizing_publications", default: false, null: false
|
||||||
t.string "forbid_to_publish_builds_not_from"
|
t.string "publish_builds_only_from_branch"
|
||||||
t.index ["platform_id"], :name => "index_repositories_on_platform_id"
|
t.index ["platform_id"], :name => "index_repositories_on_platform_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue