diff -Nru debci-2.12.2/bin/debci-api debci-2.13/bin/debci-api --- debci-2.12.2/bin/debci-api 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/bin/debci-api 2020-06-28 12:36:14.000000000 +0000 @@ -1,13 +1,15 @@ #!/usr/bin/ruby require 'debci/key' +require 'debci/user' require 'thor' module Debci class APICLI < Thor desc 'setkey USERNAME [KEYNAME]', 'Sets a API key for the given user' def setkey(username, _keyname = 'default') - key = Debci::Key.create!(user: username) + user = Debci::User.find_or_create_by!(username: username) + key = Debci::Key.create!(user: user) puts key.key end diff -Nru debci-2.12.2/bin/debci-html debci-2.13/bin/debci-html --- debci-2.12.2/bin/debci-html 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/bin/debci-html 2020-06-28 12:36:14.000000000 +0000 @@ -1,5 +1,5 @@ #!/usr/bin/ruby -require 'debci/html_cli' +require 'debci/html/cli' Debci::HTML::CLI.start diff -Nru debci-2.12.2/debian/changelog debci-2.13/debian/changelog --- debci-2.12.2/debian/changelog 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/debian/changelog 2020-06-28 12:36:14.000000000 +0000 @@ -1,10 +1,30 @@ +debci (2.13) unstable; urgency=medium + + [ Antonio Terceiro ] + * Add a proper user model + * Debci::HTMLHelpers: fix parsing invalid pinnings + * ui: switch to escaped HTML by default (Closes: #962862) + * Set default external encoding to UTF-8 + + [ Milos Knezevic ] + * Fix missing build dependency (debootstrap) + * Fix issue with init script exiting prior creating dev.conf + * Fix lintian 'spelling-error-in-changelog' warning + * Improve slight inconsistencies in docs/HACKING.md + + [ Utkarsh Gupta ] + * Fix broken link for feed + * Show package details on the retry page + + -- Antonio Terceiro Sun, 28 Jun 2020 09:36:14 -0300 + debci (2.12.2) unstable; urgency=medium * ui: fix table header in package history page * Debci::Collector: update only given suite/arch * Drop status from package list (prefix) pages. Unfortunately it's too expensive to produce those pages at the moment, - so we can't affort to rebuild them on every new job. + so we can't afford to rebuild them on every new job. * Debci.log: flush STDOUT on each message * Debci::HTML: avoid extra queries * Debci::Package.history: fix ordering diff -Nru debci-2.12.2/debian/control debci-2.13/debian/control --- debci-2.12.2/debian/control 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/debian/control 2020-06-28 12:36:14.000000000 +0000 @@ -4,6 +4,7 @@ Maintainer: Debian CI team Uploaders: Antonio Terceiro , Paul Gevers , Build-Depends: debhelper-compat (= 12), + debootstrap, amqp-tools, autopkgtest (>= 5.5~) , bsdmainutils, @@ -29,6 +30,7 @@ ruby-activerecord (>= 2:5.2), ruby-bunny, ruby-database-cleaner , + ruby-erubi, ruby-foreman , ruby-pg, ruby-rack-test , diff -Nru debci-2.12.2/docs/HACKING.md debci-2.13/docs/HACKING.md --- debci-2.12.2/docs/HACKING.md 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/docs/HACKING.md 2020-06-28 12:36:14.000000000 +0000 @@ -70,7 +70,7 @@ hacking on debci: ``` -$ service rabbitmq-server start +$ sudo systemctl start rabbitmq-server ``` ### Set up the test environment @@ -99,7 +99,7 @@ the `fake` backend will report as testing the version of `foo` that is available on Debian stable. If for some reason you want or need it to report, say, versions that look like the ones from Debian unstable, all you have to do -is add a `sources.list` entry for Debian unstable, like this: +is add a `sources.list` entry for Debian unstable. If you want to work on an actual test backend, then you will want to modify `config/conf.d/dev.conf` to set the backend to the one you want to work on. diff -Nru debci-2.12.2/lib/debci/api/doc.erb debci-2.13/lib/debci/api/doc.erb --- debci-2.12.2/lib/debci/api/doc.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/api/doc.erb 2020-06-28 12:36:14.000000000 +0000 @@ -25,6 +25,6 @@ <%= request.script_name %><%= entry[:path] %> - <%= entry[:text].gsub('https://host', host) %> + <%== entry[:text].gsub('https://host', host) %> <% end %> diff -Nru debci-2.12.2/lib/debci/api/layout.erb debci-2.13/lib/debci/api/layout.erb --- debci-2.12.2/lib/debci/api/layout.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/api/layout.erb 2020-06-28 12:36:14.000000000 +0000 @@ -13,7 +13,7 @@ - <%= @head %> + <%== @head %>
@@ -46,7 +46,7 @@
- <%= yield %> + <%== yield %>
- - diff -Nru debci-2.12.2/lib/debci/html/layout.erb debci-2.13/lib/debci/html/layout.erb --- debci-2.12.2/lib/debci/html/layout.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/layout.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ - - - - - - - - - <%= Debci.config.distro_name %> Continuous Integration<% if @moretitle %> - <%= @moretitle %><% end %> - - - - - - - <%= @head %> - - -
- - - - -
- <%= yield %> -
- - -
- - - - - - - - <%= @footer %> - - diff -Nru debci-2.12.2/lib/debci/html/package.erb debci-2.13/lib/debci/html/package.erb --- debci-2.12.2/lib/debci/html/package.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/package.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -
-
- - -

- <%= @package.name %> - <%= @package_links %> -

- - <% if @package.blacklisted? %> -
- This package is currently blacklisted and will not have any new test runs. -
- <% end %> - - - - - - <% Debci.config.suite_list.each do |suite| %> - - <% end %> - - - <% Debci.config.arch_list.each_with_index do |arch, i| %> - - - <% @package.status[i].each do |status| %> - - <% end %> - - <% end %> - -
<%= suite %>
<%= arch %> - <% if status %> - <%= icon(status.status) %> - <%= status.title %> - <% else %> - <%= icon(:no_test_data) %> - No test data - <% end %> -
- -
-
diff -Nru debci-2.12.2/lib/debci/html/package_links.erb debci-2.13/lib/debci/html/package_links.erb --- debci-2.12.2/lib/debci/html/package_links.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/package_links.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ - \ No newline at end of file diff -Nru debci-2.12.2/lib/debci/html/packagelist.erb debci-2.13/lib/debci/html/packagelist.erb --- debci-2.12.2/lib/debci/html/packagelist.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/packagelist.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -

Packages

-
-
-
-
-

Browse

-
-
    - - <% @package_prefixes.each do |prefix| %> -
  • <%= prefix %>
  • - <% end %> - <% if @package_prefixes.empty? %> -
  • (no data yet)
  • - <% end %> - -
-
-
- -
- - - - - <% @packages.in_groups_of(3).each do |packages| %> - - <% packages.each do |package| %> - - <% end %> - - <% end %> -
Packages
- <% if package %> - <%= package.name %> - <% end %> -
-
-
diff -Nru debci-2.12.2/lib/debci/html/packages.erb debci-2.13/lib/debci/html/packages.erb --- debci-2.12.2/lib/debci/html/packages.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/packages.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -This page is intentionally left empty. -Please check the homepage instead. - - diff -Nru debci-2.12.2/lib/debci/html/platform_specific_issues.erb debci-2.13/lib/debci/html/platform_specific_issues.erb --- debci-2.12.2/lib/debci/html/platform_specific_issues.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/platform_specific_issues.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -
-
-

Status / Platform-Specific issues

- <%= @status_nav %> - - - - - - - - - <% @issues.each do |package, statuses| %> - - - - - <% end %> -
PackageStatus
<%= package.name %> - <% statuses.each do |status| %> - - <%= icon(status.status) %> - <%= status.suite %>/<%= status.arch %> <%= status.status %> (<%= status.duration_human %>) - -   - <% end %> -
-
-
diff -Nru debci-2.12.2/lib/debci/html/self_service.erb debci-2.13/lib/debci/html/self_service.erb --- debci-2.12.2/lib/debci/html/self_service.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/self_service.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ - -
-

Self Service

-

You can request a test through the debci UI or view your test request history.

-
- diff -Nru debci-2.12.2/lib/debci/html/self_service_history.erb debci-2.13/lib/debci/html/self_service_history.erb --- debci-2.12.2/lib/debci/html/self_service_history.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/self_service_history.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,128 +0,0 @@ -<% if @user == params[:user] %> - -<% end %> -
-

<%= params[:user] %>'s Job History

-
-
-
-
-
- - (* accepted as wildcard) - -
-
-
-
- - -
-
-
-
- - <% settings.suites.each do |suite| %> - - <% end %> -
-
-
-
- - <% settings.archs.each do |arch| %> - - <% end %> -
-
-
-
- -
-
- - - - - - - - - - - - - <% Array(@history).each do |test| %> - - - - - - - - - - <% package_dir = [test.suite, test.arch, test.package.prefix, test.package.name].join('/') %> - <% if !test.status %> - - - - <% elsif test.expired? %> - - - - <% else %> - <% dirname = File.join(Debci.config.data_basedir, 'autopkgtest', package_dir, test.run_id.to_s) %> - - - <% end %> - - <% end %> -
DatePackageSuiteArchitectureStatusDurationTriggerPin-PackagesResults
<%= test.date %><%= test.package.name %><%= test.suite %><%= test.arch %> - <%= icon(test.status) %> - <%= test.status %> - - <%= test.duration_human %> - <%= h test.trigger %><%= test.pin_packages %> - <%= filesize(File.join(dirname,'log.gz'),"test log (%s)")%> - - <%= filesize(File.join(dirname,'artifacts.tar.gz'),"artifacts (%s)")%> -
-<% if @total_pages > 1 %> - -<% end %> diff -Nru debci-2.12.2/lib/debci/html/self_service_test.erb debci-2.13/lib/debci/html/self_service_test.erb --- debci-2.12.2/lib/debci/html/self_service_test.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/self_service_test.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,186 +0,0 @@ - -<% if @error_msg %> -
-
-

Form error

-
-
<%= @error_msg %>
-
-<% end %> -<% if @success %> - -<% end %> -
-

Request Test

-

You can choose to request a test by either uploading a JSON file or by filling the form.

-
-
- -
-
- -

You can get an example JSON through exporting the filled-out form below or click here to view the thorough documentation.

-
-
- -
-
- -
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
-
- <% settings.archs.each do |arch| %> - - <% end %> -
-
-
-
-
-
- - -
-
-
-
- - -

- Pin packages are packages that need to be obtained from a different suite than the main suite that you - selected.
- This is used e.g. to run tests on testing with a few packages from unstable, or on unstable with a few packages - from experimental. -

-

- Format should be package, ..., package, suite
- Examples:
-

    -
  • src:bar, unstable: get all binaries built from bar from unstable
  • -
  • foo, src:bar, experimental: get foo and all binaries built from bar from experimental
  • -
- Note: each suite can be only present once. please separate by line. -

-
- - -
- -

The request should be an array of Test Request objects.

-

Test Request Object

- - - - - - - - - - - - - - - - - - - - - - - - - -
propertytypedescription
archsArray of ArchitecturesArchitectures available: <%= settings.archs %>
suiteStringSuites available: <%= settings.suites %>
testsArray of Test ObjectsSee Test Object
-

Test Object

- - - - - - - - - - - - - - - - - - - - - - - - - -
propertytypedescription
packageStringThe package that the requestor wants to test
triggerString (optional)Works as an identifier for the requestor
pin-packagesArray of Pin-packages Arrays (optional)See Pin-packages Array
-

Pin-packages Array

-
    -
  • An array of Strings with at least 2 elements
  • -
  • The last element should be a suite and can only be used once, Suites available: <%= settings.suites %>
  • -
  • :bar can be added to the pin-package to retrieve all binaries for the specified pin-package
  • -
-

Example JSON file

-
[
-  {
-    "archs": ["amd64"],
-    "suite": "unstable",
-    "tests": [
-      {
-        "trigger": "testpackage v1.2",
-        "package": "testpackage",
-        "pin-packages": [
-          ["src:bar", "unstable"],
-          ["foo", "src:bar", "experimental"]
-        ]
-      }
-    ]
-  }
-]
-
diff -Nru debci-2.12.2/lib/debci/html/status_alerts.erb debci-2.13/lib/debci/html/status_alerts.erb --- debci-2.12.2/lib/debci/html/status_alerts.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/status_alerts.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -
-
-

Status / Alerts

- <%= @status_nav %> - -

There are currently <%= @alert_number %> packages with status alerts.

- - <% if not @tmpfail.empty? %> - - - - - - - - - <% @tmpfail.each do |job| %> - - - - - - - <% end %> -
PackageSuiteArchitectureStatus
- <%= job.package.name %> - - <%= job.suite %> - - <%= job.arch %> - - <%= icon(:tmpfail) %> <%= job.title %> -
- <% end %> - -
-
diff -Nru debci-2.12.2/lib/debci/html/status.erb debci-2.13/lib/debci/html/status.erb --- debci-2.12.2/lib/debci/html/status.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/status.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -
-
- -

Status / Charts

- <%= @status_nav %> - -
- <% Debci.config.arch_list.each do |arch| %> - <% Debci.config.suite_list.each do |suite| %> - <% chart = Debci::Graph.new(suite, arch) %> - -

<%= "#{suite}/#{arch}" %>

- -
-
-

Pass/Fail

-
-
-
-

Pass percentage

-
-
-
- - <% end %> - <% end %> - -
-
-
diff -Nru debci-2.12.2/lib/debci/html/status_failing.erb debci-2.13/lib/debci/html/status_failing.erb --- debci-2.12.2/lib/debci/html/status_failing.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/status_failing.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -
-
-

Status / Failing / <%= @title %>

- <%= @status_nav %> - - - -

- <%= @jobs.length %> failures -

-
- Enter Package Name: -
- - - - - - - - - - - - <% @jobs.each do |job| %> - - - - - - - - - <% end %> - -
PackageSuiteArchitectureStatus
- - <%= job.package.name %> - - - <%= job.suite %> - - <%= job.arch %> - - - <%= icon(job.status) %> - <%= job.title %> - -
-
-
- - - - diff -Nru debci-2.12.2/lib/debci/html/status_nav.erb debci-2.13/lib/debci/html/status_nav.erb --- debci-2.12.2/lib/debci/html/status_nav.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/status_nav.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ - diff -Nru debci-2.12.2/lib/debci/html/status_pending_jobs.erb debci-2.13/lib/debci/html/status_pending_jobs.erb --- debci-2.12.2/lib/debci/html/status_pending_jobs.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/status_pending_jobs.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -
-
-

Status / Pending Jobs

- <%= @status_nav %> - - - - <% if not @pending.empty? %> - - - - - - - - - - - <% @pending.each do |job| %> - - - - - - - - - <% end %> -
PackageSuiteArchitectureRequestorTriggerRequested
- <%= job.package.name %> - - <%= job.suite %> - - <%= job.arch %> - - <%= job.requestor %> - - <%= h job.trigger %> - - <%= job.created_at %> | <%= job.time %> -
- <% end %> - -
-
- - diff -Nru debci-2.12.2/lib/debci/html/status_slow.erb debci-2.13/lib/debci/html/status_slow.erb --- debci-2.12.2/lib/debci/html/status_slow.erb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html/status_slow.erb 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -
-
-

Status / Slow running tests

- <%= @status_nav %> - - <% if @slow.empty? %> - No items - <% else %> - - - - - - - - - - - <% @slow.each do |status| %> - <% link = history_url(status) %> - - - - - - - - - - - - - - <% end %> -
PackageVersionSuiteArchitectureStatusTest time
- <%= status.package.name %> - - <%= status.version %> - - <%= status.suite %> - - <%= status.arch %> - - <%= icon(status.status)%> <%= status.title %> - - <%= status.duration_human %> -
- <% end %> - -
-
diff -Nru debci-2.12.2/lib/debci/html/templates/blacklist.erb debci-2.13/lib/debci/html/templates/blacklist.erb --- debci-2.12.2/lib/debci/html/templates/blacklist.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/blacklist.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,47 @@ +
+
+

Status / Blacklist

+ <%== @status_nav %> + + + + + + + + + + + + <% data = @blacklist.data %> + <% data.keys.each do |package| %> + <% data[package].keys.each do |suite| %> + <% data[package][suite].keys.each do |arch| %> + <% data[package][suite][arch].keys.each do |version| %> + + + + + + + + <% end %> + <% end %> + <% end %> + <% end %> + +
PackageSuiteArchitectureVersionReason
<%= package %> + <% if suite == '*'%> + <%= "All" %> + <% else %> + <%= suite %> + <% end %> + + <% if arch == '*' %> + <%= "All" %> + <% else %> + <%= arch %> + <% end %> + <%= version %><%== Debci.blacklist.comment(package, suite: suite, arch: arch, version: version) %>
+
+
diff -Nru debci-2.12.2/lib/debci/html/templates/history.erb debci-2.13/lib/debci/html/templates/history.erb --- debci-2.12.2/lib/debci/html/templates/history.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/history.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,109 @@ +
+
+ + +

+ <%= @package.name %> + + [ <%= @suite %>/<%= @architecture %> ] + + <%== @package_links %> +

+ +
+ Legend: + Test with packages from <%= @suite %> only + Test with packages from other suites +
+ + <% if @package.blacklisted? %> +
+ This package is currently blacklisted and will not have any new test runs. +
+ <% end %> + + + + + + + + + + + + + <% Array(@history).each do |test| %> + + + + + + + + + <% package_dir = [test.suite, test.arch, test.package.prefix, test.package.name].join('/') %> + <% if @artifacts_url_base %> + + + <% else %> + <% if test.expired? %> + + + <% else %> + <% dirname = File.join(Debci.config.data_basedir, 'autopkgtest', @package_dir, test.run_id.to_s) %> + + + + <% end %> + <% end %> + + <% end %> + +
VersionDateTrigger/Pinned packagesDurationStatusRequestorResults
<%= test.version %><%= test.date %> + <% title = title_test_trigger_pin(test) %> + <% if title %> +
+
+ <%= h test.trigger&.truncate(40) %> +
+ <% if test.pinned? %> +
+ <%= expand_pin_packages(test).truncate(40).gsub("\n", '
') %> +
+ <% end %> +
+ <% end %> +
<%= test.duration_human %> + <%== icon(test.status) %> + <%= test.status %> + + + <%= test.requestor %>test logartifacts + <%== filesize(File.join(dirname,'log.gz'),"test log (%s)")%> + + <%== filesize(File.join(dirname,'artifacts.tar.gz'),"artifacts (%s)")%> +
+ +

Automate:

+ + <% automation_info = "# latest status of the package\n" + + "$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/latest.json\n\n" + + if not @artifacts_url_base + automation_info += "# latest autopkgtest log of the package\n" + + "$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/latest-autopkgtest/log.gz\n\n" + end + + automation_info += "# test run history of the package\n" + + "$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/history.json" + %> + +
<%= automation_info %>
+ +
+
diff -Nru debci-2.12.2/lib/debci/html/templates/index.erb debci-2.13/lib/debci/html/templates/index.erb --- debci-2.12.2/lib/debci/html/templates/index.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/index.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,34 @@ +
+ +
+ +

Packages

+
    + <% @package_prefixes.each do |prefix| %> +
  • <%= prefix %>
  • + <% end %> + <% if @package_prefixes.empty? %> + (no data yet) + <% end %> +
+ +
+
+

Search Package

+
+ + +
+
+ + +
+ + diff -Nru debci-2.12.2/lib/debci/html/templates/layout.erb debci-2.13/lib/debci/html/templates/layout.erb --- debci-2.12.2/lib/debci/html/templates/layout.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/layout.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,77 @@ + + + + + + + + + <%= Debci.config.distro_name %> Continuous Integration<% if @moretitle %> - <%= @moretitle %><% end %> + + + + + + + <%== @head %> + + +
+ + + + +
+ <%== yield %> +
+ + +
+ + + + + + + + <%== @footer %> + + diff -Nru debci-2.12.2/lib/debci/html/templates/package.erb debci-2.13/lib/debci/html/templates/package.erb --- debci-2.12.2/lib/debci/html/templates/package.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/package.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,48 @@ +
+
+ + +

+ <%= @package.name %> + <%== @package_links %> +

+ + <% if @package.blacklisted? %> +
+ This package is currently blacklisted and will not have any new test runs. +
+ <% end %> + + + + + + <% Debci.config.suite_list.each do |suite| %> + + <% end %> + + + <% Debci.config.arch_list.each_with_index do |arch, i| %> + + + <% @package.status[i].each do |status| %> + + <% end %> + + <% end %> + +
<%= suite %>
<%= arch %> + <% if status %> + <%== icon(status.status) %> + <%= status.title %> + <% else %> + <%== icon(:no_test_data) %> + No test data + <% end %> +
+ +
+
diff -Nru debci-2.12.2/lib/debci/html/templates/package_links.erb debci-2.13/lib/debci/html/templates/package_links.erb --- debci-2.12.2/lib/debci/html/templates/package_links.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/package_links.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,9 @@ + \ No newline at end of file diff -Nru debci-2.12.2/lib/debci/html/templates/packagelist.erb debci-2.13/lib/debci/html/templates/packagelist.erb --- debci-2.12.2/lib/debci/html/templates/packagelist.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/packagelist.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,39 @@ +

Packages

+
+
+
+
+

Browse

+
+
    + + <% @package_prefixes.each do |prefix| %> +
  • <%= prefix %>
  • + <% end %> + <% if @package_prefixes.empty? %> +
  • (no data yet)
  • + <% end %> + +
+
+
+ +
+ + + + + <% @packages.in_groups_of(3).each do |packages| %> + + <% packages.each do |package| %> + + <% end %> + + <% end %> +
Packages
+ <% if package %> + <%= package.name %> + <% end %> +
+
+
diff -Nru debci-2.12.2/lib/debci/html/templates/packages.erb debci-2.13/lib/debci/html/templates/packages.erb --- debci-2.12.2/lib/debci/html/templates/packages.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/packages.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,6 @@ +This page is intentionally left empty. +Please check the homepage instead. + + diff -Nru debci-2.12.2/lib/debci/html/templates/platform_specific_issues.erb debci-2.13/lib/debci/html/templates/platform_specific_issues.erb --- debci-2.12.2/lib/debci/html/templates/platform_specific_issues.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/platform_specific_issues.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,33 @@ +
+
+

Status / Platform-Specific issues

+ <%== @status_nav %> + + + + + + + + + <% @issues.each do |package, statuses| %> + + + + + <% end %> +
PackageStatus
<%= package.name %> + <% statuses.each do |status| %> + + <%== icon(status.status) %> + <%= status.suite %>/<%= status.arch %> <%= status.status %> (<%= status.duration_human %>) + +   + <% end %> +
+
+
diff -Nru debci-2.12.2/lib/debci/html/templates/self_service.erb debci-2.13/lib/debci/html/templates/self_service.erb --- debci-2.12.2/lib/debci/html/templates/self_service.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/self_service.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,25 @@ + +
+

Self Service

+

You can request a test through the debci UI or view your test request history.

+
+ diff -Nru debci-2.12.2/lib/debci/html/templates/self_service_history.erb debci-2.13/lib/debci/html/templates/self_service_history.erb --- debci-2.12.2/lib/debci/html/templates/self_service_history.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/self_service_history.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,128 @@ +<% if @user&.username == params[:user] %> + +<% end %> +
+

<%= params[:user] %>'s Job History

+
+
+
+
+
+ + (* accepted as wildcard) + +
+
+
+
+ + +
+
+
+
+ + <% settings.suites.each do |suite| %> + + <% end %> +
+
+
+
+ + <% settings.archs.each do |arch| %> + + <% end %> +
+
+
+
+ +
+
+ + + + + + + + + + + + + <% Array(@history).each do |test| %> + + + + + + + + + + <% package_dir = [test.suite, test.arch, test.package.prefix, test.package.name].join('/') %> + <% if !test.status %> + + + + <% elsif test.expired? %> + + + + <% else %> + <% dirname = File.join(Debci.config.data_basedir, 'autopkgtest', package_dir, test.run_id.to_s) %> + + + <% end %> + + <% end %> +
DatePackageSuiteArchitectureStatusDurationTriggerPin-PackagesResults
<%= test.date %><%= test.package.name %><%= test.suite %><%= test.arch %> + <%== icon(test.status) %> + <%= test.status %> + + <%= test.duration_human %> + <%= h test.trigger %><%= expand_pin_packages(test) %> + <%== filesize(File.join(dirname,'log.gz'),"test log (%s)")%> + + <%== filesize(File.join(dirname,'artifacts.tar.gz'),"artifacts (%s)")%> +
+<% if @total_pages > 1 %> + +<% end %> diff -Nru debci-2.12.2/lib/debci/html/templates/self_service_test.erb debci-2.13/lib/debci/html/templates/self_service_test.erb --- debci-2.12.2/lib/debci/html/templates/self_service_test.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/self_service_test.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,186 @@ + +<% if @error_msg %> +
+
+

Form error

+
+
<%= @error_msg %>
+
+<% end %> +<% if @success %> + +<% end %> +
+

Request Test

+

You can choose to request a test by either uploading a JSON file or by filling the form.

+
+
+ +
+
+ +

You can get an example JSON through exporting the filled-out form below or click here to view the thorough documentation.

+
+
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+ +
+
+
+ <% settings.archs.each do |arch| %> + + <% end %> +
+
+
+
+
+
+ + +
+
+
+
+ + +

+ Pin packages are packages that need to be obtained from a different suite than the main suite that you + selected.
+ This is used e.g. to run tests on testing with a few packages from unstable, or on unstable with a few packages + from experimental. +

+

+ Format should be package, ..., package, suite
+ Examples:
+

    +
  • src:bar, unstable: get all binaries built from bar from unstable
  • +
  • foo, src:bar, experimental: get foo and all binaries built from bar from experimental
  • +
+ Note: each suite can be only present once. please separate by line. +

+
+ + +
+ +

The request should be an array of Test Request objects.

+

Test Request Object

+ + + + + + + + + + + + + + + + + + + + + + + + + +
propertytypedescription
archsArray of ArchitecturesArchitectures available: <%= settings.archs %>
suiteStringSuites available: <%= settings.suites %>
testsArray of Test ObjectsSee Test Object
+

Test Object

+ + + + + + + + + + + + + + + + + + + + + + + + + +
propertytypedescription
packageStringThe package that the requestor wants to test
triggerString (optional)Works as an identifier for the requestor
pin-packagesArray of Pin-packages Arrays (optional)See Pin-packages Array
+

Pin-packages Array

+
    +
  • An array of Strings with at least 2 elements
  • +
  • The last element should be a suite and can only be used once, Suites available: <%= settings.suites %>
  • +
  • :bar can be added to the pin-package to retrieve all binaries for the specified pin-package
  • +
+

Example JSON file

+
[
+  {
+    "archs": ["amd64"],
+    "suite": "unstable",
+    "tests": [
+      {
+        "trigger": "testpackage v1.2",
+        "package": "testpackage",
+        "pin-packages": [
+          ["src:bar", "unstable"],
+          ["foo", "src:bar", "experimental"]
+        ]
+      }
+    ]
+  }
+]
+
diff -Nru debci-2.12.2/lib/debci/html/templates/status_alerts.erb debci-2.13/lib/debci/html/templates/status_alerts.erb --- debci-2.12.2/lib/debci/html/templates/status_alerts.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/status_alerts.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,37 @@ +
+
+

Status / Alerts

+ <%== @status_nav %> + +

There are currently <%= @alert_number %> packages with status alerts.

+ + <% if not @tmpfail.empty? %> + + + + + + + + + <% @tmpfail.each do |job| %> + + + + + + + <% end %> +
PackageSuiteArchitectureStatus
+ <%= job.package.name %> + + <%= job.suite %> + + <%= job.arch %> + + <%== icon(:tmpfail) %> <%= job.title %> +
+ <% end %> + +
+
diff -Nru debci-2.12.2/lib/debci/html/templates/status.erb debci-2.13/lib/debci/html/templates/status.erb --- debci-2.12.2/lib/debci/html/templates/status.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/status.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,51 @@ +
+
+ +

Status / Charts

+ <%== @status_nav %> + +
+ <% Debci.config.arch_list.each do |arch| %> + <% Debci.config.suite_list.each do |suite| %> + <% chart = Debci::Graph.new(suite, arch) %> + +

<%= "#{suite}/#{arch}" %>

+ +
+
+

Pass/Fail

+
+
+
+

Pass percentage

+
+
+
+ + <% end %> + <% end %> + +
+
+
diff -Nru debci-2.12.2/lib/debci/html/templates/status_failing.erb debci-2.13/lib/debci/html/templates/status_failing.erb --- debci-2.12.2/lib/debci/html/templates/status_failing.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/status_failing.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,124 @@ +
+
+

Status / Failing / <%= @title %>

+ <%== @status_nav %> + + + +

+ <%= @jobs.length %> failures +

+
+ Enter Package Name: +
+ + + + + + + + + + + + <% @jobs.each do |job| %> + + + + + + + + + <% end %> + +
PackageSuiteArchitectureStatus
+ + <%= job.package.name %> + + + <%= job.suite %> + + <%= job.arch %> + + + <%== icon(job.status) %> + <%= job.title %> + +
+
+
+ + + + diff -Nru debci-2.12.2/lib/debci/html/templates/status_nav.erb debci-2.13/lib/debci/html/templates/status_nav.erb --- debci-2.12.2/lib/debci/html/templates/status_nav.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/status_nav.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,9 @@ + diff -Nru debci-2.12.2/lib/debci/html/templates/status_pending_jobs.erb debci-2.13/lib/debci/html/templates/status_pending_jobs.erb --- debci-2.12.2/lib/debci/html/templates/status_pending_jobs.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/status_pending_jobs.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,75 @@ +
+
+

Status / Pending Jobs

+ <%== @status_nav %> + + + + <% if not @pending.empty? %> + + + + + + + + + + + <% @pending.each do |job| %> + + + + + + + + + <% end %> +
PackageSuiteArchitectureRequestorTriggerRequested
+ <%= job.package.name %> + + <%= job.suite %> + + <%= job.arch %> + + <%= job.requestor %> + + <%= h job.trigger %> + + <%= job.created_at %> | <%= job.time %> +
+ <% end %> + +
+
+ + diff -Nru debci-2.12.2/lib/debci/html/templates/status_slow.erb debci-2.13/lib/debci/html/templates/status_slow.erb --- debci-2.12.2/lib/debci/html/templates/status_slow.erb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/html/templates/status_slow.erb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,51 @@ +
+
+

Status / Slow running tests

+ <%== @status_nav %> + + <% if @slow.empty? %> + No items + <% else %> + + + + + + + + + + + <% @slow.each do |status| %> + <% link = history_url(status) %> + + + + + + + + + + + + + + <% end %> +
PackageVersionSuiteArchitectureStatusTest time
+ <%= status.package.name %> + + <%= status.version %> + + <%= status.suite %> + + <%= status.arch %> + + <%== icon(status.status)%> <%= status.title %> + + <%= status.duration_human %> +
+ <% end %> + +
+
diff -Nru debci-2.12.2/lib/debci/html_cli.rb debci-2.13/lib/debci/html_cli.rb --- debci-2.12.2/lib/debci/html_cli.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html_cli.rb 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -require 'thor' -require 'debci/html' -require 'debci/package' - -module Debci - class HTML - class CLI < Thor - desc 'update', "Updates global HTML pages" - def update - Debci::HTML.update - end - - desc 'update-package PACKAGE [SUITE] [ARCHITECTURE]', 'Updates HTML for a given package, optionally only for the given suite and architecture' - def update_package(pkg, suite = nil, arch = nil) - package = Debci::Package.where(name: pkg).first - Debci::HTML.update_package(package, suite, arch) - end - end - end -end diff -Nru debci-2.12.2/lib/debci/html_helpers.rb debci-2.13/lib/debci/html_helpers.rb --- debci-2.12.2/lib/debci/html_helpers.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html_helpers.rb 2020-06-28 12:36:14.000000000 +0000 @@ -50,7 +50,7 @@ return nil unless test.pinned? test.pin_packages.map do |packages, suite| - packages.split(/\s*,\s*/).map do |pkg| + String(packages).split(/\s*,\s*/).map do |pkg| "#{pkg} from #{suite}" end end.flatten.join("\n") diff -Nru debci-2.12.2/lib/debci/html.rb debci-2.13/lib/debci/html.rb --- debci-2.12.2/lib/debci/html.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/html.rb 2020-06-28 12:36:14.000000000 +0000 @@ -1,5 +1,6 @@ require 'cgi' require 'erb' +require 'erubi' require 'forwardable' require 'json' require 'pathname' @@ -377,15 +378,17 @@ end def load_template(template) - read_template(template).result(binding) + binding.eval(read_template(template).src) # rubocop:disable Security/Eval end def read_template(name) templates[name] ||= begin - filename = File.join(File.dirname(__FILE__), 'html', name.to_s + '.erb') - template = ERB.new(File.read(filename)) - template.filename = filename - template + filename = File.join(File.dirname(__FILE__), 'html/templates', name.to_s + '.erb') + Erubi::Engine.new( + File.read(filename), + escape: true, + filename: filename, + ) end end @@ -398,7 +401,7 @@ @root = directory.split('/').map { |_| '..' }.join('/') html = load_template(:layout) do - read_template(template).result(binding) + load_template(template) end File.open(abs_filename, 'w') do |f| diff -Nru debci-2.12.2/lib/debci/key.rb debci-2.13/lib/debci/key.rb --- debci-2.12.2/lib/debci/key.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/key.rb 2020-06-28 12:36:14.000000000 +0000 @@ -5,6 +5,8 @@ module Debci class Key < ActiveRecord::Base + belongs_to :user, class_name: 'Debci::User' + attr_accessor :key before_create do |key| @@ -12,9 +14,9 @@ key.encrypted_key = key.class.encrypt(key.key) end - def self.reset!(username) - find_by(user: username)&.destroy - create!(user: username) + def self.reset!(user) + find_by(user: user)&.destroy + create!(user: user) end def self.authenticate(key) @@ -22,7 +24,7 @@ entry&.user || nil end - # Since the key being encrypt is random, there is no point is using salts + # Since the key being encrypted is random, there is no point is using salts # to protect against rainbow tables. So let's just use a good old SHA1 # hash. def self.encrypt(key) diff -Nru debci-2.12.2/lib/debci/self_service.rb debci-2.13/lib/debci/self_service.rb --- debci-2.12.2/lib/debci/self_service.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/self_service.rb 2020-06-28 12:36:14.000000000 +0000 @@ -1,4 +1,3 @@ -require 'sinatra' require 'json' require 'kaminari/core' require 'kaminari/activerecord' @@ -13,7 +12,7 @@ include Debci::TestHandler include Debci::HTMLHelpers - set :views, File.dirname(__FILE__) + '/html' + set :views, File.dirname(__FILE__) + '/html/templates' configure do set :suites, Debci.config.suite_list @@ -36,14 +35,14 @@ end get '/' do - redirect("/user/#{@user}") + redirect("/user/#{@user.username}") end get '/login' do user = read_request_user if user session[:user] = user - redirect("/user/#{user}") + redirect("/user/#{user.username}") else content = "Unauthenticated!\n" content = File.read(Debci.config.auth_fail_page) if Debci.config.auth_fail_page @@ -57,12 +56,12 @@ end get '/:user' do - redirect("/user/#{params[:user]}/jobs") unless @user == params[:user] + redirect("/user/#{params[:user]}/jobs") unless @user.username == params[:user] erb :self_service end get '/:user/test' do - redirect("/user/#{params[:user]}/jobs") unless @user == params[:user] + redirect("/user/#{params[:user]}/jobs") unless @user.username == params[:user] erb :self_service_test end diff -Nru debci-2.12.2/lib/debci/test_handler.rb debci-2.13/lib/debci/test_handler.rb --- debci-2.12.2/lib/debci/test_handler.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci/test_handler.rb 2020-06-28 12:36:14.000000000 +0000 @@ -65,7 +65,7 @@ package: package, suite: suite, arch: arch, - requestor: requestor, + requestor: requestor.username, status: status, date: date, trigger: test['trigger'], diff -Nru debci-2.12.2/lib/debci/user.rb debci-2.13/lib/debci/user.rb --- debci-2.12.2/lib/debci/user.rb 1970-01-01 00:00:00.000000000 +0000 +++ debci-2.13/lib/debci/user.rb 2020-06-28 12:36:14.000000000 +0000 @@ -0,0 +1,8 @@ +require 'debci/db' +require 'debci/key' + +module Debci + class User < ActiveRecord::Base + has_many :keys, class_name: 'Debci::Key' + end +end diff -Nru debci-2.12.2/lib/debci.rb debci-2.13/lib/debci.rb --- debci-2.12.2/lib/debci.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/lib/debci.rb 2020-06-28 12:36:14.000000000 +0000 @@ -1,3 +1,5 @@ +Encoding.default_external = Encoding::UTF_8 + require 'shellwords' require 'debci/config' diff -Nru debci-2.12.2/spec/debci/api_spec.rb debci-2.13/spec/debci/api_spec.rb --- debci-2.12.2/spec/debci/api_spec.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/spec/debci/api_spec.rb 2020-06-28 12:36:14.000000000 +0000 @@ -22,6 +22,10 @@ let(:suite) { Debci.config.suite } let(:arch) { Debci.config.arch } + let(:theuser) do + Debci::User.create!(username: 'theuser') + end + before do allow(Debci.config).to receive(:secrets_dir).and_return(tmpdir) end @@ -34,7 +38,7 @@ end it 'authenticates with a good key' do - key = Debci::Key.create!(user: 'theuser').key + key = Debci::Key.create!(user: theuser).key header 'Auth-Key', key get '/api/v1/auth' @@ -57,7 +61,8 @@ post '/api/v1/getkey', {}, 'SSL_CLIENT_S_DN_CN' => 'foo@bar.com' expect(last_response.status).to eq(201) - key = Debci::Key.find_by(user: 'foo@bar.com') + user = Debci::User.find_by(username: 'foo@bar.com') + key = user.keys.first expect(key).to_not be_nil end @@ -70,7 +75,7 @@ context 'receiving test requests' do before do - key = Debci::Key.create!(user: 'theuser').key + key = Debci::Key.create!(user: theuser).key header 'Auth-Key', key end @@ -262,7 +267,19 @@ end it 'displays a user friendly page to authenticated users' do - get '/api/v1/retry/1', {}, 'SSL_CLIENT_S_DN_CN' => 'foo@bar.com' + package = Debci::Package.create!(name: 'mypackage') + user = 'myuser' + trigger = 'mypackage/0.0.1' + pin_packages = ['src:mypackage', 'unstable'] + job = Debci::Job.create( + package: package, + suite: suite, + arch: arch, + requestor: user, + trigger: trigger, + pin_packages: pin_packages + ) + get "/api/v1/retry/#{job.id}", {}, 'SSL_CLIENT_S_DN_CN' => 'foo@bar.com' expect(last_response.status).to eq(200) expect(last_response.content_type).to match('text/html') end @@ -290,7 +307,7 @@ job_org = Debci::Job.last # Here we are going to retrigger it - key = Debci::Key.create!(user: 'theuser').key + key = Debci::Key.create!(user: theuser).key header 'Auth-Key', key post "/api/v1/retry/#{job_org.run_id}" @@ -332,7 +349,7 @@ end it 'rejects to retrigger an unknown run_id' do - key = Debci::Key.create!(user: 'theuser').key + key = Debci::Key.create!(user: theuser).key header 'Auth-Key', key post '/api/v1/retry/1' diff -Nru debci-2.12.2/spec/debci/html_helpers_spec.rb debci-2.13/spec/debci/html_helpers_spec.rb --- debci-2.12.2/spec/debci/html_helpers_spec.rb 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/spec/debci/html_helpers_spec.rb 2020-06-28 12:36:14.000000000 +0000 @@ -47,5 +47,10 @@ test.pin_packages = [["src:rake,src:ruby", "unstable"]] expect(expand_pin_packages(test)).to eq("src:rake from unstable\nsrc:ruby from unstable") end + + it 'expands pin_packages with invalid entry' do + test.pin_packages = [[nil, "unstable"]] + expect(expand_pin_packages(test)).to be_a(String) + end end end diff -Nru debci-2.12.2/tools/init-dev.sh debci-2.13/tools/init-dev.sh --- debci-2.12.2/tools/init-dev.sh 2020-05-15 23:36:01.000000000 +0000 +++ debci-2.13/tools/init-dev.sh 2020-06-28 12:36:14.000000000 +0000 @@ -13,7 +13,7 @@ if [ ! -f $configdir/whitelist ]; then echo "$WHITELIST" > "$configdir/whitelist" - tail -n 1000 config/whitelist config/conf.d/*.conf + tail -n 1000 config/whitelist config/conf.d/*.conf || : echo fi