49 Commits

Author SHA1 Message Date
Iain Lane
70c325fbbf autopkgtest: Save pending.json after every test request
We just had the autopkgtest queues DoSed because britney was crashing
after requesting each reverse dependency for a perl upload, but before
it had written pending.json out so it knew what not to request again.
This was 25,000 requests per arch...

Let's write pending.json straight after sending each request, so that
the next run - even after a crash - won't re-request the same things
again.
2017-09-07 12:24:00 +01:00
Steve Langasek
5136a3efb5 Comment the calculation of last_due 2017-07-18 18:36:04 +02:00
Colin Watson
b073a71911 Check whether testsuite triggers have any binaries
We should only run autopkgtests for testsuite triggers if the source
package has any binaries on the relevant architecture, as otherwise it
should be expected to fail.
2017-07-18 12:18:28 +01:00
Steve Langasek
132ffaf465 Refine the logic for recording the nominal sent age of the mail
In the previous iteration, if we were ever down/frozen/disabled long enough
to miss sending two mails in a row, we would see unintended "catch-up"
behavior where each subsequent run of britney would send a mail until the
right total number of mails had been sent.  Don't do this; instead, catch us
up in one go to the most recent mail that should have been sent, avoiding
bunching of notifications.

This changes one of the tests also to match.
2017-07-06 21:14:19 -07:00
Steve Langasek
d5040afb84 Fix up handling of email cache
We were checkpointing after each email was sent to ensure that an aborted
p-m run didn't result in double emails; however, because the new cache only
contains records for packages we've seen so far during this run (to avoid
the cache growing without bounds over time), that means an aborted p-m run
*still* throws away records for all packages still waiting to be processed.

To fix this, we:
 - only checkpoint records of writing emails during this in-progress run to
   a temp file
 - check for this temp file on britney startup, and if present, merge the
   results into the current state
 - move this temp file into the final cache location only at the end of the
   britney run

Along the way, fix up a bug introduced in the previous commit that would have
us only saving state for those packages for which we sent email during the
current run, which would have quite bad effects.
2017-07-06 17:36:57 -07:00
Steve Langasek
27ef44e478 Rework the email frequency calculation to account for gaps in runs
The previous code had some issues with respect to how we decided whether to
send an email.  The age used for calculating when the next mail should be
sent was saved as a float rather than an integer; since p-m runs never
happen exactly an integer number of days after upload, this results in a
cumulative error in the timing of the emails, that is further exacerbated if
a particular run is significantly delayed or if p-m infrastructure is down
for a period of time.

So instead, we now calculate the age at which the most recent email /should
have been sent/, and store that in our cache instead of the precise age.

There is still a bit of surprising behavior here due to the fact that we use
two different 'max_age' values for valid vs. invalid candidate packages: a
single package can, over the course of its stay in -proposed, move from
being an invalid candidate to being a valid candidate /and back again/
without ever migrating.  Such a package will switch back and forth between
two sets of calculations based on different starting offsets, causing the
ages at which the emails are sent to vary in a non-obvious fashion.
However, this will still obey the general principle of "email reminders of
decreasing frequency", so I think this is acceptable given that it is still
an overall improvement in predictability.

LP: #1671468
2017-06-29 12:52:28 -07:00
Robert Bruce Park
9c76c762cc Tweak recurring email frequency. 2017-04-06 22:30:30 -07:00
Steve Langasek
41ac7a81f9 Drop transitional code 2017-04-06 22:30:18 -07:00
Robert Bruce Park
16cca9c55d Change SourcePPAPolicy from a blacklist to a whitelist. 2017-03-24 11:46:52 -07:00
Iain Lane
858775a3c1 email: Make REJECTED_TEMPORARILY packages be not emailed for
These are rejections that we expect to clear out on their own or convert
to REJECTED_PERMANENTLY, at which point we will email.

https://bugs.launchpad.net/britney/+bug/1671468
2017-03-23 11:10:14 +00:00
Iain Lane
e00d86ad26 email: If a package is blocked by an explicit block, don't mail 2017-03-22 17:00:38 +00:00
Iain Lane
8350694348 email: Add tests that send email through a mocked SMTP server
I want to fix two bugs in interactions between other parts of britney
and the email policy. It's not currently easy to do so because we just
run the policy itself manually by creating some fake excuses.

Steal part of the machinery from the autopkgtest tests, and run a few
tests through britney completely. Use a fake SMTP server to record which
emails we sent.

(The port is hardcoded - that might not be so smart.)
2017-03-22 16:59:50 +00:00
Robert Bruce Park
63573fa24a Resend emails periodically. 2017-03-22 09:50:50 -07:00
Robert Bruce Park
0579677457 Stop writing "1 days" in emails. 2017-03-14 11:05:10 -07:00
Robert Bruce Park
1b4828bfb3 Write email cache after every email sent. 2017-03-10 09:48:37 -08:00
Steve Langasek
442993d3f0 Merge remote-tracking branch 'robru/fix-sourceppa' 2017-03-09 14:59:40 -08:00
Robert Bruce Park
389f8624dd Round age. 2017-03-09 11:12:20 -08:00
Robert Bruce Park
e7181465a8 Stop returning None. 2017-03-09 11:04:12 -08:00
Robert Bruce Park
2405fcf8bc Backport EmailPolicy to Python 3.2 2017-03-09 18:00:22 +00:00
Iain Lane
7cc72bf2d6 email: For direct sponsored uploads, email both the sponsor and sponsoree 2017-03-09 17:16:21 +00:00
Robert Bruce Park
df495582e2 Fix SourcePPA policy by inspecting build_link instead. (LP: #1648000) 2017-03-09 09:06:25 -08:00
Iain Lane
5f4c2e735d email: Log a message when we send emails 2017-03-09 16:46:47 +00:00
Iain Lane
d9887d320e email: be From the 'Ubuntu Release Team' 2017-03-09 16:41:34 +00:00
Robert Bruce Park
d66116d809 Update email MESSAGE_BODY to reflect dynamic max_age. 2017-03-09 08:33:09 -08:00
Iain Lane
b896fbf038 Enable email policy based on a config flag
So we can turn it off for the "notest" run and for the non-dev series.

This is a tristate

 - 'yes': send email as normal
 - 'dry-run': log what it would do, but send no email [nor update the
   cache, so each run is effectively a fresh run]
 - 'no': disable completely
2017-03-09 11:43:30 +00:00
Robert Bruce Park
2775a5435c Email Policy, send emails when packages are rejected. 2017-03-09 09:53:17 +00:00
Iain Lane
fe627aaa15 autopkgtest: Don't request tests for new packages that FTBFS
These are treated separately by britney ('no-binaries' vs.
'missing-builds').
2017-03-02 10:28:22 +00:00
Andy Whitcroft
71c8773b7d linux-meta: add synthetic dependancy for snapd
Signed-off-by: Andy Whitcroft <apw@canonical.com>
2017-02-24 14:27:43 +00:00
Iain Lane
766ed38d40 sourceppa: Refactor exception handling
Use a for loop for retrying instead of recursion, so we don't get nested
exceptions being thrown. Add a test for this flakiness.
2017-02-08 13:17:16 +00:00
Iain Lane
9661362880 sourceppa: Retry 5 times on HTTP 503s
We get these quite frequently from the LP API - have a few attempts.
2017-02-07 17:26:03 +00:00
Iain Lane
41d51369f5 autopkgtest: Accept packages which have dropped their tests in unstable
Currently we re-trigger all reverse binary dependencies of a package,
including binary packages built from the same source. We already
explicity trigger the source's own tests if they still exist in unstable
- don't also consider the source when looking at reverse dependencies.
2017-02-07 15:16:51 +00:00
Martin Pitt
1a53882811 Python 3.2 workaround: Replace FileNotFoundError with {IO,OS}Error
The FileNotFound class is not yet available in Python 3.2, but as long as
snakefruit still runs Ubuntu 12.04 we need to get along without it.
2016-12-12 11:41:31 +01:00
Martin Pitt
7c6fd99417 Python 3.2 workaround: Drop usage of enum module
enum is not yet available in Python 3.2, but as long as snakefruit still runs
Ubuntu 12.04 we need to get along without it.
2016-12-12 11:38:47 +01:00
Robert Bruce Park
c5c9c6f979 Reject packages if entire source ppa won't migrate 2016-12-12 11:38:47 +01:00
Martin Pitt
a217ea6ade Add "run-autopkgtest" tool to re-run tests 2016-12-12 11:33:45 +01:00
Martin Pitt
96df4080b9 Add autopkgtest policy
Add new autopkgtest policy: it determines the autopkgtests for a
source package (its own, direct reverse binary dependencies, and
Testsuite-Triggers), requests tests via AMQP, fetches results from swift, and
keeps track of pending tests between run. This also caches the downloaded
results from swift, as re-dowloading them all is very expensive.

This introduces two new hints:

 * force-badtest pkg/ver[/arch]: Failing results for that package will be
   ignored. This is useful to deal with broken tests that get imported from
   Debian or are from under-maintained packages, or broke due to some
   infrastructure changes. These are long-lived usually.

 * force-skiptest pkg/ver: Test results *triggered by* that package (i. e.
   reverse dependencies) will be ignored. This is mostly useful for landing
   packages that trigger a huge amount of tests (glibc, perl) where some tests
   are just too flaky to get them all passing, and one just wants to land it
   after the remaining failures have been checked. This should be used rarely
   and the hints should be removed immediately again.

Add integration tests that call britney in various scenarios on constructed
fake archives, with mocked AMQP and Swift results.
2016-12-12 11:33:45 +01:00
Colin Watson
158d7ca479 Change date format to seconds-since-epoch 2016-12-12 11:33:44 +01:00
Colin Watson
8b140b3900 Allow blocking uploads by way of bugs with the block-proposed tag set 2016-12-12 11:33:44 +01:00
Colin Watson
a2dcb26901 Make sure that containing directories exist before writing output files
We don't use os.makedirs(dir, exist_ok=True) as that is too strict: it fails if
the directory already exists with different permissions (e. g. with 775). Thus
introduce a helper function ensuredir().
2016-12-12 11:33:44 +01:00
Martin Pitt
e93d8ae221 Skip piuparts policy if summary file is missing 2016-12-12 11:33:44 +01:00
Colin Watson
c26dfad9c2 Skip bug-based processing if BugsV is missing 2016-12-12 11:33:44 +01:00
Colin Watson
538d5c61ff Use default urgency for all packages if Urgencies is missing 2016-12-12 11:33:44 +01:00
Niels Thykier
3e888a9fdf PiupartsPolicy: Improve html message
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-12-04 10:38:15 +00:00
Niels Thykier
bcdb2b39cd Add PiupartsPolicy to avoid piuparts regressions
Closes: Debian/britney2#16
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-26 17:11:40 +00:00
Niels Thykier
d3e343a3bd AgePolicy: Fix bug in creating the age file
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-22 20:21:06 +00:00
Niels Thykier
fc2269ba02 rc-bugs policy: Ignored bugs are not unique to testing
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-22 20:21:06 +00:00
Niels Thykier
20c2b87833 Sprinkle some "no cover" pragmas over the code base
Add some "no cover" to some unrecoverable exceptions
(e.g. misconfiguration) or base-class methods that are not intended to
be invoked.

Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-13 11:39:46 +00:00
Niels Thykier
50d4d45c59 Collect suite metadata in a new member hash
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-13 11:18:45 +00:00
Niels Thykier
9bc94db01c Refactor all modules into a britney2 subdir
That way they are all contained.

Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-13 08:02:00 +00:00