diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/Rakefile | 17 | ||||
-rw-r--r-- | web/lib/ci.rb | 2 | ||||
-rw-r--r-- | web/lib/repoman.rb | 8 |
3 files changed, 19 insertions, 8 deletions
diff --git a/web/Rakefile b/web/Rakefile index 0140c84..86aa390 100644 --- a/web/Rakefile +++ b/web/Rakefile @@ -53,6 +53,9 @@ namespace :db do 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 @@ -71,8 +74,7 @@ namespace :docker do run_ci(@docker_image, :all) end - desc 'Build and test a fixed number of packages (num_of_packages=5)' - num_of_packages = ENV['num_of_packages'].to_i + desc 'Build and test a fixed number of packages (NUM_OF_PACKAGES=5)' task :run_ci_some do run_ci(@docker_image, num_of_packages) end @@ -82,8 +84,13 @@ namespace :docker do run_ci(@docker_image, :untested) end - desc 'Run repoman against the current and next targets for all packages' - task :run_repoman do - run_repoman(@docker_image) + desc 'QA test all packages' + task :run_repoman_all do + run_repoman(@docker_image, :all) + end + + desc 'QA test a fixed number of packages (NUM_OF_PACKAGES=5)' + task :run_repoman_some do + run_repoman(@docker_image, num_of_packages) end end diff --git a/web/lib/ci.rb b/web/lib/ci.rb index 153cc2f..300ba53 100644 --- a/web/lib/ci.rb +++ b/web/lib/ci.rb @@ -6,8 +6,6 @@ def run_ci(docker_image, num_of_packages) if num_of_packages == :all packages = packages - elsif num_of_packages == 0 - packages = packages.sample(5) elsif num_of_packages == :untested packages = [] Package.exclude(tested: true).order { [category, lower(name), version] }.each do |package| diff --git a/web/lib/repoman.rb b/web/lib/repoman.rb index ae512fd..6808340 100644 --- a/web/lib/repoman.rb +++ b/web/lib/repoman.rb @@ -1,4 +1,4 @@ -def run_repoman(docker_image) +def run_repoman(docker_image, num_of_packages) packages = [] Package.order { [category, lower(name), version] }.each do |package| target = '' @@ -22,6 +22,12 @@ def run_repoman(docker_image) packages << "#{category} #{name} #{version}#{revision} #{target} #{next_target}" end + if num_of_packages == :all + packages = packages + else + packages = packages.sample(num_of_packages) + end + packages = packages.uniq packages.each do |package| package = "'" + package + "'" |