blob: 7f52636b4d65c9014d6e9901e6f2182c5e9d0b0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
require_relative 'app'
task default: 'test'
desc 'Run the test suite'
task :test do
Dir.glob('./test/test_*.rb') { |f| require f }
end
desc 'Run : update_packages => run_ci_untested => update_ci => run_repoman => update_repoman'
task :nightly do
Rake::Task['db:update_packages'].invoke
Rake::Task['docker:setup'].invoke
Rake::Task['docker:run_ci_untested'].invoke
Rake::Task['db:update_ci'].invoke
Rake::Task['docker:run_repoman_all'].invoke
Rake::Task['db:update_repoman'].invoke
Rake::Task['docker:teardown'].invoke
end
namespace :db do
DB.loggers << Logger.new($stdout)
task :migrate do
Sequel.extension :migration
Sequel::Migrator.run(DB, 'db/migrations')
end
desc 'Update the packages database with new versions and targets'
task :update_packages do
update_packages
end
desc 'Update the build database with logfiles from ci-logs/'
task :update_ci do
update_ci
end
desc 'Clear the build database'
task :clear_ci do
clear_ci
end
desc 'Update the repoman database with logfiles from repo-logs/'
task :update_repoman do
update_repoman
end
desc 'Clear the repoman database'
task :clear_repoman do
clear_repoman
end
end
namespace :docker do
num_of_packages = ENV['NUM_OF_PACKAGES'].to_i
num_of_packages = 5 if num_of_packages == 0
desc 'Build a docker image to use with subsequent tasks'
task :setup do
Docker.options[:read_timeout] = 36_000
Docker.options[:write_timeout] = 36_000
@volume_image = Docker::Image.build('FROM busybox')
@volume_container = Docker::Container.create(
Image: @volume_image.id,
Volumes: {
'/usr/portage/packages' => {
'/usr/portage/packages' => 'rw'
}
}
)
@volume_container.start
@volume_container.wait(36_000)
docker_path = File.dirname(File.expand_path(File.dirname(__FILE__)))
@ci_image = Docker::Image.build_from_dir(docker_path)
end
desc 'Remove a previously built docker image'
task :teardown do
@ci_image.delete
@volume_container.delete(v: 1)
@volume_image.delete
end
desc 'Build and test all packages'
task :run_ci_all do
run_ci(@volume_container, @ci_image, :all)
end
desc 'Build and test a fixed number of packages (NUM_OF_PACKAGES=5)'
task :run_ci_some do
run_ci(@volume_container, @ci_image, num_of_packages)
end
desc 'Build and test all untested packages and their reverse dependencies'
task :run_ci_untested do
run_ci(@volume_container, @ci_image, :untested)
end
desc 'QA test all packages'
task :run_repoman_all do
run_repoman(@ci_image, :all)
end
desc 'QA test a fixed number of packages (NUM_OF_PACKAGES=5)'
task :run_repoman_some do
run_repoman(@ci_image, num_of_packages)
end
end
|