Merge pull request #282 from abf/rosa-build:281-show-repodata-creation-logs
#281: Show repodata creation logs
This commit is contained in:
commit
055c1f76e8
|
@ -1,5 +1,6 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Platforms::PlatformsController < Platforms::BaseController
|
class Platforms::PlatformsController < Platforms::BaseController
|
||||||
|
include FileStoreHelper
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
skip_before_filter :authenticate_user!, :only => [:advisories, :members, :show] if APP_CONFIG['anonymous_access']
|
skip_before_filter :authenticate_user!, :only => [:advisories, :members, :show] if APP_CONFIG['anonymous_access']
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Platforms::ProductBuildListsController < Platforms::BaseController
|
class Platforms::ProductBuildListsController < Platforms::BaseController
|
||||||
include BuildsHelper
|
include FileStoreHelper
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
skip_before_filter :authenticate_user!, :only => [:index, :show, :log] if APP_CONFIG['anonymous_access']
|
skip_before_filter :authenticate_user!, :only => [:index, :show, :log] if APP_CONFIG['anonymous_access']
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Platforms::RepositoriesController < Platforms::BaseController
|
class Platforms::RepositoriesController < Platforms::BaseController
|
||||||
|
include FileStoreHelper
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
skip_before_filter :authenticate_user!, :only => [:index, :show, :projects_list] if APP_CONFIG['anonymous_access']
|
skip_before_filter :authenticate_user!, :only => [:index, :show, :projects_list] if APP_CONFIG['anonymous_access']
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Projects::BuildListsController < Projects::BaseController
|
class Projects::BuildListsController < Projects::BaseController
|
||||||
include BuildsHelper
|
include FileStoreHelper
|
||||||
|
|
||||||
NESTED_ACTIONS = [:index, :new, :create]
|
NESTED_ACTIONS = [:index, :new, :create]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
module BuildsHelper
|
module FileStoreHelper
|
||||||
|
|
||||||
def file_store_results_url(sha1, file_name)
|
def file_store_results_url(sha1, file_name)
|
||||||
url = "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}"
|
url = "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}"
|
||||||
|
@ -7,4 +7,12 @@ module BuildsHelper
|
||||||
url
|
url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_to_file_store(file_name, sha1)
|
||||||
|
if sha1.present?
|
||||||
|
link_to file_name, file_store_results_url(sha1, file_name)
|
||||||
|
else
|
||||||
|
I18n.t('layout.no_')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -1,27 +0,0 @@
|
||||||
module RegenerationStatus
|
|
||||||
|
|
||||||
def human_regeneration_status
|
|
||||||
self.class::HUMAN_REGENERATION_STATUSES[last_regenerated_status] || :no_data
|
|
||||||
end
|
|
||||||
|
|
||||||
def human_status
|
|
||||||
self.class::HUMAN_STATUSES[status] || :no_data
|
|
||||||
end
|
|
||||||
|
|
||||||
READY = 0
|
|
||||||
WAITING_FOR_REGENERATION = 100
|
|
||||||
REGENERATING = 200
|
|
||||||
|
|
||||||
HUMAN_STATUSES = {
|
|
||||||
READY => :ready,
|
|
||||||
WAITING_FOR_REGENERATION => :waiting_for_regeneration,
|
|
||||||
REGENERATING => :regenerating
|
|
||||||
}
|
|
||||||
|
|
||||||
HUMAN_REGENERATION_STATUSES = {
|
|
||||||
AbfWorker::BaseObserver::COMPLETED => :completed,
|
|
||||||
AbfWorker::BaseObserver::FAILED => :failed,
|
|
||||||
AbfWorker::BaseObserver::CANCELED => :canceled
|
|
||||||
}.freeze
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Platform < ActiveRecord::Base
|
class Platform < ActiveRecord::Base
|
||||||
include RegenerationStatus
|
include Modules::Models::FileStoreClean
|
||||||
|
include Modules::Models::RegenerationStatus
|
||||||
|
|
||||||
VISIBILITIES = %w(open hidden)
|
VISIBILITIES = %w(open hidden)
|
||||||
NAME_PATTERN = /[\w\-\.]+/
|
NAME_PATTERN = /[\w\-\.]+/
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class RepositoryStatus < ActiveRecord::Base
|
class RepositoryStatus < ActiveRecord::Base
|
||||||
include RegenerationStatus
|
include Modules::Models::FileStoreClean
|
||||||
|
include Modules::Models::RegenerationStatus
|
||||||
|
|
||||||
WAITING_FOR_RESIGN = 300
|
WAITING_FOR_RESIGN = 300
|
||||||
PUBLISH = 400
|
PUBLISH = 400
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
.leftlist= t('activerecord.attributes.regeneration_status.last_regenerated_status')
|
.leftlist= t('activerecord.attributes.regeneration_status.last_regenerated_status')
|
||||||
.rightlist= t("layout.regeneration_statuses.last_regenerated_statuses.#{@platform.human_regeneration_status}")
|
.rightlist= t("layout.regeneration_statuses.last_regenerated_statuses.#{@platform.human_regeneration_status}")
|
||||||
.both
|
.both
|
||||||
|
.leftlist= t('activerecord.attributes.regeneration_status.last_regenerated_log_sha1')
|
||||||
|
.rightlist= link_to_file_store('regeneration.log', @platform.last_regenerated_log_sha1)
|
||||||
|
.both
|
||||||
.leftside
|
.leftside
|
||||||
.rightside= link_to t('layout.regeneration_statuses.regenerate_metadata'), regenerate_metadata_platform_path(@platform), :method => :put, :confirm => t('layout.confirm'), :class => 'button'
|
.rightside= link_to t('layout.regeneration_statuses.regenerate_metadata'), regenerate_metadata_platform_path(@platform), :method => :put, :confirm => t('layout.confirm'), :class => 'button'
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
%tr
|
%tr
|
||||||
%th= t('activerecord.attributes.regeneration_status.status')
|
%th= t('activerecord.attributes.regeneration_status.status')
|
||||||
%th= t('activerecord.attributes.regeneration_status.last_regenerated_status')
|
%th= t('activerecord.attributes.regeneration_status.last_regenerated_status')
|
||||||
|
%th= t('activerecord.attributes.regeneration_status.last_regenerated_log_sha1')
|
||||||
%th= t('activerecord.attributes.regeneration_status.last_regenerated_at')
|
%th= t('activerecord.attributes.regeneration_status.last_regenerated_at')
|
||||||
- unless @platform.main?
|
- unless @platform.main?
|
||||||
%th= t('activerecord.models.platform')
|
%th= t('activerecord.models.platform')
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
%tr{:class => cycle('odd', 'even')}
|
%tr{:class => cycle('odd', 'even')}
|
||||||
%td= t("layout.regeneration_statuses.statuses.#{status.human_status}")
|
%td= t("layout.regeneration_statuses.statuses.#{status.human_status}")
|
||||||
%td= t("layout.regeneration_statuses.last_regenerated_statuses.#{status.human_regeneration_status}")
|
%td= t("layout.regeneration_statuses.last_regenerated_statuses.#{status.human_regeneration_status}")
|
||||||
|
%td= link_to_file_store('regeneration.log', status.last_regenerated_log_sha1)
|
||||||
%td= status.last_regenerated_at
|
%td= status.last_regenerated_at
|
||||||
- unless @platform.main?
|
- unless @platform.main?
|
||||||
%td= status.platform.name
|
%td= status.platform.name
|
||||||
|
|
|
@ -28,7 +28,6 @@ module Rosa
|
||||||
# Custom directories with classes and modules you want to be autoloadable.
|
# Custom directories with classes and modules you want to be autoloadable.
|
||||||
# config.autoload_paths += %W(#{config.root}/extras)
|
# config.autoload_paths += %W(#{config.root}/extras)
|
||||||
config.autoload_paths += %W(#{config.root}/app/presenters)
|
config.autoload_paths += %W(#{config.root}/app/presenters)
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/concerns)
|
|
||||||
|
|
||||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||||
|
|
|
@ -27,4 +27,5 @@ en:
|
||||||
regeneration_status:
|
regeneration_status:
|
||||||
last_regenerated_at: Last regeneration of metadata
|
last_regenerated_at: Last regeneration of metadata
|
||||||
last_regenerated_status: Last status of regeneration metadata
|
last_regenerated_status: Last status of regeneration metadata
|
||||||
|
last_regenerated_log_sha1: Last log of regeneration metadata
|
||||||
status: Current status
|
status: Current status
|
||||||
|
|
|
@ -5,17 +5,17 @@ ru:
|
||||||
statuses:
|
statuses:
|
||||||
no_data: Нет данных
|
no_data: Нет данных
|
||||||
ready: Нет действий
|
ready: Нет действий
|
||||||
waiting_for_regeneration: Ожидание регенерации методанных
|
waiting_for_regeneration: Ожидание регенерации метаданных
|
||||||
regenerating: Идет регенерация методанных
|
regenerating: Идет регенерация метаданных
|
||||||
waiting_for_resign: Ожидание подписи пакетов
|
waiting_for_resign: Ожидание подписи пакетов
|
||||||
publish: Идет публикация
|
publish: Идет публикация
|
||||||
resign: Идет подпись пакетов
|
resign: Идет подпись пакетов
|
||||||
waiting_for_resign_after_publish: Идет публикация, ожидание подписи пакетов
|
waiting_for_resign_after_publish: Идет публикация, ожидание подписи пакетов
|
||||||
waiting_for_resign_after_regeneration: Идет регенерация методанных, ожидание подписи пакетов
|
waiting_for_resign_after_regeneration: Идет регенерация метаданных, ожидание подписи пакетов
|
||||||
waiting_for_regeneration_after_publish: Идет публикация, ожидание регенерации методанных
|
waiting_for_regeneration_after_publish: Идет публикация, ожидание регенерации метаданных
|
||||||
waiting_for_regeneration_after_resign: Идет подпись пакетов, ожидание регенерации методанных
|
waiting_for_regeneration_after_resign: Идет подпись пакетов, ожидание регенерации метаданных
|
||||||
waiting_for_resign_and_regeneration_after_publish: Идет публикация, ожидание подписи пакетов и регенерации методанных
|
waiting_for_resign_and_regeneration_after_publish: Идет публикация, ожидание подписи пакетов и регенерации метаданных
|
||||||
waiting_for_resign_and_regeneration: Ожидание подписи пакетов и регенерации методанных
|
waiting_for_resign_and_regeneration: Ожидание подписи пакетов и регенерации метаданных
|
||||||
last_regenerated_statuses:
|
last_regenerated_statuses:
|
||||||
no_data: Нет данных
|
no_data: Нет данных
|
||||||
completed: Завершена успешно
|
completed: Завершена успешно
|
||||||
|
@ -25,6 +25,7 @@ ru:
|
||||||
activerecord:
|
activerecord:
|
||||||
attributes:
|
attributes:
|
||||||
regeneration_status:
|
regeneration_status:
|
||||||
last_regenerated_at: Последняя регенерация методанных
|
last_regenerated_at: Последняя регенерация метаданных
|
||||||
last_regenerated_status: Статус последней регенерации методанных
|
last_regenerated_status: Статус последней регенерации метаданных
|
||||||
|
last_regenerated_log_sha1: Последний лог регенерации метаданных
|
||||||
status: Текущее состояние
|
status: Текущее состояние
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddLastRegeneratedLogSha1ToPlatformAndRepositoryStatus < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :platforms, :last_regenerated_log_sha1, :string
|
||||||
|
add_column :repository_statuses, :last_regenerated_log_sha1, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -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 => 20130822160501) do
|
ActiveRecord::Schema.define(:version => 20130827144022) 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
|
||||||
|
@ -320,6 +320,7 @@ ActiveRecord::Schema.define(:version => 20130822160501) do
|
||||||
t.integer "status", :default => 0
|
t.integer "status", :default => 0
|
||||||
t.datetime "last_regenerated_at"
|
t.datetime "last_regenerated_at"
|
||||||
t.integer "last_regenerated_status"
|
t.integer "last_regenerated_status"
|
||||||
|
t.string "last_regenerated_log_sha1"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||||
|
@ -495,6 +496,7 @@ ActiveRecord::Schema.define(:version => 20130822160501) do
|
||||||
t.integer "last_regenerated_status"
|
t.integer "last_regenerated_status"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
|
t.string "last_regenerated_log_sha1"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "repository_statuses", ["repository_id", "platform_id"], :name => "index_repository_statuses_on_repository_id_and_platform_id", :unique => true
|
add_index "repository_statuses", ["repository_id", "platform_id"], :name => "index_repository_statuses_on_repository_id_and_platform_id", :unique => true
|
||||||
|
|
|
@ -352,7 +352,6 @@ module AbfWorker
|
||||||
:arch => 'x86_64'
|
:arch => 'x86_64'
|
||||||
},
|
},
|
||||||
:time_living => 9600, # 160 min
|
:time_living => 9600, # 160 min
|
||||||
:skip_feedback => true,
|
|
||||||
:extra => {:platform_id => platform.id, :regenerate_platform => true}
|
:extra => {:platform_id => platform.id, :regenerate_platform => true}
|
||||||
}]
|
}]
|
||||||
) if platform.start_regeneration
|
) if platform.start_regeneration
|
||||||
|
@ -395,7 +394,6 @@ module AbfWorker
|
||||||
:arch => 'x86_64'
|
:arch => 'x86_64'
|
||||||
},
|
},
|
||||||
:time_living => 9600, # 160 min
|
:time_living => 9600, # 160 min
|
||||||
:skip_feedback => true,
|
|
||||||
:extra => {:repository_status_id => repository_status.id, :regenerate => true}
|
:extra => {:repository_status_id => repository_status.id, :regenerate => true}
|
||||||
}]
|
}]
|
||||||
) if repository_status.start_regeneration
|
) if repository_status.start_regeneration
|
||||||
|
|
|
@ -12,13 +12,20 @@ module AbfWorker
|
||||||
extra = options['extra']
|
extra = options['extra']
|
||||||
repository_status = RepositoryStatus.where(:id => extra['repository_status_id']).first
|
repository_status = RepositoryStatus.where(:id => extra['repository_status_id']).first
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
if extra['regenerate'] || extra['regenerate_platform']
|
||||||
|
log_sha1 = (options['results'].try(:first) || {}).fetch('sha1', nil)
|
||||||
|
end
|
||||||
|
|
||||||
if extra['regenerate'] # Regenerate metadata
|
if extra['regenerate'] # Regenerate metadata
|
||||||
repository_status.last_regenerated_at = Time.now.utc
|
repository_status.last_regenerated_at = Time.now.utc
|
||||||
repository_status.last_regenerated_status = status
|
repository_status.last_regenerated_status = status
|
||||||
|
repository_status.last_regenerated_log_sha1 = log_sha1
|
||||||
elsif extra['regenerate_platform'] # Regenerate metadata for Software Center
|
elsif extra['regenerate_platform'] # Regenerate metadata for Software Center
|
||||||
if platform = Platform.where(:id => extra['platform_id']).first
|
if platform = Platform.where(:id => extra['platform_id']).first
|
||||||
platform.last_regenerated_at = Time.now.utc
|
platform.last_regenerated_at = Time.now.utc
|
||||||
platform.last_regenerated_status = status
|
platform.last_regenerated_status = status
|
||||||
|
platform.last_regenerated_log_sha1 = log_sha1
|
||||||
platform.ready
|
platform.ready
|
||||||
end
|
end
|
||||||
elsif extra['create_container'] # Container has been created
|
elsif extra['create_container'] # Container has been created
|
||||||
|
|
|
@ -30,6 +30,11 @@ module Modules
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def later_destroy_files_from_file_store(args)
|
||||||
|
destroy_files_from_file_store(args)
|
||||||
|
end
|
||||||
|
later :later_destroy_files_from_file_store, :queue => :clone_build
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.file_exist_on_file_store?(sha1)
|
def self.file_exist_on_file_store?(sha1)
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
module Modules
|
||||||
|
module Models
|
||||||
|
module RegenerationStatus
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
READY = 0
|
||||||
|
WAITING_FOR_REGENERATION = 100
|
||||||
|
REGENERATING = 200
|
||||||
|
|
||||||
|
HUMAN_STATUSES = {
|
||||||
|
READY => :ready,
|
||||||
|
WAITING_FOR_REGENERATION => :waiting_for_regeneration,
|
||||||
|
REGENERATING => :regenerating
|
||||||
|
}
|
||||||
|
|
||||||
|
HUMAN_REGENERATION_STATUSES = {
|
||||||
|
AbfWorker::BaseObserver::COMPLETED => :completed,
|
||||||
|
AbfWorker::BaseObserver::FAILED => :failed,
|
||||||
|
AbfWorker::BaseObserver::CANCELED => :canceled
|
||||||
|
}.freeze
|
||||||
|
|
||||||
|
included do
|
||||||
|
after_update :cleanup_file_store
|
||||||
|
|
||||||
|
def sha1_of_file_store_files
|
||||||
|
files = []
|
||||||
|
files << last_regenerated_log_sha1 if last_regenerated_log_sha1.present?
|
||||||
|
files
|
||||||
|
end
|
||||||
|
|
||||||
|
def human_regeneration_status
|
||||||
|
self.class::HUMAN_REGENERATION_STATUSES[last_regenerated_status] || :no_data
|
||||||
|
end
|
||||||
|
|
||||||
|
def human_status
|
||||||
|
self.class::HUMAN_STATUSES[status] || :no_data
|
||||||
|
end
|
||||||
|
|
||||||
|
def cleanup_file_store
|
||||||
|
old_log_sha1 = last_regenerated_log_sha1_was
|
||||||
|
if old_log_sha1.present? && old_log_sha1 != last_regenerated_log_sha1
|
||||||
|
later_destroy_files_from_file_store([old_log_sha1])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue