#757: send error when some containers for main platform have not been published
This commit is contained in:
parent
3e9c28e238
commit
38b6375ca3
|
@ -33,7 +33,11 @@ class Api::V1::BuildListsController < Api::V1::BaseController
|
|||
end
|
||||
|
||||
def publish
|
||||
render_json :publish
|
||||
if @build_list.can_publish_to_repository?
|
||||
render_json :publish
|
||||
else
|
||||
render_validation_error @build_list, t('layout.build_lists.publish_with_extra_fail')
|
||||
end
|
||||
end
|
||||
|
||||
def reject_publish
|
||||
|
|
|
@ -173,8 +173,12 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
end
|
||||
|
||||
if @build_list.save and @build_list.now_publish
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_success')
|
||||
if @build_list.save && @build_list.can_publish?
|
||||
if @build_list.can_publish_to_repository? && @build_list.now_publish
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_success')
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_with_extra_fail')
|
||||
end
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail')
|
||||
end
|
||||
|
|
|
@ -287,6 +287,11 @@ class BuildList < ActiveRecord::Base
|
|||
[SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED].include? status
|
||||
end
|
||||
|
||||
def can_publish_to_repository?
|
||||
return true unless save_to_platform.main?
|
||||
BuildList.where(:id => extra_containers).where('status != ?', BUILD_PUBLISHED).count == 0
|
||||
end
|
||||
|
||||
def can_reject_publish?
|
||||
can_publish? && !save_to_repository.publish_without_qa && !build_published?
|
||||
end
|
||||
|
@ -502,9 +507,4 @@ class BuildList < ActiveRecord::Base
|
|||
self.extra_containers = bls.pluck('build_lists.id')
|
||||
end
|
||||
|
||||
def can_publish_to_repository?
|
||||
return true unless save_to_platform.main?
|
||||
BuildList.where(:id => extra_containers).where('status != ?', BUILD_PUBLISHED).count == 0
|
||||
end
|
||||
|
||||
end
|
|
@ -80,6 +80,7 @@ en:
|
|||
create_container_fail: 'Errors during container creating!'
|
||||
publish_success: 'Build is queued for publishing'
|
||||
publish_fail: 'Errors during build publishing!'
|
||||
publish_with_extra_fail: 'All extra containers should be published before publishing this build list!'
|
||||
cancel_success: 'Build canceled'
|
||||
cancel_fail: 'Errors during build cancelation!'
|
||||
reject_publish_success: 'Publishing rejected'
|
||||
|
|
|
@ -81,6 +81,7 @@ ru:
|
|||
cancel_fail: 'При отмене сборки произошла ошибка!'
|
||||
publish_success: 'Сборка поставлена в очередь на публикацию.'
|
||||
publish_fail: 'При публикации сборки произошла ошибка!'
|
||||
publish_with_extra_fail: 'Все дополнительные контейнеры должны быть опубликованы до публикации этой сборки!'
|
||||
reject_publish_success: 'Публикация отклонена'
|
||||
reject_publish_fail: 'Не удалось отклонить публикацию сборки'
|
||||
container_published: 'Контейнер размещен в репозитории'
|
||||
|
|
Loading…
Reference in New Issue