Merge pull request #455 from abf/rosa-build:default-branch-for-platforms
Add ability to use specific branch for each platform
This commit is contained in:
commit
921e12e7cb
|
@ -12,7 +12,7 @@ NewBuildListController = (dataservice, $http) ->
|
||||||
result = _.select(vm.save_to_repositories, (e) ->
|
result = _.select(vm.save_to_repositories, (e) ->
|
||||||
e.id is vm.save_to_repository_id or
|
e.id is vm.save_to_repository_id or
|
||||||
!vm.save_to_repository_id and
|
!vm.save_to_repository_id and
|
||||||
e.platform_name is vm.project_version_name
|
e.default_branch is vm.project_version_name
|
||||||
)
|
)
|
||||||
return vm.save_to_repositories[0] if result.length is 0
|
return vm.save_to_repositories[0] if result.length is 0
|
||||||
result[0]
|
result[0]
|
||||||
|
@ -78,7 +78,7 @@ NewBuildListController = (dataservice, $http) ->
|
||||||
vm.build_for_platform_id = vm.save_to_repository.platform_id
|
vm.build_for_platform_id = vm.save_to_repository.platform_id
|
||||||
vm.is_build_for_main_platform = isBuildForMainPlatform()
|
vm.is_build_for_main_platform = isBuildForMainPlatform()
|
||||||
|
|
||||||
vm.project_version_name = vm.save_to_repository.platform_name
|
vm.project_version_name = vm.save_to_repository.default_branch
|
||||||
vm.project_version = setProjectVersion() if vm.is_build_for_main_platform
|
vm.project_version = setProjectVersion() if vm.is_build_for_main_platform
|
||||||
|
|
||||||
changeStatusRepositories()
|
changeStatusRepositories()
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Platforms::PlatformsController < Platforms::BaseController
|
||||||
@admin_uname = params[:admin_uname]
|
@admin_uname = params[:admin_uname]
|
||||||
|
|
||||||
platform_params = params[:platform] || {}
|
platform_params = params[:platform] || {}
|
||||||
platform_params = platform_params.slice(:description, :platform_arch_settings_attributes, :released, :automatic_metadata_regeneration)
|
platform_params = platform_params.slice(:description, :platform_arch_settings_attributes, :released, :automatic_metadata_regeneration, :default_branch)
|
||||||
platform_params[:owner] = User.find(@admin_id) if @admin_id.present?
|
platform_params[:owner] = User.find(@admin_id) if @admin_id.present?
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ module BuildListsHelper
|
||||||
publish_without_qa: r.publish_without_qa?,
|
publish_without_qa: r.publish_without_qa?,
|
||||||
repo_name: r.name,
|
repo_name: r.name,
|
||||||
platform_id: r.platform.id,
|
platform_id: r.platform.id,
|
||||||
platform_name: r.platform.name,
|
default_branch: r.platform.default_branch,
|
||||||
default_arches: ( r.platform.platform_arch_settings.by_default.pluck(:arch_id).presence ||
|
default_arches: ( r.platform.platform_arch_settings.by_default.pluck(:arch_id).presence ||
|
||||||
Arch.where(name: Arch::DEFAULT).pluck(:id) )
|
Arch.where(name: Arch::DEFAULT).pluck(:id) )
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,11 @@ class Platform < ActiveRecord::Base
|
||||||
uniqueness: { case_sensitive: false },
|
uniqueness: { case_sensitive: false },
|
||||||
presence: true,
|
presence: true,
|
||||||
format: { with: /\A#{NAME_PATTERN}\z/ },
|
format: { with: /\A#{NAME_PATTERN}\z/ },
|
||||||
length: { maximum: 100 }
|
length: { maximum: 100 }
|
||||||
|
|
||||||
|
validates :default_branch,
|
||||||
|
presence: true,
|
||||||
|
length: { maximum: 100 }
|
||||||
|
|
||||||
validates :distrib_type,
|
validates :distrib_type,
|
||||||
presence: true,
|
presence: true,
|
||||||
|
@ -114,7 +118,8 @@ class Platform < ActiveRecord::Base
|
||||||
:platform_arch_settings_attributes,
|
:platform_arch_settings_attributes,
|
||||||
:automatic_metadata_regeneration,
|
:automatic_metadata_regeneration,
|
||||||
:admin_id,
|
:admin_id,
|
||||||
:term
|
:term,
|
||||||
|
:default_branch
|
||||||
|
|
||||||
attr_accessor :admin_id, :term
|
attr_accessor :admin_id, :term
|
||||||
|
|
||||||
|
|
|
@ -210,10 +210,10 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def project_version_for(save_to_platform, build_for_platform)
|
def project_version_for(save_to_platform, build_for_platform)
|
||||||
if repo.commits("#{save_to_platform.name}").try(:first).try(:id)
|
if repo.commits("#{save_to_platform.default_branch}").try(:first).try(:id)
|
||||||
save_to_platform.name
|
save_to_platform.default_branch
|
||||||
elsif repo.commits("#{build_for_platform.name}").try(:first).try(:id)
|
elsif repo.commits("#{build_for_platform.default_branch}").try(:first).try(:id)
|
||||||
build_for_platform.name
|
build_for_platform.default_branch
|
||||||
else
|
else
|
||||||
default_branch
|
default_branch
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
value: @admin_uname,
|
value: @admin_uname,
|
||||||
class: 'typeahead' }
|
class: 'typeahead' }
|
||||||
|
|
||||||
|
= f.input :default_branch
|
||||||
|
|
||||||
- if %w(edit update).include? controller.action_name
|
- if %w(edit update).include? controller.action_name
|
||||||
|
|
||||||
- if can? :change_visibility, @platform
|
- if can? :change_visibility, @platform
|
||||||
|
|
|
@ -98,9 +98,14 @@ en:
|
||||||
simple_form:
|
simple_form:
|
||||||
labels:
|
labels:
|
||||||
platform:
|
platform:
|
||||||
term: Search
|
term: Search
|
||||||
admin_id: Owner
|
admin_id: Owner
|
||||||
|
default_branch: Default branch
|
||||||
|
hints:
|
||||||
|
platform:
|
||||||
|
default_branch: "This is the name of branch that will be used by default at creation of build for platform."
|
||||||
placeholders:
|
placeholders:
|
||||||
platform:
|
platform:
|
||||||
term: Enter the name of file or folder here.
|
term: Enter the name of file or folder here.
|
||||||
|
default_branch: Enter the name of branch here.
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,14 @@ ru:
|
||||||
simple_form:
|
simple_form:
|
||||||
labels:
|
labels:
|
||||||
platform:
|
platform:
|
||||||
term: Искать
|
term: Искать
|
||||||
admin_id: Владелец
|
admin_id: Владелец
|
||||||
|
default_branch: Ветка по умолчанию
|
||||||
|
hints:
|
||||||
|
platform:
|
||||||
|
default_branch: "Это имя ветки, которая будет использоваться по умолчанию при создании сборок для платформы."
|
||||||
placeholders:
|
placeholders:
|
||||||
platform:
|
platform:
|
||||||
term: Введите имя файла или папки здесь.
|
term: Введите имя файла или папки здесь.
|
||||||
|
default_branch: Введите имя ветки здесь.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class AddDefaultBranchToPlatforms < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :platforms, :default_branch, :string
|
||||||
|
execute "UPDATE platforms SET default_branch = name"
|
||||||
|
change_column_null :platforms, :default_branch, false
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :platforms, :default_branch
|
||||||
|
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: 20150210192749) do
|
ActiveRecord::Schema.define(version: 20150217215529) 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"
|
||||||
|
@ -416,6 +416,7 @@ ActiveRecord::Schema.define(version: 20150210192749) do
|
||||||
t.integer "last_regenerated_status"
|
t.integer "last_regenerated_status"
|
||||||
t.string "last_regenerated_log_sha1"
|
t.string "last_regenerated_log_sha1"
|
||||||
t.string "automatic_metadata_regeneration"
|
t.string "automatic_metadata_regeneration"
|
||||||
|
t.string "default_branch", null: false
|
||||||
t.index ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
t.index ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ describe Platform do
|
||||||
it { should validate_uniqueness_of(:name).case_insensitive }
|
it { should validate_uniqueness_of(:name).case_insensitive }
|
||||||
it { should allow_value('Basic_platform-name-1234').for(:name) }
|
it { should allow_value('Basic_platform-name-1234').for(:name) }
|
||||||
it { should_not allow_value('.!').for(:name) }
|
it { should_not allow_value('.!').for(:name) }
|
||||||
|
it { should validate_presence_of(:default_branch)}
|
||||||
it { should validate_presence_of(:description) }
|
it { should validate_presence_of(:description) }
|
||||||
it { should validate_presence_of(:distrib_type) }
|
it { should validate_presence_of(:distrib_type) }
|
||||||
it { should validate_presence_of(:visibility) }
|
it { should validate_presence_of(:visibility) }
|
||||||
|
|
Loading…
Reference in New Issue