Merge pull request #417 from abf/rosa-build:416-handle-ExcludeArch-and-ExclusiveArch-tags
#416: Handle ExcludeArch and ExclusiveArch tags
This commit is contained in:
commit
c520399b92
|
@ -2,6 +2,11 @@ module AbfWorker
|
|||
class RpmWorkerObserver < AbfWorker::BaseObserver
|
||||
RESTARTED_BUILD_LISTS = 'abf-worker::rpm-worker-observer::restarted-build-lists'
|
||||
|
||||
# EXIT CODES:
|
||||
# 6 - Unpermitted architecture
|
||||
# other - Build error
|
||||
EXIT_CODE_UNPERMITTED_ARCHITECTURE = 6
|
||||
|
||||
@queue = :rpm_worker_observer
|
||||
|
||||
def self.perform(options)
|
||||
|
@ -29,7 +34,14 @@ module AbfWorker
|
|||
subject.publish_into_testing
|
||||
end
|
||||
when FAILED
|
||||
subject.build_error
|
||||
|
||||
case options['exit_status'].to_i
|
||||
when EXIT_CODE_UNPERMITTED_ARCHITECTURE
|
||||
subject.unpermitted_arch
|
||||
else
|
||||
subject.build_error
|
||||
end
|
||||
|
||||
item.update_attributes({status: BuildList::BUILD_ERROR}) unless rerunning_tests
|
||||
when STARTED
|
||||
subject.start_build
|
||||
|
|
|
@ -105,7 +105,8 @@ class BuildList < ActiveRecord::Base
|
|||
%w(TESTS_FAILED 11000),
|
||||
%w(BUILD_PUBLISHED_INTO_TESTING 12000),
|
||||
%w(BUILD_PUBLISH_INTO_TESTING 13000),
|
||||
%w(FAILED_PUBLISH_INTO_TESTING 14000)
|
||||
%w(FAILED_PUBLISH_INTO_TESTING 14000),
|
||||
%w(UNPERMITTED_ARCH 15000)
|
||||
].each do |kind, value|
|
||||
value = value.to_i
|
||||
const_set kind, value
|
||||
|
@ -189,6 +190,10 @@ class BuildList < ActiveRecord::Base
|
|||
transition waiting_for_response: :build_pending
|
||||
end
|
||||
|
||||
event :unpermitted_arch do
|
||||
transition [:build_started, :build_canceling, :build_canceled] => :unpermitted_arch
|
||||
end
|
||||
|
||||
event :rerun_tests do
|
||||
transition %i(success tests_failed) => :rerun_tests
|
||||
end
|
||||
|
|
|
@ -32,6 +32,14 @@ module Git
|
|||
repo.tags.map(&:name) + repo.branches.map(&:name)
|
||||
end
|
||||
|
||||
def find_blob_and_raw_of_spec_file(project_version)
|
||||
blob = repo.tree(project_version).contents.find{ |n| n.is_a?(Grit::Blob) && n.name =~ /.spec$/ }
|
||||
return unless blob
|
||||
|
||||
raw = Grit::GitRuby::Repository.new(repo.path).get_raw_object_by_sha1(blob.id)
|
||||
[blob, raw]
|
||||
end
|
||||
|
||||
def create_branch(new_ref, from_ref, user)
|
||||
return false if new_ref.blank? || from_ref.blank? || !(from_commit = repo.commit(from_ref))
|
||||
status, out, err = repo.git.native(:branch, {process_info: true}, new_ref, from_commit.id)
|
||||
|
|
|
@ -337,10 +337,9 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def increase_release_tag(project_version, user, message)
|
||||
blob = repo.tree(project_version).contents.find{ |n| n.is_a?(Grit::Blob) && n.name =~ /.spec$/ }
|
||||
blob, raw = find_blob_and_raw_of_spec_file(project_version)
|
||||
return unless blob
|
||||
|
||||
raw = Grit::GitRuby::Repository.new(repo.path).get_raw_object_by_sha1(blob.id)
|
||||
content = self.class.replace_release_tag raw.content
|
||||
return if content == raw.content
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ en:
|
|||
build_published_into_testing: '[testing] Build has been published'
|
||||
build_publish_into_testing: '[testing] Build is being published'
|
||||
failed_publish_into_testing: '[testing] Publishing error'
|
||||
unpermitted_arch: Unpermitted architecture
|
||||
|
||||
log:
|
||||
build_log: Build Log
|
||||
|
|
|
@ -179,7 +179,7 @@ ru:
|
|||
build_published_into_testing: '[testing] опубликован'
|
||||
build_publish_into_testing: '[testing] публикуется'
|
||||
failed_publish_into_testing: '[testing] ошибка публикации'
|
||||
|
||||
unpermitted_arch: Недопустимая архитектура
|
||||
|
||||
log:
|
||||
build_log: Лог сборки
|
||||
|
|
Loading…
Reference in New Issue