diff options
author | 2015-03-22 22:12:05 +0000 | |
---|---|---|
committer | 2015-03-22 22:12:05 +0000 | |
commit | f7c3fe3e0368ba5bb4109fafd40db4d92db61024 (patch) | |
tree | a0610ca53b3d71646c6a0baafc18d82ea7fa6aad | |
parent | Use 8 threads when calculating rdeps (diff) | |
parent | Exit early if one factor is nil, force the ordering of packages (diff) | |
download | ruby-tinderbox-f7c3fe3e0368ba5bb4109fafd40db4d92db61024.tar.gz ruby-tinderbox-f7c3fe3e0368ba5bb4109fafd40db4d92db61024.tar.bz2 ruby-tinderbox-f7c3fe3e0368ba5bb4109fafd40db4d92db61024.zip |
Merge pull request #14 from p8952/new_targets
Add New Targets Page
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Dockerfile | 6 | ||||
-rwxr-xr-x | bin/get_stage3.sh (renamed from conf/get_stage3.sh) | 0 | ||||
-rw-r--r-- | bin/make.conf (renamed from conf/make.conf) | 2 | ||||
-rwxr-xr-x | bin/provision.sh | 24 | ||||
-rwxr-xr-x | bin/repoman.sh | 66 | ||||
-rwxr-xr-x | bin/tinder.sh (renamed from tinder.sh) | 63 | ||||
-rwxr-xr-x | conf/provision.sh | 22 | ||||
-rwxr-xr-x | repoman.sh | 49 | ||||
-rw-r--r-- | web/.rubocop.yml | 2 | ||||
-rw-r--r-- | web/Rakefile | 41 | ||||
-rw-r--r-- | web/app.rb | 84 | ||||
-rw-r--r-- | web/db/migrations/018_new_targets.rb | 22 | ||||
-rw-r--r-- | web/lib/ci.rb | 85 | ||||
-rw-r--r-- | web/lib/models.rb | 4 | ||||
-rw-r--r-- | web/lib/packages.rb | 13 | ||||
-rw-r--r-- | web/lib/repoman.rb | 99 | ||||
-rw-r--r-- | web/repo-logs/.gitignore | 2 | ||||
-rw-r--r-- | web/views/build/build_history.erb | 20 | ||||
-rw-r--r-- | web/views/build/build_logs.erb (renamed from web/views/build_logs.erb) | 4 | ||||
-rw-r--r-- | web/views/build/build_status.erb (renamed from web/views/build_status.erb) | 18 | ||||
-rw-r--r-- | web/views/build_history.erb | 24 | ||||
-rw-r--r-- | web/views/bumps/new_targets.erb | 48 | ||||
-rw-r--r-- | web/views/layout.erb | 24 | ||||
-rw-r--r-- | web/views/overview/visualizations.erb (renamed from web/views/visualizations.erb) | 0 | ||||
-rw-r--r-- | web/views/package/outdated_gems.erb (renamed from web/views/outdated_gems.erb) | 0 | ||||
-rw-r--r-- | web/views/package/ruby_targets.erb (renamed from web/views/ruby_targets.erb) | 1 | ||||
-rw-r--r-- | web/views/repoman/repoman_checks.erb (renamed from web/views/repoman_checks.erb) | 19 | ||||
-rw-r--r-- | web/views/repoman/repoman_history.erb | 20 | ||||
-rw-r--r-- | web/views/repoman/repoman_logs.erb | 16 | ||||
-rw-r--r-- | web/views/repoman_history.erb | 25 | ||||
-rw-r--r-- | web/views/repoman_logs.erb | 31 |
32 files changed, 462 insertions, 373 deletions
@@ -1,3 +1,4 @@ gentoo-x86/ ruby-overlay/ web/.bundle/ +web/old-logs/ @@ -3,12 +3,8 @@ MAINTAINER Peter Wilmott <p@p8952.info> ADD cache/stage3-amd64.tar.bz2 / RUN mkdir /ruby-tinderbox -ADD conf/provision.sh /ruby-tinderbox/ -ADD conf/make.conf /ruby-tinderbox/ -ADD tinder.sh /ruby-tinderbox/ -ADD repoman.sh /ruby-tinderbox/ +ADD bin/* /ruby-tinderbox/ ADD web/lib/packages.py /ruby-tinderbox/ ADD web/lib/deps.py /ruby-tinderbox/ -RUN sed -i -e 's/sudo //g' /ruby-tinderbox/provision.sh RUN /ruby-tinderbox/provision.sh diff --git a/conf/get_stage3.sh b/bin/get_stage3.sh index da04ec2..da04ec2 100755 --- a/conf/get_stage3.sh +++ b/bin/get_stage3.sh diff --git a/conf/make.conf b/bin/make.conf index 5496b1c..f16dbb7 100644 --- a/conf/make.conf +++ b/bin/make.conf @@ -8,4 +8,4 @@ RUBY_TARGETS="ruby19 ruby20 ruby21 ruby22" GENTOO_MIRRORS="http://mirror.bytemark.co.uk/gentoo/" SYNC="rsync://mirror.bytemark.co.uk/gentoo-portage" EMERGE_DEFAULT_OPTS="--color=n --nospinner" -#PORTDIR_OVERLAY="/vagrant/ruby-overlay" +PORTDIR_OVERLAY="/ruby-tinderbox/overlay" diff --git a/bin/provision.sh b/bin/provision.sh new file mode 100755 index 0000000..cc4f726 --- /dev/null +++ b/bin/provision.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cp "$SCRIPT_DIR/make.conf" /etc/portage/make.conf +if [[ -d /etc/portage/package.accept_keywords/ ]]; then + rm -r /etc/portage/package.accept_keywords/ +fi +if [[ -d /etc/portage/package.use/ ]]; then + rm -r /etc/portage/package.use/ +fi + +emerge-webrsync +emerge --metadata + +RUBIES="dev-lang/ruby:1.9 dev-lang/ruby:2.0 dev-lang/ruby:2.1 dev-lang/ruby:2.2" +set +e +emerge --pretend --quiet $RUBIES +if [[ $? == 1 ]]; then + emerge --autounmask-write $RUBIES + etc-update --automode -5 +fi +set -e +emerge --noreplace --quiet $RUBIES diff --git a/bin/repoman.sh b/bin/repoman.sh new file mode 100755 index 0000000..25d36b1 --- /dev/null +++ b/bin/repoman.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail +[[ $(whoami) == 'root' ]] || exit 1 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +function ENV_SETUP() { + if [[ ! -d $SCRIPT_DIR/ci-logs/ ]]; then + mkdir "$SCRIPT_DIR/ci-logs" + fi +} + +function SETUP() { + mkdir -p "$SCRIPT_DIR/overlay" + mkdir -p "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" + cp "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" + cp "/usr/portage/$CATEGORY/$NAME/metadata.xml" "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" +} + +function REPOMAN() { + cd "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" + repoman scan || true + repoman manifest + repoman full > /tmp/repoman_log_current || true + + sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild" + repoman manifest + repoman full > /tmp/repoman_log_next || true + + LOG +} + +function LOG() { + DATE=$(date +%s) + SHA1=$(sha1sum "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" | awk '{print $1}') + mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE" + 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_log_next "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE/repoman_log" + + chmod 755 -R "$SCRIPT_DIR/ci-logs" +} + +function CLEANUP() { + rm /tmp/repoman_log_current + rm /tmp/repoman_log_next + rm -r "$SCRIPT_DIR/overlay" +} + +ENV_SETUP + +PKG_ARR=($(qatom $1)) +CATEGORY="${PKG_ARR[0]}" +NAME="${PKG_ARR[1]}" +if [[ ${PKG_ARR[3]:=foo} == 'foo' ]]; then + VERSION="${PKG_ARR[2]}" +else + VERSION="${PKG_ARR[2]}-${PKG_ARR[3]}" +fi + +PACKAGE=$1 +CURR_TARGET=$2 +NEXT_TARGET=$3 +SETUP +REPOMAN +CLEANUP diff --git a/tinder.sh b/bin/tinder.sh index 63bbd96..4116fa8 100755 --- a/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() { @@ -38,45 +38,68 @@ function SETUP () { function EMERGE() { set +e timeout 1000 emerge --usepkg --buildpkg "=$PACKAGE" - LOG "$?" "$PACKAGE" + LOG "$?" set -e } function LOG() { DATE=$(date +%s) - mkdir -p "$SCRIPT_DIR/ci-logs/$PACKAGE/$DATE" - emerge --info "=$PACKAGE" > "$SCRIPT_DIR/ci-logs/$PACKAGE/$DATE/emerge-info" - emerge -pqv "=$PACKAGE" > "$SCRIPT_DIR/ci-logs/$PACKAGE/$DATE/emerge-pqv" - cp "/var/tmp/portage/$PACKAGE/temp/build.log" "$SCRIPT_DIR/ci-logs/$PACKAGE/$DATE/build.log" - cp "/var/tmp/portage/$PACKAGE/temp/environment" "$SCRIPT_DIR/ci-logs/$PACKAGE/$DATE/environment" - gem list > "$SCRIPT_DIR/ci-logs/$PACKAGE/$DATE/gem-list" + SHA1=$(sha1sum "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" | awk '{print $1}') + mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE" + + emerge --info "=$PACKAGE" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/emerge-info" + emerge -pqv "=$PACKAGE" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/emerge-pqv" + cp "/var/tmp/portage/$PACKAGE/temp/build.log" "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/build.log" + cp "/var/tmp/portage/$PACKAGE/temp/environment" "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/environment" + gem list > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/gem-list" + if [[ $1 == 0 ]]; then RESULT="\e[0;32mBUILD SUCCEEDED\e[0m" - touch "$SCRIPT_DIR/ci-logs/$PACKAGE/$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/$PACKAGE/$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/$PACKAGE/$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/$PACKAGE/$DATE/unknown" + echo "unknown" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/result" fi - chmod 755 -R "$SCRIPT_DIR/ci-logs/$PACKAGE/$DATE" + + chmod 755 -R "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE" } function CLEANUP() { mv /var/lib/portage/world.original /var/lib/portage/world - emerge --depclean --quiet rm -r /var/tmp/portage/* || true + emerge --depclean --quiet + echo -e "$PACKAGE : $RESULT" } ENV_SETUP -PACKAGES=("$@") -for PACKAGE in "${PACKAGES[@]}"; do - SETUP $PACKAGE - EMERGE $PACKAGE + +PKG_ARR=($(qatom $1)) +CATEGORY="${PKG_ARR[0]}" +NAME="${PKG_ARR[1]}" +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" + PACKAGE=$1 + SETUP + EMERGE CLEANUP - echo -e "$PACKAGE : $RESULT" -done +elif [[ $# -eq 3 ]]; then + TYPE="next_target" + PACKAGE=$1 + CURR_TARGET=$2 + NEXT_TARGET=$3 + SETUP + EMERGE + CLEANUP +fi diff --git a/conf/provision.sh b/conf/provision.sh deleted file mode 100755 index b03b905..0000000 --- a/conf/provision.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -o errexit -o nounset -o pipefail -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -sudo emerge-webrsync -sudo emerge --metadata - -if [[ -f $SCRIPT_DIR/make.conf ]]; then - sudo cp "$SCRIPT_DIR/make.conf" /etc/portage/make.conf -else - sudo cp /vagrant/conf/make.conf /etc/portage/make.conf -fi - -RUBIES="dev-lang/ruby:1.9 dev-lang/ruby:2.0 dev-lang/ruby:2.1 dev-lang/ruby:2.2" -set +e -sudo emerge --pretend --quiet $RUBIES -if [[ $? == 1 ]]; then - sudo emerge --autounmask-write $RUBIES - sudo etc-update --automode -5 -fi -set -e -sudo emerge --noreplace --quiet $RUBIES diff --git a/repoman.sh b/repoman.sh deleted file mode 100755 index da0ee57..0000000 --- a/repoman.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash -set -o errexit -o nounset -o pipefail -[[ $(whoami) == 'root' ]] || exit 1 -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -function ENV_SETUP() { - rm -r "$SCRIPT_DIR/.git" || true - mkdir -p "$SCRIPT_DIR/overlay" - mkdir -p "$SCRIPT_DIR/repo-logs" -} - -function SETUP() { - mkdir -p "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" - cp "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" - cp "/usr/portage/$CATEGORY/$NAME/metadata.xml" "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" -} - -function REPOMAN() { - DATE=$(date +%s) - mkdir -p "$SCRIPT_DIR/repo-logs/$CATEGORY/$NAME-$VERSION/$DATE" - cd "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" - repoman scan || true - repoman manifest - repoman --digest=y full > "$SCRIPT_DIR/repo-logs/$CATEGORY/$NAME-$VERSION/$DATE/current.txt" || true - sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild" - repoman --digest=y full > "$SCRIPT_DIR/repo-logs/$CATEGORY/$NAME-$VERSION/$DATE/next.txt" || true -} - -function CLEANUP() { - rm "$SCRIPT_DIR/overlay/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" - rm "$SCRIPT_DIR/overlay/$CATEGORY/$NAME/Manifest" - rm "$SCRIPT_DIR/overlay/$CATEGORY/$NAME/metadata.xml" - rm -r /usr/portage/distfiles/* -} - -ENV_SETUP -PACKAGES=("$@") -for PACKAGE in "${PACKAGES[@]}"; do - read -a PKG_ARR <<< "$PACKAGE" - CATEGORY="${PKG_ARR[0]}" - NAME="${PKG_ARR[1]}" - VERSION="${PKG_ARR[2]}" - CURR_TARGET="${PKG_ARR[3]}" - NEXT_TARGET="${PKG_ARR[4]}" - - SETUP - REPOMAN - CLEANUP -done diff --git a/web/.rubocop.yml b/web/.rubocop.yml index fee096c..49ef5a1 100644 --- a/web/.rubocop.yml +++ b/web/.rubocop.yml @@ -16,5 +16,7 @@ Style/IndentHash: Enabled: false Style/IndentationWidth: Enabled: false +Style/MultilineOperationIndentation: + EnforcedStyle: indented Style/Tab: Enabled: false 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,49 +22,83 @@ 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 } + 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 '/new_targets' do + update_timestamp = Package.first[:update_timestamp] + portage_timestamp = Package.first[:portage_timestamp] + packages = [] + Package.each do |package| + build_current = package.build_dataset.where(target: 'current').reverse_order(:timestamp).first + next if build_current.nil? + + repoman_current = package.repoman_dataset.where(target: 'current').reverse_order(:timestamp).first + next if repoman_current.nil? + + repoman_next = package.repoman_dataset.where(target: 'next').reverse_order(:timestamp).first + next if repoman_next.nil? + + if repoman_current[:result] == 'passed' and repoman_next[:result] == 'passed' + packages << [package, build_current, nil, repoman_current, repoman_next] + end + end + packages = packages.compact.sort_by { |package| package[0][:identifier] } + erb :'bumps/new_targets', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } end get '/visualizations' do @@ -89,11 +123,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/bumps/new_targets.erb b/web/views/bumps/new_targets.erb new file mode 100644 index 0000000..4ecc565 --- /dev/null +++ b/web/views/bumps/new_targets.erb @@ -0,0 +1,48 @@ +<div id="ruby_targets"> + <h1>New Targets</h1> + <small> + Last updated on + <%=Time.at(update_timestamp.to_i).strftime('%Y-%m-%d')%> + using a portage snapshot dated + <%=Time.at(portage_timestamp.to_i).strftime('%Y-%m-%d')%> + </small> +</div> + +<form class="pull-right"> + <input type="checkbox" onclick="$('td:contains(\'+amd64\')').parent().toggle();" checked> amd64 + <input type="checkbox" onclick="$('td:contains(\'+~amd64\')').parent().toggle();" checked> ~amd64 +</form> + +<table id="sortable" class="table table-bordered table-condensed"> + <thead> + <tr> + <th class="width-52">Package</th> + <th class="width-12">CI Current</th> + <th class="width-12">CI Next</th> + <th class="width-12">QA Current</th> + <th class="width-12">QA Next</th> + </tr> + </thead> + <%packages.each do |package|%> + <tr> + <td class="width-52"> + <%=package[0][:identifier]%> + </td> + <td class="width-12 <%=package[1][:result]%>"> + <%=package[1][:result].camelcase%> + </td> + <td class="width-12"> + ToDo + </td> + <td class="width-12 <%=package[3][:result]%>"> + <%=package[3][:result].camelcase%> + </td> + <td class="width-12 <%=package[4][:result]%>"> + <%=package[4][:result].camelcase%> + </td> + <td style="display:none;"> + +<%=package[0][:amd64_keyword]%> + </td> + </tr> + <%end%> +</table> diff --git a/web/views/layout.erb b/web/views/layout.erb index f424ee4..9d564b3 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> @@ -66,7 +66,13 @@ <li><a href="/ruby_targets">Ruby Targets</a></li> <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</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> + </ul> + </li> <li><a href="/visualizations">Visualizations</a></li> </ul> </div> @@ -99,7 +105,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/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%> |