Added hostname field to buildlists, changed commit_hash logic, removed yandex and google counters, initial work on iso building
This commit is contained in:
parent
881cae6afa
commit
c7f8b2587d
|
@ -502,7 +502,7 @@ GEM
|
|||
sexp_processor (~> 4.1)
|
||||
rufus-scheduler (2.0.24)
|
||||
tzinfo (>= 0.3.22)
|
||||
rugged (0.21.4)
|
||||
rugged (0.21.0)
|
||||
russian (0.6.0)
|
||||
i18n (>= 0.5.0)
|
||||
rvm-capistrano (1.5.6)
|
||||
|
|
|
@ -57,6 +57,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
flash[:notice] = t('flash.product.build_started')
|
||||
redirect_to [@platform, @product]
|
||||
else
|
||||
puts pbl.errors.messages
|
||||
flash[:error] = t('flash.product.build_error')
|
||||
@product_build_list = pbl
|
||||
render action: :new
|
||||
|
|
|
@ -90,8 +90,8 @@ module GitHelper
|
|||
def versions_for_group_select(project)
|
||||
return [] unless project
|
||||
[
|
||||
[I18n.t('layout.git.repositories.branches'), project.repo.branches.map(&:name).sort],
|
||||
[I18n.t('layout.git.repositories.tags'), project.repo.tags.map(&:name).sort]
|
||||
[I18n.t('layout.git.repositories.branches'), project.github_branches.map(&:name).sort],
|
||||
[I18n.t('layout.git.repositories.tags'), project.github_tags.map(&:name).sort]
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
@ -30,6 +30,15 @@ module AbfWorker
|
|||
return
|
||||
end
|
||||
|
||||
if options['hostname']
|
||||
subject.update_attribute(:hostname, options['hostname'])
|
||||
end
|
||||
|
||||
if options['commit_hash']
|
||||
item.update_attribute(:version, options['commit_hash'])
|
||||
subject.update_attribute(:commit_hash, options['commit_hash'])
|
||||
end
|
||||
|
||||
rerunning_tests = subject.rerunning_tests?
|
||||
|
||||
case status
|
||||
|
@ -69,7 +78,7 @@ module AbfWorker
|
|||
|
||||
def find_or_create_item
|
||||
subject.items.first || subject.items.create({
|
||||
version: subject.commit_hash,
|
||||
version: '',
|
||||
name: subject.project.name,
|
||||
status: BuildList::BUILD_STARTED,
|
||||
level: 0
|
||||
|
|
|
@ -567,7 +567,7 @@ class BuildList < ActiveRecord::Base
|
|||
cmd_params = {
|
||||
'PACKAGE' => project.name,
|
||||
'GIT_REPO' => git_project_address,
|
||||
'COMMIT_HASH' => commit_hash,
|
||||
'PROJECT_VERSION' => project_version,
|
||||
'USE_EXTRA_TESTS' => use_extra_tests?,
|
||||
'SAVE_BUILDROOT' => save_buildroot?,
|
||||
'EXTRA_CFG_OPTIONS' => extra_params['cfg_options'],
|
||||
|
|
|
@ -2,40 +2,11 @@ module CommitAndVersion
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
|
||||
validate -> {
|
||||
if project && (commit_hash.blank? || (not project.github_get_commit(commit_hash)))
|
||||
errors.add :commit_hash, I18n.t('flash.build_list.wrong_commit_hash', commit_hash: commit_hash)
|
||||
end
|
||||
}
|
||||
|
||||
before_validation :set_commit_and_version
|
||||
before_create :set_last_published_commit
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_commit_and_version
|
||||
if project && project_version.present? && commit_hash.blank?
|
||||
res = ""
|
||||
project.github_branches.each do |br|
|
||||
if br.name == project_version
|
||||
res = br.commit.sha
|
||||
end
|
||||
end
|
||||
if res.empty?
|
||||
project.github_tags.each do |br|
|
||||
if br.name == project_version
|
||||
res = br.commit.sha
|
||||
end
|
||||
end
|
||||
end
|
||||
self.commit_hash = res
|
||||
elsif project_version.blank? && commit_hash.present?
|
||||
self.project_version = commit_hash
|
||||
end
|
||||
end
|
||||
|
||||
def set_last_published_commit
|
||||
return unless self.respond_to? :last_published_commit_hash # product?
|
||||
last_commit = self.last_published.first.try :commit_hash
|
||||
|
|
|
@ -42,8 +42,7 @@ module ProductBuildLists::AbfWorkerable
|
|||
main_script: main_script,
|
||||
platform: {
|
||||
type: product.platform.distrib_type,
|
||||
name: product.platform.name,
|
||||
arch: arch.name
|
||||
name: product.platform.name
|
||||
},
|
||||
user: {uname: user.try(:uname), email: user.try(:email)}
|
||||
}
|
||||
|
@ -53,15 +52,7 @@ module ProductBuildLists::AbfWorkerable
|
|||
#
|
||||
# Returns the String.
|
||||
def abf_worker_srcpath
|
||||
file_name = "#{project.name}-#{commit_hash}"
|
||||
opts = default_url_options
|
||||
opts.merge!({user: user.authentication_token, password: ''}) if user.present?
|
||||
url_helpers.archive_url(
|
||||
project.name_with_owner,
|
||||
file_name,
|
||||
'tar.gz',
|
||||
opts
|
||||
)
|
||||
"https://github.com/" + project.github_get_organization + "/" + project.name + "/archive/" + project_version + ".tar.gz"
|
||||
end
|
||||
|
||||
# Private: Get params for ABF worker task.
|
||||
|
@ -71,8 +62,7 @@ module ProductBuildLists::AbfWorkerable
|
|||
p = {
|
||||
'BUILD_ID' => id,
|
||||
'PROJECT' => project.name_with_owner,
|
||||
'PROJECT_VERSION' => project_version,
|
||||
'COMMIT_HASH' => commit_hash,
|
||||
'PROJECT_VERSION' => project_version
|
||||
}
|
||||
if product.platform.hidden?
|
||||
token = product.platform.tokens.by_active.where(description: CACHED_CHROOT_TOKEN_DESCRIPTION).first
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class ProductBuildList < ActiveRecord::Base
|
||||
include CommitAndVersion
|
||||
include TimeLiving
|
||||
include FileStoreClean
|
||||
include UrlHelper
|
||||
|
@ -12,18 +11,14 @@ class ProductBuildList < ActiveRecord::Base
|
|||
|
||||
belongs_to :product
|
||||
belongs_to :project
|
||||
belongs_to :arch
|
||||
belongs_to :user
|
||||
|
||||
# see: Issue #6
|
||||
before_validation -> { self.arch_id = Arch.find_by(name: 'x86_64').id }, on: :create
|
||||
# field "not_delete" can be changed only if build has been completed
|
||||
before_validation -> { self.not_delete = false unless build_completed?; true }
|
||||
|
||||
validates :product, :product_id,
|
||||
:project, :project_id,
|
||||
:main_script,
|
||||
:arch, :arch_id,
|
||||
presence: true
|
||||
validates :main_script, :params, length: { maximum: 255 }
|
||||
|
||||
|
|
|
@ -36,4 +36,3 @@ html
|
|||
== yield :additional_scripts if content_for?(:additional_scripts)
|
||||
|
||||
== render '/layouts/scroller'
|
||||
== render 'layouts/counters' if Rails.env.production?
|
||||
|
|
|
@ -26,5 +26,4 @@ html
|
|||
- if I18n.locale == :ru
|
||||
== javascript_include_tag 'moment/ru.js', cache: 'moment'
|
||||
== javascript_include_tag 'angular-locale_ru-ru', cache: 'angular-locale'
|
||||
== yield :additional_scripts if content_for?(:additional_scripts)
|
||||
== render 'layouts/counters' if Rails.env.production?
|
||||
== yield :additional_scripts if content_for?(:additional_scripts)
|
|
@ -2,7 +2,7 @@ now = Time.now.utc
|
|||
users, projects, platforms, repositories = [], [], [], []
|
||||
json.build_lists @build_lists do |build_list|
|
||||
json.(build_list, :id, :status, :project_id, :project_version, :save_to_platform_id, :save_to_repository_id, :user_id, :project_id, :build_for_platform_id, :arch_id, :group_id)
|
||||
json.commit_hash build_list.commit_hash.first(5)
|
||||
json.commit_hash build_list.commit_hash.to_s.first(5)
|
||||
json.last_published_commit_hash build_list.last_published_commit_hash.first(5) if build_list.last_published_commit_hash
|
||||
|
||||
if BuildList::HUMAN_STATUSES[build_list.status].in? [:build_pending, :build_started, :build_publish]
|
||||
|
|
|
@ -128,6 +128,10 @@ row[ ng-controller='BuildListController'
|
|||
td= t('activerecord.attributes.build_list.arch')
|
||||
td= @build_list.arch.name
|
||||
|
||||
tr
|
||||
td= t('activerecord.attributes.build_list.hostname')
|
||||
td= @build_list.hostname
|
||||
|
||||
tr
|
||||
td= t('activerecord.attributes.build_list.updated_at')
|
||||
td
|
||||
|
|
|
@ -22,7 +22,6 @@ json.build_list do
|
|||
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.publisher do
|
||||
|
|
|
@ -21,6 +21,7 @@ en:
|
|||
arch_id: Architecture
|
||||
arch_short: Arch
|
||||
arch: Architecture
|
||||
hostname: Hostname
|
||||
new_core: New core
|
||||
is_circle: Recurrent build
|
||||
updated_at: Notified at
|
||||
|
|
|
@ -20,6 +20,7 @@ ru:
|
|||
project: Проект
|
||||
arch_id: Архитектура
|
||||
arch: Архитектура
|
||||
hostname: Хост
|
||||
arch_short: Архит-ра
|
||||
new_core: Новое ядро
|
||||
is_circle: Циклическая сборка
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddHostnameToBuildLists < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :build_lists, :hostname, :string
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue