Replace annotated tags to lightweight. Improve specs. Restore lost migrations. Refs #103
This commit is contained in:
parent
62d0419bdd
commit
f8be867aaf
|
@ -84,8 +84,7 @@ class BuildListsController < ApplicationController
|
||||||
if params[:status].to_i == 0 # ok
|
if params[:status].to_i == 0 # ok
|
||||||
@build_list.status = BuildList::BUILD_PUBLISHED
|
@build_list.status = BuildList::BUILD_PUBLISHED
|
||||||
@build_list.package_version = "#{params[:version]}-#{params[:release]}"
|
@build_list.package_version = "#{params[:version]}-#{params[:release]}"
|
||||||
system("cd #{@build_list.project.git_repository.path} &&
|
system("cd #{@build_list.project.git_repository.path} && git tag #{@build_list.package_version} #{@build_list.commit_hash}") # TODO REDO through grit
|
||||||
git tag -a -m '#{@build_list.package_version}' #{@build_list.package_version} #{@build_list.commit_hash}") # TODO REDO through grit
|
|
||||||
else
|
else
|
||||||
@build_list.status = BuildList::FAILED_PUBLISH
|
@build_list.status = BuildList::FAILED_PUBLISH
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
class CreateRoles < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
create_table :roles do |t|
|
||||||
|
t.integer :id
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
drop_table :roles
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateRoleLines < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
create_table :role_lines do |t|
|
||||||
|
t.integer :role_id
|
||||||
|
t.integer :relation_id
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
drop_table :role_lines
|
||||||
|
end
|
||||||
|
end
|
|
@ -45,7 +45,7 @@ describe BuildListsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should save correct commit_hash for tag based build' do
|
it 'should save correct commit_hash for tag based build' do
|
||||||
system("cd #{@project.git_repository.path} && git tag -a -m '4.7.5.3' 4.7.5.3") # TODO REDO through grit
|
system("cd #{@project.git_repository.path} && git tag 4.7.5.3") # TODO REDO through grit
|
||||||
post :create, {:project_id => @project.id}.merge(@create_params).deep_merge(:build_list => {:project_version => "4.7.5.3"})
|
post :create, {:project_id => @project.id}.merge(@create_params).deep_merge(:build_list => {:project_version => "4.7.5.3"})
|
||||||
@project.build_lists.last.commit_hash.should == @project.git_repository.commits('4.7.5.3').last.id
|
@project.build_lists.last.commit_hash.should == @project.git_repository.commits('4.7.5.3').last.id
|
||||||
end
|
end
|
||||||
|
@ -312,14 +312,19 @@ describe BuildListsController do
|
||||||
let(:build_list) { Factory(:build_list_core) }
|
let(:build_list) { Factory(:build_list_core) }
|
||||||
|
|
||||||
describe 'publish_build' do
|
describe 'publish_build' do
|
||||||
before {test_git_commit(build_list.project); build_list.update_attribute :commit_hash, build_list.project.git_repository.commits.last.id}
|
before { test_git_commit(build_list.project); build_list.update_attribute :commit_hash, build_list.project.git_repository.commits('master').last.id }
|
||||||
|
|
||||||
def do_get(status)
|
def do_get(status)
|
||||||
get :publish_build, :id => build_list.bs_id, :status => status, :version => '4.7.5.3', :release => '1'
|
get :publish_build, :id => build_list.bs_id, :status => status, :version => '4.7.5.3', :release => '1'
|
||||||
build_list.reload
|
build_list.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
it { do_get(BuildServer::SUCCESS); build_list.project.git_repository.tags.last.name.should == build_list.package_version; response.should be_ok }
|
it { do_get(BuildServer::SUCCESS); response.should be_ok }
|
||||||
|
it 'should create correct git tag for correct commit' do
|
||||||
|
do_get(BuildServer::SUCCESS)
|
||||||
|
build_list.project.git_repository.tags.last.name.should == build_list.package_version
|
||||||
|
build_list.project.git_repository.commits(build_list.package_version).last.id.should == build_list.commit_hash
|
||||||
|
end
|
||||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISHED) }
|
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISHED) }
|
||||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :package_version).to('4.7.5.3-1') }
|
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :package_version).to('4.7.5.3-1') }
|
||||||
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :status).to(BuildList::FAILED_PUBLISH) }
|
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :status).to(BuildList::FAILED_PUBLISH) }
|
||||||
|
|
|
@ -8,7 +8,7 @@ Factory.define(:build_list) do |p|
|
||||||
p.build_requires true
|
p.build_requires true
|
||||||
p.update_type 'security'
|
p.update_type 'security'
|
||||||
p.include_repos {|bl| bl.pl.repositories.map(&:id)}
|
p.include_repos {|bl| bl.pl.repositories.map(&:id)}
|
||||||
p.commit_hash 'e681644ed702fae285483d2ca73d85ee2930b8de'
|
p.commit_hash '1234567890abcdef1234567890abcdef12345678'
|
||||||
end
|
end
|
||||||
|
|
||||||
Factory.define(:build_list_core, :parent => :build_list) do |p|
|
Factory.define(:build_list_core, :parent => :build_list) do |p|
|
||||||
|
|
Loading…
Reference in New Issue