diff options
author | Peter Wilmott <p@p8952.info> | 2015-03-21 19:14:59 +0000 |
---|---|---|
committer | Peter Wilmott <p@p8952.info> | 2015-03-21 19:14:59 +0000 |
commit | a3f5c572716a481b7dcc0f9dcc45179a5b00bc02 (patch) | |
tree | ed7443edfb96afc14b476701aa1348159ddc0b92 | |
parent | Change the format used to store log files on disk. (diff) | |
download | ruby-tinderbox-a3f5c572716a481b7dcc0f9dcc45179a5b00bc02.tar.gz ruby-tinderbox-a3f5c572716a481b7dcc0f9dcc45179a5b00bc02.tar.bz2 ruby-tinderbox-a3f5c572716a481b7dcc0f9dcc45179a5b00bc02.zip |
Bring build scripts and web interface inline with 7266717147d
In addition to brining the build scripts inline with
7266717147d7998b86386f3e73667f0460b2a57a this change also removes the
"Passed / Passed" format from the repoman page.
This is to bring it inline with the style of the builds page and prepare
for the new layout of hypothetical packages.
27 files changed, 256 insertions, 320 deletions
@@ -1,3 +1,4 @@ gentoo-x86/ ruby-overlay/ web/.bundle/ +web/old-logs/ diff --git a/bin/repoman.sh b/bin/repoman.sh index 060d48e..25d36b1 100755 --- a/bin/repoman.sh +++ b/bin/repoman.sh @@ -21,12 +21,10 @@ function REPOMAN() { repoman scan || true repoman manifest repoman full > /tmp/repoman_log_current || true - echo $? > /tmp/repoman_result_current sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild" repoman manifest repoman full > /tmp/repoman_log_next || true - echo $? > /tmp/repoman_result_next LOG } @@ -38,18 +36,14 @@ function LOG() { mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE" cp /tmp/repoman_log_current "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE/repoman_log" - cp /tmp/repoman_result_current "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE/repoman_result" cp /tmp/repoman_log_next "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE/repoman_log" - cp /tmp/repoman_result_next "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE/repoman_result" chmod 755 -R "$SCRIPT_DIR/ci-logs" } function CLEANUP() { rm /tmp/repoman_log_current - rm /tmp/repoman_result_current rm /tmp/repoman_log_next - rm /tmp/repoman_result_next rm -r "$SCRIPT_DIR/overlay" } diff --git a/bin/tinder.sh b/bin/tinder.sh index eb6d383..4116fa8 100755 --- a/bin/tinder.sh +++ b/bin/tinder.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -o errexit -o nounset -o pipefail -[[ $(whoami) == 'root' ]] || exit 1 +[[ $(whoami) == "root" ]] || exit 1 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" function ENV_SETUP() { @@ -55,16 +55,16 @@ function LOG() { if [[ $1 == 0 ]]; then RESULT="\e[0;32mBUILD SUCCEEDED\e[0m" - touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/succeeded" + echo "succeeded" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/result" elif [[ $1 == 1 ]]; then RESULT="\e[0;31mBUILD FAILED\e[0m" - touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/failed" + echo "failed" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/result" elif [[ $1 == 124 ]]; then RESULT="\e[0;31mBUILD TIMED OUT\e[0m" - touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/timedout" + echo "timed out" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/result" else RESULT="\e[0;31mBUILD UNKNOWN\e[0m" - touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/unknown" + echo "unknown" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/result" fi chmod 755 -R "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE" @@ -82,20 +82,20 @@ ENV_SETUP PKG_ARR=($(qatom $1)) CATEGORY="${PKG_ARR[0]}" NAME="${PKG_ARR[1]}" -if [[ ${PKG_ARR[3]:=foo} == 'foo' ]]; then +if [[ ${PKG_ARR[3]:=foo} == "foo" ]]; then VERSION="${PKG_ARR[2]}" else VERSION="${PKG_ARR[2]}-${PKG_ARR[3]}" fi if [[ $# -eq 1 ]]; then - TYPE='current_target' + TYPE="current_target" PACKAGE=$1 SETUP EMERGE CLEANUP elif [[ $# -eq 3 ]]; then - TYPE='next_target' + TYPE="next_target" PACKAGE=$1 CURR_TARGET=$2 NEXT_TARGET=$3 diff --git a/web/Rakefile b/web/Rakefile index 7f52636..27525e0 100644 --- a/web/Rakefile +++ b/web/Rakefile @@ -7,17 +7,6 @@ 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) @@ -53,8 +42,11 @@ 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 + num_of_packages = ENV['NUM_OF_PACKAGES'] + begin + num_of_packages = Integer(num_of_packages) + rescue + end desc 'Build a docker image to use with subsequent tasks' task :setup do @@ -84,28 +76,13 @@ namespace :docker do @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 + desc 'Build test packages ( NUM_OF_PACKAGES={5,all,untested} )' + task :run_build 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 + desc 'QA test packages ( NUM_OF_PACKAGES={5,all} )' + task :run_repoman do run_repoman(@ci_image, num_of_packages) end end @@ -22,61 +22,61 @@ class RubyTinderbox < Sinatra::Base get '/ruby_targets' do update_timestamp = Package.first[:update_timestamp] portage_timestamp = Package.first[:portage_timestamp] - packages = Package.order { [category, lower(name), version, revision] }.to_hash_groups(:identifier) - erb :ruby_targets, locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + packages = Package.distinct(:sha1, :identifier).order(:identifier) + erb :'package/ruby_targets', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } end get '/outdated_gems' do update_timestamp = Package.first[:update_timestamp] portage_timestamp = Package.first[:portage_timestamp] packages = Package.distinct(:category, :name).order(:category, :name, Sequel.desc(:version), Sequel.desc(:revision)).exclude(gem_version: 'nil') - erb :outdated_gems, locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + erb :'package/outdated_gems', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } end get '/build_status' do - update_timestamp = Build.order(:time).last[:time] + update_timestamp = Build.order(:timestamp).last[:timestamp] portage_timestamp = Package.first[:portage_timestamp] - builds = Build.distinct(:package_id).order(:package_id, Sequel.desc(:time)) - erb :build_status, locals: { builds: builds, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + builds = [] + Package.each do |package| + builds << package.build_dataset.where(target: 'current').reverse_order(:timestamp).first + end + builds = builds.compact.sort_by { |build| build.package[:identifier] } + erb :'build/build_status', locals: { builds: builds, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } end - get '/build_history/:category/:package' do - builds = Build.where(package_id: params[:category] + '/' + params[:package]).reverse_order(:time) - erb :build_history, locals: { builds: builds } + get '/build_logs/:sha1/:timestamp' do + package = Package.where(sha1: params[:sha1]).first + build = package.build_dataset.where(timestamp: params[:timestamp]).first + erb :'build/build_logs', locals: { package: package, build: build } end - get '/build_logs/:category/:package/:time' do - build = Build.where(package_id: params[:category] + '/' + params[:package], time: params[:time]).first - erb :build_logs, locals: { build: build } + get '/build_history/:sha1' do + package = Package.where(sha1: params[:sha1]).first + builds = package.build_dataset.where(target: 'current').reverse_order(:timestamp) + erb :'build/build_history', locals: { builds: builds } end get '/repoman_checks' do - update_timestamp = Repoman.order(:time).last[:time] + update_timestamp = Build.order(:timestamp).last[:timestamp] portage_timestamp = Package.first[:portage_timestamp] - repomans = Repoman.distinct(:package_id).order(:package_id, Sequel.desc(:time)) - erb :repoman_checks, locals: { repomans: repomans, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + repomans = [] + Package.each do |package| + repomans << package.repoman_dataset.where(target: 'current').reverse_order(:timestamp).first + end + repomans = repomans.compact.sort_by { |repoman| repoman.package[:identifier] } + erb :'repoman/repoman_checks', locals: { repomans: repomans, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } end - get '/repoman_logs/:category/:package/:time' do - repomans = Repoman.where(package_id: params[:category] + '/' + params[:package], time: params[:time]).first - erb :repoman_logs, locals: { repomans: repomans } + get '/repoman_logs/:sha1/:timestamp' do + package = Package.where(sha1: params[:sha1]).first + repoman = package.repoman_dataset.where(timestamp: params[:timestamp]).first + erb :'repoman/repoman_logs', locals: { package: package, repoman: repoman } end - get '/repoman_history/:category/:package' do - repomans = Repoman.where(package_id: params[:category] + '/' + params[:package]).reverse_order(:time) - erb :repoman_history, locals: { repomans: repomans } - end - - get '/new_targets' do - erb :new_targets - end - - get '/new_versions' do - erb :new_versions - end - - get '/new_keywords' do - erb :new_keywords + get '/repoman_history/:sha1' do + package = Package.where(sha1: params[:sha1]).first + repomans = package.repoman_dataset.where(target: 'current').reverse_order(:timestamp) + erb :'repoman/repoman_history', locals: { repomans: repomans } end get '/visualizations' do @@ -101,11 +101,11 @@ class RubyTinderbox < Sinatra::Base Package.distinct(:category, :name).reverse_order(:category, :name, :version).exclude(gem_version: 'nil').each { |p| outdated << p if p[:version] < p[:gem_version] } # Build Status - succeeded = Build.distinct(:package_id).order(:package_id, Sequel.desc(:time)).where(result: 'succeeded').count - failed = Build.distinct(:package_id).order(:package_id, Sequel.desc(:time)).where(result: 'failed').count - timed_out = Build.distinct(:package_id).order(:package_id, Sequel.desc(:time)).where(result: 'timed out').count + succeeded = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "succeeded\n").count + failed = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "failed\n").count + timed_out = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "timed out\n").count - erb :visualizations, locals: { + erb :'overview/visualizations', locals: { portage_timestamp: portage_timestamp, update_timestamp: update_timestamp, ruby_1_9_amd64: ruby_1_9_amd64, diff --git a/web/db/migrations/018_new_targets.rb b/web/db/migrations/018_new_targets.rb new file mode 100644 index 0000000..b04ccac --- /dev/null +++ b/web/db/migrations/018_new_targets.rb @@ -0,0 +1,22 @@ +Sequel.migration do + change do + add_column :packages, :sha1, String + add_column :builds, :target, String + add_column :repomans, :target, String + rename_column :builds, :time, :timestamp + rename_column :repomans, :time, :timestamp + rename_column :repomans, :current_result, :result + rename_column :repomans, :current_log, :log + drop_column :repomans, :next_result + drop_column :repomans, :next_log + drop_column :builds, :package_id + drop_column :repomans, :package_id + alter_table(:builds) do + add_foreign_key :package_id, :packages + end + alter_table(:repomans) do + add_foreign_key :package_id, :packages + end + end + +end diff --git a/web/lib/ci.rb b/web/lib/ci.rb index 3805b90..13e7ac0 100644 --- a/web/lib/ci.rb +++ b/web/lib/ci.rb @@ -1,22 +1,22 @@ def run_ci(volume_container, ci_image, num_of_packages) packages = [] - Package.order { [category, lower(name), version] }.each do |package| + Package.each do |package| packages << package[:identifier] end - if num_of_packages == :all + if num_of_packages == 'all' packages = packages - elsif num_of_packages == :untested + elsif num_of_packages == 'untested' packages = [] - Package.exclude(tested: true).order { [category, lower(name), version] }.each do |package| + Package.each do |package| + next if package.build.count > 0 + next if "#{package[:category]}/#{package[:name]}" == 'virtual/rubygems' + next if "#{package[:category]}/#{package[:name]}" == 'dev-ruby/rake' + next if "#{package[:category]}/#{package[:name]}" == 'dev-ruby/rspec' + next if "#{package[:category]}/#{package[:name]}" == 'dev-ruby/rspec-core' + next if "#{package[:category]}/#{package[:name]}" == 'dev-ruby/rdoc' + packages << package[:identifier] - next if [ - 'virtual/rubygems', - 'dev-ruby/rake', - 'dev-ruby/rspec', - 'dev-ruby/rspec-core', - 'dev-ruby/rdoc' - ].include?("#{package[:category]}/#{package[:name]}") Package.where(Sequel.like( :dependencies, "#{package[:category]}/#{package[:name]} %", @@ -26,8 +26,11 @@ def run_ci(volume_container, ci_image, num_of_packages) packages << rdep[:identifier] end end - else + elsif num_of_packages.is_a?(Integer) packages = packages.sample(num_of_packages) + else + puts 'ERROR: Invalid value for NUM_OF_PACKAGES' + exit end packages = packages.uniq @@ -54,37 +57,37 @@ def run_ci(volume_container, ci_image, num_of_packages) end def update_ci - Dir.glob('ci-logs/*/*/*') do |build| - build_array = build.split('/') - package_id = "#{build_array[1]}/#{build_array[2]}" - time = build_array[3] - - if File.exist?("#{build}/succeeded") - result = 'succeeded' - elsif File.exist?("#{build}/failed") - result = 'failed' - elsif File.exist?("#{build}/timedout") - result = 'timed out' - end + Dir.glob('ci-logs/*/*/builds/*') do |build| + begin + build_array = build.split('/') + sha1 = build_array[1] + timestamp = build_array[4] + target = build_array[2].sub('_target', '') - emerge_info = File.read("#{build}/emerge-info") if File.exist?("#{build}/emerge-info") - emerge_pqv = File.read("#{build}/emerge-pqv") if File.exist?("#{build}/emerge-pqv") - build_log = File.read("#{build}/build.log") if File.exist?("#{build}/build.log") - gem_list = File.read("#{build}/gem-list") if File.exist?("#{build}/gem-list") + result = File.read("#{build}/result") + emerge_info = File.read("#{build}/emerge-info") if File.exist?("#{build}/emerge-info") + emerge_pqv = File.read("#{build}/emerge-pqv") if File.exist?("#{build}/emerge-pqv") + build_log = File.read("#{build}/build.log") if File.exist?("#{build}/build.log") + gem_list = File.read("#{build}/gem-list") if File.exist?("#{build}/gem-list") - Build.find_or_create( - package_id: package_id, - time: time, - result: result, - emerge_info: emerge_info, - emerge_pqv: emerge_pqv, - build_log: build_log, - gem_list: gem_list - ) - end - - Build.each do |build| - Package.where(identifier: build[:package_id]).update(tested: true) + package = Package.where(sha1: sha1).first + unless package.nil? + package.add_build( + Build.find_or_create( + timestamp: timestamp, + target: target, + result: result, + emerge_info: emerge_info, + emerge_pqv: emerge_pqv, + build_log: build_log, + gem_list: gem_list + ) + ) + end + rescue => e + puts "ERROR: #{e}" + next + end end end diff --git a/web/lib/models.rb b/web/lib/models.rb index 667e54f..68e0127 100644 --- a/web/lib/models.rb +++ b/web/lib/models.rb @@ -1,10 +1,14 @@ DB = Sequel.connect(ENV['DATABASE_URL'], max_connections: 12, pool_timeout: 60) class Package < Sequel::Model + one_to_many :build + one_to_many :repoman end class Build < Sequel::Model + many_to_one :package end class Repoman < Sequel::Model(:repomans) + many_to_one :package end diff --git a/web/lib/packages.rb b/web/lib/packages.rb index e703b26..eb62883 100644 --- a/web/lib/packages.rb +++ b/web/lib/packages.rb @@ -5,21 +5,22 @@ def update_packages identifier = category + '/' + name + '-' + version + (revision == 'r0' ? '' : "-#{revision}") gem_version = Gems.info(name)['version'] gem_version = 'nil' if gem_version.nil? - # ebuild = "/usr/portage/#{category}/#{name}/#{identifier.split('/')[1]}.ebuild" - # ebuild_hash = Digest::MD5.hexdigest(File.read(ebuild)) + ebuild = "/usr/portage/#{category}/#{name}/#{identifier.split('/')[1]}.ebuild" + sha1 = Digest::SHA1.hexdigest(File.read(ebuild)) Package.find_or_create( + sha1: sha1, category: category, name: name, version: version, revision: revision, slot: slot, - amd64_keyword: amd64_keyword, identifier: identifier, - gem_version: gem_version, + amd64_keyword: amd64_keyword, r19_target: r19_target, r20_target: r20_target, r21_target: r21_target, - r22_target: r22_target + r22_target: r22_target, + gem_version: gem_version ) end @@ -27,6 +28,8 @@ def update_packages if packages_txt.include?("#{package[:category]} #{package[:name]} #{package[:version]} #{package[:revision]} #{package[:slot]} #{package[:amd64_keyword]} #{package[:r19_target]} #{package[:r20_target]} #{package[:r21_target]} #{package[:r22_target]}") package.update(dependencies: `python3 lib/deps.py #{package[:identifier]}`) else + package.build.map(&:delete) + package.repoman.map(&:delete) package.delete end end diff --git a/web/lib/repoman.rb b/web/lib/repoman.rb index 1185d2a..1a44177 100644 --- a/web/lib/repoman.rb +++ b/web/lib/repoman.rb @@ -1,6 +1,6 @@ def run_repoman(ci_image, num_of_packages) packages = [] - Package.order { [category, lower(name), version] }.each do |package| + Package.each do |package| target = '' target = package[:r19_target] unless package[:r19_target] == 'nil' target = package[:r20_target] unless package[:r20_target] == 'nil' @@ -14,24 +14,26 @@ def run_repoman(ci_image, num_of_packages) next_target = 'ruby22' if target == 'ruby21' next if next_target.empty? - category = package[:category] - name = package[:name] - version = package[:version] - revision = package[:revision] == 'r0' ? '' : "-#{package[:revision]}" - - packages << "#{category} #{name} #{version}#{revision} #{target} #{next_target}" + packages << "#{package[:identifier]} #{target} #{next_target}" end - if num_of_packages == :all + if num_of_packages == 'all' packages = packages - else + elsif num_of_packages.is_a?(Integer) packages = packages.sample(num_of_packages) + else + puts 'ERROR: Invalid value for NUM_OF_PACKAGES' + exit end packages = packages.uniq packages.peach(8) do |package| + package = package.split(' ') + identifier = package[0] + current_target = package[1] + next_target = package[2] ci_container = Docker::Container.create( - Cmd: %W[/ruby-tinderbox/repoman.sh #{package}], + Cmd: %W[/ruby-tinderbox/repoman.sh #{identifier} #{current_target} #{next_target}], Image: ci_image.id ) ci_container.start @@ -39,7 +41,7 @@ def run_repoman(ci_image, num_of_packages) tar = Tempfile.new('tar') File.open(tar, 'w') do |file| - ci_container.copy('/ruby-tinderbox/repo-logs') do |chunk| + ci_container.copy('/ruby-tinderbox/ci-logs') do |chunk| file.write(chunk) end end @@ -52,59 +54,34 @@ def run_repoman(ci_image, num_of_packages) end def update_repoman - Dir.glob('repo-logs/*/*/*') do |repoman| - repoman_array = repoman.split('/') - package_id = "#{repoman_array[1]}/#{repoman_array[2]}" - time = repoman_array[3] + Dir.glob('ci-logs/*/*/repomans/*') do |repoman| + begin + repoman_array = repoman.split('/') + sha1 = repoman_array[1] + timestamp = repoman_array[4] + target = repoman_array[2].sub('_target', '') - current_log = File.read("#{repoman}/current.txt") if File.exist?("#{repoman}/current.txt") - next_log = File.read("#{repoman}/next.txt") if File.exist?("#{repoman}/next.txt") + log = File.read("#{repoman}/repoman_log") - current_result = 'unknown' - if current_log.include?('If everyone were like you, I\'d be out of business!') - current_result = 'passed' - elsif current_log.include?('You\'re only giving me a partial QA payment?') - current_result = 'partial' - elsif current_log.include?('Make your QA payment on time and you\'ll never see the likes of me.') - current_result = 'failed' - end - - next_result = 'unknown' - if next_log.include?('If everyone were like you, I\'d be out of business!') - next_result = 'passed' - elsif next_log.include?('You\'re only giving me a partial QA payment?') - next_result = 'partial' - elsif next_log.include?('Make your QA payment on time and you\'ll never see the likes of me.') - next_result = 'failed' - end - - Repoman.find_or_create( - package_id: package_id, - time: time, - current_result: current_result, - current_log: current_log, - next_result: next_result, - next_log: next_log - ) - end - - Package.order { [category, lower(name), version] }.each do |package| - target = '' - target = package[:r19_target] unless package[:r19_target] == 'nil' - target = package[:r20_target] unless package[:r20_target] == 'nil' - target = package[:r21_target] unless package[:r21_target] == 'nil' - target = package[:r22_target] unless package[:r22_target] == 'nil' - if target.empty? - Repoman.where(package_id: package[:identifier]).delete - next - end + result = 'unknown' + if log.include?('If everyone were like you, I\'d be out of business!') + result = 'passed' + elsif log.include?('You\'re only giving me a partial QA payment?') + result = 'partial' + elsif log.include?('Make your QA payment on time and you\'ll never see the likes of me.') + result = 'failed' + end - next_target = '' - next_target = 'ruby20' if target == 'ruby19' - next_target = 'ruby21' if target == 'ruby20' - next_target = 'ruby22' if target == 'ruby21' - if next_target.empty? - Repoman.where(package_id: package[:identifier]).delete + Package.where(sha1: sha1).first.add_repoman( + Repoman.find_or_create( + timestamp: timestamp, + target: target, + result: result, + log: log + ) + ) + rescue => e + puts "ERROR: #{e}" next end end diff --git a/web/repo-logs/.gitignore b/web/repo-logs/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/web/repo-logs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/web/views/build/build_history.erb b/web/views/build/build_history.erb new file mode 100644 index 0000000..f6af24a --- /dev/null +++ b/web/views/build/build_history.erb @@ -0,0 +1,20 @@ +<h1 class="text-center"><%=builds.first.package[:identifier]%></h1> + +<table id="sortable" class="table table-bordered table-condensed"> + <thead> + <tr> + <th class="width-50">Build Date</th> + <th class="width-50">Build Result</th> + </tr> + </thead> + <%builds.each do |build|%> + <tr> + <td class="width-50"> + <%=Time.at(build[:timestamp].to_i).strftime('%Y-%m-%d')%> + </td> + <td class="width-50 <%=build[:result]%>"> + <a href="/build_logs/<%=build.package[:sha1]%>/<%=build[:timestamp]%>"><%=build[:result].camelcase%></a> + </td> + </tr> + <%end%> +</table> diff --git a/web/views/build_logs.erb b/web/views/build/build_logs.erb index 547b205..fb5bf3d 100644 --- a/web/views/build_logs.erb +++ b/web/views/build/build_logs.erb @@ -1,6 +1,6 @@ <div class="text-center"> - <h1><%=build[:package_id]%></h1> - <h3><%=Time.at(build[:time].to_i).strftime('%Y-%m-%d')%></h3> + <h1><%=package[:identifier]%></h1> + <h3><%=Time.at(build[:timestamp].to_i).strftime('%Y-%m-%d')%></h3> <div class="btn-group btn-group-justified"> <a class="btn btn-default <%="disabled" if build[:emerge_info].nil?%>" href="#emerge_info">Emerge Info</a> <a class="btn btn-default <%="disabled" if build[:emerge_pqv].nil?%>" href="#emerge_pqv">Emerge PQV</a> diff --git a/web/views/build_status.erb b/web/views/build/build_status.erb index 13d7434..04ab1d8 100644 --- a/web/views/build_status.erb +++ b/web/views/build/build_status.erb @@ -23,26 +23,22 @@ </tr> </thead> <%builds.each do |build|%> - <%package = Package.where(identifier: build[:package_id]).first%> - <%next if package.nil?%> - <%result = 'success' if build[:result] == 'succeeded'%> - <%result = 'info' if build[:result] == 'timed out'%> - <%result = 'danger' if build[:result] == 'failed'%> + <%next if build.nil?%> <tr> <td class="width-52"> - <%=build[:package_id]%> + <%=build.package[:identifier]%> </td> <td class="width-14"> - <%=Time.at(build[:time].to_i).strftime('%Y-%m-%d')%> + <%=Time.at(build[:timestamp].to_i).strftime('%Y-%m-%d')%> </td> - <td class="width-17 <%=result%>"> - <a href="/build_logs/<%=build[:package_id]%>/<%=build[:time]%>"><%=build[:result].camelcase%></a> + <td class="width-17 <%=build[:result]%>"> + <a href="/build_logs/<%=build.package[:sha1]%>/<%=build[:timestamp]%>"><%=build[:result].camelcase%></a> </td> <td class="width-17"> - <a href="/build_history/<%=build[:package_id]%>"><%=Build.where(package_id: build[:package_id]).count%> Build(s)</a> + <a href="/build_history/<%=build.package[:sha1]%>"><%=build.package.build_dataset.where(target: 'current').count%> Build(s)</a> </td> <td style="display:none;"> - +<%=package[:amd64_keyword]%> + +<%=build.package[:amd64_keyword]%> </td> </tr> <%end%> diff --git a/web/views/build_history.erb b/web/views/build_history.erb deleted file mode 100644 index fde2445..0000000 --- a/web/views/build_history.erb +++ /dev/null @@ -1,24 +0,0 @@ -<h1 class="text-center"><%=builds.first[:package_id]%></h1> - -<table id="sortable" class="table table-bordered table-condensed"> - <thead> - <tr> - <th class="width-50">Build Date</th> - <th class="width-50">Build Result</th> - </tr> - </thead> - <%builds.each do |build|%> - <%next if build.nil?%> - <%result = 'success' if build[:result] == 'succeeded'%> - <%result = 'info' if build[:result] == 'timed out'%> - <%result = 'danger' if build[:result] == 'failed'%> - <tr> - <td class="width-50"> - <%=Time.at(build[:time].to_i).strftime('%Y-%m-%d')%> - </td> - <td class="width-50 <%=result%>"> - <a href="/build_logs/<%=build[:package_id]%>/<%=build[:time]%>"><%=build[:result].camelcase%></a> - </td> - </tr> - <%end%> -</table> diff --git a/web/views/layout.erb b/web/views/layout.erb index bf747d6..98d60ec 100644 --- a/web/views/layout.erb +++ b/web/views/layout.erb @@ -11,7 +11,7 @@ <script src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/jquery.min.js"></script> <script src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/bootstrap.min.js"></script> <script src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/retina.min.js"></script> -<script src='/js/tablesort.min.js'></script> +<script src="/js/tablesort.min.js"></script> <link rel="icon" href="http://www.gentoo.org/favicon.ico" type="image/x-icon"> </head> <body> @@ -34,7 +34,7 @@ <li><a href="http://packages.gentoo.org/" title="Find software for your Gentoo"><span class="fa fa-hdd-o fa-fw"></span> Packages</a></li> <li class="divider"></li> <li><a href="http://overlays.gentoo.org/" title="Collaborate on maintaining packages"><span class="fa fa-code-fork fa-fw"></span> Overlays</a></li> - <li><a href="http://planet.gentoo.org/" title="Find out what's going on in the developer community"><span class="fa fa-rss fa-fw"></span> Planet</a></li> + <li><a href="http://planet.gentoo.org/" title="Find out what"s going on in the developer community"><span class="fa fa-rss fa-fw"></span> Planet</a></li> <li><a href="http://archives.gentoo.org/" title="Read up on past discussions"><span class="fa fa-archive fa-fw"></span> Archives</a></li> <li><a href="http://sources.gentoo.org/" title="Browse our source code"><span class="fa fa-code fa-fw"></span> Sources</a></li> <li class="divider"></li> @@ -67,13 +67,6 @@ <li><a href="/outdated_gems">Outdated Gems</a></li> <li><a href="/build_status">Build Status (CI)</a></li> <li><a href="/repoman_checks">Repoman Checks (QA)</a></li> - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">Package Bumps <span class="caret"></span></a> - <ul class="dropdown-menu" role="menu"> - <li><a href="/new_targets">New Targets</a></li> - <li><a href="/new_versions">New Versions</a></li> - <li><a href="/new_keywords">New Keywords</a></li> - </ul> <li><a href="/visualizations">Visualizations</a></li> </li> @@ -108,7 +101,17 @@ </div> </footer> <script> -new Tablesort(document.getElementById("sortable")); +$(document).ready(function() { + new Tablesort(document.getElementById("sortable"), { + descending: true + }); +}); +$(".succeeded").addClass("success"); +$(".passed").addClass("success"); +$(".timed").addClass("info"); +$(".partial").addClass("info"); +$(".unknown").addClass("warning"); +$(".failed").addClass("danger"); </script> </body> </html> diff --git a/web/views/new_keywords.erb b/web/views/new_keywords.erb deleted file mode 100644 index 9f96c63..0000000 --- a/web/views/new_keywords.erb +++ /dev/null @@ -1,4 +0,0 @@ -<div id="new_keywords"> - <h1>New Keywords</h1> -</div> -<h2>This page is a work in progress</h2> diff --git a/web/views/new_targets.erb b/web/views/new_targets.erb deleted file mode 100644 index 8ae1218..0000000 --- a/web/views/new_targets.erb +++ /dev/null @@ -1,4 +0,0 @@ -<div id="new_targets"> - <h1>New Targets</h1> -</div> -<h2>This page is a work in progress</h2> diff --git a/web/views/new_versions.erb b/web/views/new_versions.erb deleted file mode 100644 index 0477f38..0000000 --- a/web/views/new_versions.erb +++ /dev/null @@ -1,4 +0,0 @@ -<div id="new_versions"> - <h1>New Versions</h1> -</div> -<h2>This page is a work in progress</h2> diff --git a/web/views/visualizations.erb b/web/views/overview/visualizations.erb index 9b22e6e..9b22e6e 100644 --- a/web/views/visualizations.erb +++ b/web/views/overview/visualizations.erb diff --git a/web/views/outdated_gems.erb b/web/views/package/outdated_gems.erb index fc298a9..fc298a9 100644 --- a/web/views/outdated_gems.erb +++ b/web/views/package/outdated_gems.erb diff --git a/web/views/ruby_targets.erb b/web/views/package/ruby_targets.erb index 5db7a13..fcd54fc 100644 --- a/web/views/ruby_targets.erb +++ b/web/views/package/ruby_targets.erb @@ -24,7 +24,6 @@ </tr> </thead> <%packages.each do |package|%> - <%package = package[1][0]%> <tr> <td class="width-52"> <%=package[:identifier]%> diff --git a/web/views/repoman_checks.erb b/web/views/repoman/repoman_checks.erb index 01de59d..a8ffc34 100644 --- a/web/views/repoman_checks.erb +++ b/web/views/repoman/repoman_checks.erb @@ -23,27 +23,22 @@ </tr> </thead> <%repomans.each do |repoman|%> - <%package = Package.where(identifier: repoman[:package_id]).first%> - <%next if package.nil?%> - <%result = 'info'%> - <%result = 'success' if repoman[:next_result] == 'passed'%> - <%result = 'danger' if repoman[:current_result] == 'failed'%> - <%result = 'danger' if repoman[:current_result] == 'partial'%> + <%next if repoman.nil?%> <tr> <td class="width-52"> - <%=repoman[:package_id]%> + <%=repoman.package[:identifier]%> </td> <td class="width-14"> - <%=Time.at(repoman[:time].to_i).strftime('%Y-%m-%d')%> + <%=Time.at(repoman[:timestamp].to_i).strftime('%Y-%m-%d')%> </td> - <td class="width-17 <%=result%>"> - <a href="/repoman_logs/<%=repoman[:package_id]%>/<%=repoman[:time]%>"><%=repoman[:current_result].camelcase%> / <%=repoman[:next_result].camelcase%></a> + <td class="width-17 <%=repoman[:result]%>"> + <a href="/repoman_logs/<%=repoman.package[:sha1]%>/<%=repoman[:timestamp]%>"><%=repoman[:result].camelcase%></a> </td> <td class="width-17"> - <a href="/repoman_history/<%=repoman[:package_id]%>"><%=Repoman.where(package_id: repoman[:package_id]).count%> Check(s)</a> + <a href="/repoman_history/<%=repoman.package[:sha1]%>"><%=repoman.package.repoman_dataset.where(target: 'current').count%> Checks(s)</a> </td> <td style="display:none;"> - +<%=package[:amd64_keyword]%> + +<%=repoman.package[:amd64_keyword]%> </td> </tr> <%end%> diff --git a/web/views/repoman/repoman_history.erb b/web/views/repoman/repoman_history.erb new file mode 100644 index 0000000..bc26cd8 --- /dev/null +++ b/web/views/repoman/repoman_history.erb @@ -0,0 +1,20 @@ +<h1 class="text-center"><%=repomans.first.package[:identifier]%></h1> + +<table id="sortable" class="table table-bordered table-condensed"> + <thead> + <tr> + <th class="width-50">Check Date</th> + <th class="width-5o">Check Result</th> + </tr> + </thead> + <%repomans.each do |repoman|%> + <tr> + <td class="width-50"> + <%=Time.at(repoman[:timestamp].to_i).strftime('%Y-%m-%d')%> + </td> + <td class="width-50 <%=repoman[:result]%>"> + <a href="/repoman_logs/<%=repoman.package[:sha1]%>/<%=repoman[:timestamp]%>"><%=repoman[:result].camelcase%></a> + </td> + </tr> + <%end%> +</table> diff --git a/web/views/repoman/repoman_logs.erb b/web/views/repoman/repoman_logs.erb new file mode 100644 index 0000000..52faecc --- /dev/null +++ b/web/views/repoman/repoman_logs.erb @@ -0,0 +1,16 @@ +<div class="text-center"> + <h1><%=package[:identifier]%></h1> + <h3><%=Time.at(repoman[:timestamp].to_i).strftime('%Y-%m-%d')%></h3> +</div> +<br> + +<%unless repoman[:log].nil?%> +<div class="panel panel-default"> + <div class="panel-heading"> + <h4><a name="current_log">Repoman Full</a></h4> + </div> + <div class="panel-body"> + <pre><%=repoman[:log]%></pre> + </div> +</div> +<%end%> diff --git a/web/views/repoman_history.erb b/web/views/repoman_history.erb deleted file mode 100644 index 50c8a65..0000000 --- a/web/views/repoman_history.erb +++ /dev/null @@ -1,25 +0,0 @@ -<h1 class="text-center"><%=repomans.first[:package_id]%></h1> - -<table id="sortable" class="table table-bordered table-condensed"> - <thead> - <tr> - <th class="width-50">Check Date</th> - <th class="width-5o">Check Result</th> - </tr> - </thead> - <%repomans.each do |repoman|%> - <%next if repoman.nil?%> - <%result = 'info'%> - <%result = 'success' if repoman[:next_result] == 'passed'%> - <%result = 'danger' if repoman[:current_result] == 'failed'%> - <%result = 'danger' if repoman[:current_result] == 'partial'%> - <tr> - <td class="width-50"> - <%=Time.at(repoman[:time].to_i).strftime('%Y-%m-%d')%> - </td> - <td class="width-50 <%=result%>"> - <a href="/repoman_logs/<%=repoman[:package_id]%>/<%=repoman[:time]%>"><%=repoman[:current_result].camelcase%> / <%=repoman[:next_result].camelcase%></a> - </td> - </tr> - <%end%> -</table> diff --git a/web/views/repoman_logs.erb b/web/views/repoman_logs.erb deleted file mode 100644 index 544db7a..0000000 --- a/web/views/repoman_logs.erb +++ /dev/null @@ -1,31 +0,0 @@ -<div class="text-center"> - <h1><%=repomans[:package_id]%></h1> - <h3><%=Time.at(repomans[:time].to_i).strftime('%Y-%m-%d')%></h3> - <div class="btn-group btn-group-justified"> - <a class="btn btn-default <%="disabled" if repomans[:current_log].nil?%>" href="#current_log">Current Ruby Target(s)</a> - <a class="btn btn-default <%="disabled" if repomans[:next_log].nil?%>" href="#next_log">Next Ruby Target</a> - </div> -</div> -<br> - -<%unless repomans[:current_log].nil?%> -<div class="panel panel-default"> - <div class="panel-heading"> - <h4><a name="current_log">Current Ruby Target(s)</a></h4> - </div> - <div class="panel-body"> - <pre><%=repomans[:current_log]%></pre> - </div> -</div> -<%end%> - -<%unless repomans[:next_log].nil?%> -<div class="panel panel-default"> - <div class="panel-heading"> - <h4><a name="next_log">Next Ruby Target</a></h4> - </div> - <div class="panel-body"> - <pre><%=repomans[:next_log]%></pre> - </div> -</div> -<%end%> |