Commit Graph

1248 Commits

Author SHA1 Message Date
Christophe Monniez
b015ec6840 [IMP] runbot: show bundles that use a Dockerfile
Before manipulating a Dockerfile, it can be useful to know which bundle
is using it.
2021-06-29 09:22:41 +02:00
Christophe Monniez
67d020a8b3 [IMP] runbot: update docker default for focal
Since Odoo 14.0, the recommended Ubuntu LTS release is Focal, the
default Docker should be updated accordingly.

A custom template with bionic have to be manually created on runbot
instances that still build Odoo < 14.0.

* A small change is made in the templates logic that builds the
  Dockerfile: a `runbot_pip` dict entry now exists in order to install the
  python libs required by the runbot. On the other hand, `additional_pip`
  should only be used to install optional python libs for Odoo.

* Upgrade Chrome version to 90.0.4430.93-1 as this one is currently in
  use on our current runbot instance. Just keep in mind that the Odoo
  screencast feature does not work anymore since Chrome 88.

* gsfont is added because of a bug [0] that affects python-reportlab in
  Focal.

* pyCrypto package is removed. It was used in an Odoo addon that
  disappeared in odoo/odoo@2738341c21

* dbfread, websocket-client are now installed as a deb package as they exists in Bionic and
  Focal

* pdfminer.six is now removed because a deb package exists in Focal but
  not in Bionic. It means that it has to be added in deb_packages_python
  in Dockerfiles for odoo > 13.0 and in additional_pip for odoo <= 13.0

[0]: https://bugs.launchpad.net/ubuntu/+source/python-reportlab/+bug/1918107
2021-06-29 09:22:41 +02:00
Xavier-Do
e65ebb570d [IMP] runbot: change ahead/behind visibility 2021-05-19 11:45:06 +02:00
Alexandre Fayolle
3c760870b5 [FIX] runbot: bug in duplicate module detection
The test in the original code will never fire because the value searched
for is not in the keys of the dictionary, but in one of the lists which
are in the values. Work around this by maintaining a reverse dictionary
module name -> commit and use this for the test.
2021-05-18 12:37:42 +02:00
Xavier-Do
0a37ff2f90 [FIX] runbot: don't log twice 2021-05-17 14:43:48 +02:00
Xavier-Do
6d4efcb470 [FIX] runbot: avoid failure for duplicate warnings 2021-05-17 14:23:18 +02:00
Christophe Monniez
b14a73b1d4 [IMP] runbot: enhance dockerfile tree view
When a dockerfile to_build field is False for any reason and a new
runbot is setup, it's easy to miss the point and builds that involves
this particular Dockerfile will fail on the new runbot.

With this commit, the Dockerfiles tree view is improved to easily spot
those kind of problems:

- to_build field is visible and the Falsy lines are in yellow (warning)
- the empty Dockerfile's are in red (danger)
- versions are now visible in the tree view too
2021-05-17 14:11:34 +02:00
Christophe Monniez
642844fdb5 [IMP] runbot: show red slots in batch tile
When a build slot is hidden in the batch tile but is responsible of the
batch failure, the failure reason may not be obvious for the user.

With this commit, an hidden slot appears if the slot build is in
failure.
2021-05-17 14:11:03 +02:00
Xavier-Do
5d3a2de698 [FIX] runbot: don't fail all branch discovery if one pull info fails.
Sometimes a pr pull info can fail.
- Most of the time it is only temporary and it will be successfull on next try.
- In some rare case the pr will always fail (github inconsistency) The pr exist in git but not on github api.
For this rare case, we store the pr in memory in order to unstuck other pr/branches update.
We consider that this error should not remain, in this case github needs to fix the inconsistency.
This is why the runbot model don't handle such a case for now.
Another solution would be to create the pr with fake pull info. This idea is not the best one
since we want to avoid to have many pr with fake pull_info in case of temporary failure of giothub services.
With this solution, the pr will be retried once every cron loop.
We dont except to have pr with this kind of persistent failure more than every few mounths/years.
2021-05-17 14:07:55 +02:00
Xavier-Do
514de022f4 [FIX] runbot: fix markdown code
When code blocks were containing markdown like text, the inside of the code
block was also formated.

This commit removes the code blocks before applying other formating and
place them back at the end.

closes #481
2021-05-10 15:11:21 +02:00
Xavier-Do
6279dfa442 [IMP] runbot: imp stat display:
- Adds a complete legend enabelling to display a custom subset of modules.
This is mainly to enable a vertical scroll on list since chart-js default
legend will be displayed on multiple column.

- Adds a "Noisy" order mode to find non-deterministic modules.

- Changes the build selection mode to a center one to easylly center
build of interrest and add a forward button.

- Small ui tweaks/fix to match new selection logic.
2021-04-13 10:35:30 +02:00
Xavier-Do
8e53dbd0db [FIX] runbot: hide testing builds from stats views. 2021-04-13 10:35:30 +02:00
Xavier-Do
84d9425bdc [FIX] runbot: various view fixes
- fix missing batch references on builds
- fix group on action buttons
2021-04-09 14:58:17 +02:00
Christophe Monniez
57bd00672d [IMP] runbot: add a chart page for build stats
Since 360e31ade4, it's possible to add statistics values to build
results but there was no practical way to analyze them.

With this commit, there is a new button on the bundle page that leads to
a chart page that displays those values.

The default reference build is last known good build of the bundle.
Values are filtered by key and only the most significant values are
displayed. The user can then refine the chart by changing the reference
build or the key and a few other options.

Co-author: Xavier-Do <xdo@odoo.com>
2021-04-09 14:10:37 +02:00
David James
19c312d92c [IMP] runbot: add an option to exclude paths from coverage report 2021-04-07 15:47:11 +02:00
Christophe Monniez
785a7796fb [IMP] runbot: allow conditional pip requirements
Before this commit, the `requirements.txt` from a specified odoo branch
(master by default) was always installed in the Dockerfile's.

We now allow to disable this feature to test Odoo with vanilla
distributions.
2021-04-07 11:35:33 +02:00
Christophe Monniez
6bd74c07c4 [IMP] runbot: allow to install Chrome from google
When choosing to install Chrome in a Dockerfile, the chrome version is
downloaded from Odoo nightly server. This make it difficult to test
with different versions of Chrome.

With this commit, we allow to install from Google in Docker files.

By default, the install remains from Odoo Nightly server but if the key
`custom_values['chrome_source']` is set to 'google' in a Dockerfile,
the specified version will be downloaded from Google servers when the
Docker image is built.
2021-04-07 11:35:33 +02:00
Christophe Monniez
50f803ec31 [FIX] runbot: allow larger upload on runbot odoo instances 2021-04-07 11:01:35 +02:00
Andrius Laukavičius
5337ecd11f [FIX] runbot: _compute_host_id
If you try to manually create bundle, Odoo will crash, because it will
try to use `name` value that is not set yet. For that we start computing
host_id once `name` is entered.
2021-04-07 11:00:55 +02:00
Xavier-Do
0ed4728518 [IMP] runbot: use last step in wakeup when possible 2021-04-07 10:31:05 +02:00
Christophe Monniez
0f4610c8bc [FIX] runbot: remove forgotten print 2021-03-16 10:45:47 +01:00
Xavier-Do
46269ada70 [FIX] runbot: fix logged message 2021-03-15 13:12:48 +01:00
Xavier Morel
318803d7bb [IMP] runbot_merge: tag PRs with a pseudo-branch on merge to master
If a PR got merged to master (or whatever the current development
branch is), there's no easy way to know what maintenance branch it
ended up landing in, except by asking git which branches contain the
commit (which can be rather slow).

Add a special case on merge which labels the PR with a pseudo-branch
patterned after the second-to-last branch of the project:

* if the branch ends with a number, increment the number by one
  e.g. 2.0 -> 2.1, 5 -> 5.1
* otherwise, just prefix with `post-` e.g. "maint" ->
  "post-maint" (that one doesn't sound very helpful, but I guess it's
  nice for the weirdoes who call their branches "natty narwhal" and
  shit)

Fixes #450
2021-03-02 14:28:32 +01:00
Xavier Morel
60af69b69f [FIX] runbot_merge: dashboard title should link to github
Currently links to self, which is not useful (the viewer is already
there).

Fixes #452
2021-03-02 14:28:32 +01:00
Xavier Morel
4e4e4303f6 [IMP] runbot_merge: add name_search override to PRs
Should allow filtering PRs by source or parent.

Fixes #458
2021-03-02 14:28:32 +01:00
Xavier Morel
0b1e33da7c [IMP] forwardport: mitigate cat-file not finding commit on updates
Fix #457 hopefully: I didn't manage to repro / create a test for.

It looks like in some cases during the update process the PR ref lags
behind the branch itself. This means `forwardport.updates` creates a
new commit, pushes it, then on the next iteration updates the local
cache, tries to find the commit we just pushed... and that fails.

I can only assume this is because when there's enough load on the
github side the update to the `info/refs` pseudo-file can fall
behind (it's now 4MB and holding nearly 65k refs).

So cheat: take the commit we just pushed to the dev remote
and... immediately push it to the local cache under a dummy branch,
which we delete. Since we only gc "1 day ago" this should not vacuum.
2021-03-02 14:28:32 +01:00
Xavier Morel
8a924fb4b7 [FIX] forwardport: duplicates forwardport on edition
On edition of an intermediate PR in a chain, merging the PR would lead
to *it* being forward-ported, duplicating the PRs already created
from *its* source.

Add a check for PRs in the target branch with the same source,
suppresses the forward-porting of the newly merged PR.

Fixes #451 (hopefully)
2021-03-02 14:28:32 +01:00
Xavier Morel
952dafa45c [IMP] forwardport: feedback on conflict
append `git status` data to stderr, should be somewhat more
informative especially when a conflict is a DU (where the file has
been deleted on one side, so there is no conflict marker anywhere).

Fixes #461
2021-03-02 14:28:32 +01:00
Xavier Morel
a5f2d14707 [CHG] forwardport: try to create PRs in draft mode
Fall back to creating in not-draft mode if that doesn't work: draft
pull requests on private repositories requires the Team plan.

Closes #459
2021-03-02 14:28:32 +01:00
Xavier Morel
9c1585383a [IMP] forwardport: git commands logging
- When updating the local repo cache, always capture both stdout and
  stderr and log them out rather than having them in journalctl hard
  to relate to the main log.
- In the git layer, capture stderr by default and log it automatically
  on command failure.
2021-03-02 14:28:32 +01:00
Xavier Morel
2aeecb68b9 [FIX] forwardport: completely update PR data when forwarding updates
The process did properly update the state, but not the squash state.

It's somewhat unclear whether the state should be fully reset and
require reapproval though. Maybe only the validation should be reset?
The CI will eventually run and either succeed (re-validating) or
fail (devalidating, hopefully) but I'm not entirely sure this is
correct.
2021-03-02 14:28:32 +01:00
Xavier Morel
a541781ee0 [FIX] test proxy recordset union / concatenation
Apparently I wrote this when I was a dumbshit and did not think that
Python sets are implemented completely separately from dicts
and *remain unordered*.

As a result, the simplistic set union would not properly conserve
record order, which it should.
2021-03-02 14:28:32 +01:00
Xavier Morel
2b64f7feb3 [REM] duplicate method in test proxy
Probably a duplication I missed when I merged the proxies from
runbot_merge and forwardport.
2021-03-02 14:28:32 +01:00
Xavier Morel
5e05d3cd96 [REF] forwardport: move PR update tests to their own module 2021-03-02 14:28:32 +01:00
Xavier Morel
ab919c00db [FIX] conftest: ensure we always have a reason in get_ref
Apparently the "reason phrase" has been removed from HTTP/2 and github
has enabled HTTP/2, meaning responses may or may not contain a reason
phrase depending whether they're HTTP/1.1 or HTTP/2. Now I don't
understand how this triggers because requests isn't supposed to
support HTTP/2, and in a shell I do get a reason, but w/e.

Anyway the reason is used by a few tests to check more specifically
for the response they're getting, as that's used as the assertion
message by `get_ref`.

I guess I could replace the AssertionError by an HTTPError
but... w/e. Seems simpler to just fallback to the generic reason based
on the status code. It fixes both failing
tests (test_straightforward_flow and test_delete_normal) with very
little change.
2021-03-02 14:28:32 +01:00
Xavier-Do
c538bd17f8 [IMP] runbot: use build database_ids to generate connect links
aka: make it clean

This build database_ids field was generated a few months, waiting for the database to update with
this new sceme before using it.

It is still a little early to use it in cleanup methods, but this can be used to
generate the connect links dynamicaly.

To follow al specs introduced in previous commit, main fa-sign-in button should link to the -all.
It will almost always be the first one in database_ids in alphabetic order.
Then, in the dropdown, all other database are listed.

This will fix the previously broken design_theme connect link (no base nor all).

For this purpose nginx regex needs to be adapted to accept database name with underscore.
2021-03-01 15:49:23 +01:00
Xavier-Do
26ad74051f [IMP] runbot: apply al connect button spec 2021-02-26 12:13:39 +01:00
Xavier-Do
38b52411fa [FIX] runbot: use database name subdomain
Using database name as subdomain will set the web.base.url correctly when connection for the first time using this link
This will unfortunatelly break connect all and connect base links if dns and nginx are not setup.
This won't fix the web.base.url when connecting with the Connect (database selector) button either.
2021-02-22 16:03:51 +01:00
Christophe Monniez
f28485b6a8 [FIX] runbot: allow to retry to send a status
When a status cannot be sent to github, the status is created in
database but the `sent_date` field is not set.

Because of that, the status cannot be sent manually from the frontend.

With this commit, that kind of status can by tried again.
2021-02-02 13:32:03 +01:00
Christophe Monniez
4f4005896c [FIX] runbot: browse a valid record id in test_warning
Since odoo/odoo@824a651 the test_warning_from_runbot_abstract was
failing for a good reason, the `browse` parameter was a recordset
instead of an id.
2021-02-02 11:48:03 +01:00
Xavier Morel
21077c690a [FIX] runbot_merge: incorrect processing of rebased commit messages
5cf3617eef intended to create merge
messages with only the content of PR descriptions before the first
thematic break. However this processing was incorrectly applied
to all messages being processed (meaning rebased / squashed commit
messages as well).

Properly apply thematic break processing to only commit messages
created from PR descriptions.
2021-01-21 13:15:32 +01:00
Xavier Morel
08b8da08df [IMP] runbot_merge: precisely filter stagings before validating them
Before this, we would "roughly" select stagings by looking at stagings
whose heads matched a specific sha then validating them all. This
could perform extra validations on stagings once in a while but this
was assumed not to be much an issue, at least originally.

However two changes later on have contributed to this likely being the
cause of #429 (stagings never timing out):

* heads of the staging branches are uniquifier commits stored in the
  heads map, but the actual heads of the stagings are also stored
  there, some of which are no-ops (hence the uniquifiers) so assuming
  repos A and B, if a staging contains PRs touching A then the head of
  B actual will also be a head of B
* when a staging is validated, if it *contains* any pending result the
  timeout limit gets bumped back

The issue here is that if a success / failure status is lost (which
would be the most common reason for timeouts) *and* someone has forked
and is regularly rebuilding a branch-head used as-is by a staging,
each of those rebuilds will trigger a validation of the staging, which
will find that one of the statuses is still pending (because we missed
the success / failure), which will bump up the timeout limit,
continuing until the branch stops getting rebuilt.

This is probably one of the reasons why some stagings last for *way*
more than 2h, though it is far from explaining all of them: 90% of the
stagings lasting more than *3*h end up succeeding. Tho it's always
possible that this is because someone notices and resends a success
for the missing status it seems somewhat doubtful. Oh well.

Also fix the incorrect log call on `update_timeout_limit` triggering.
2021-01-20 09:22:11 +01:00
Xavier Morel
b0576d1d41 [IMP] forwardport: cherrypick logging
Enable GIT_TRACE to try and get more information pertaining to the
cherrypicking process during failure.

Related to #449
2021-01-18 07:44:17 +01:00
Xavier Morel
1b7040cd26 [IMP] forwardport: logging during cherrypick process
* fix small error which generated an extra commit in case of conflict
  probably (would create a `temp` commit, then put the conflict
  information on an empty commit on top of it). Avoids committing the
  cherrypick though a probable alternative would be to commit the
  message with `amend`.
* improve the cherrypick header: instead of one log line per commit,
  put all commits within the sole header log line (with a newline),
  should make things less noisy
* put *all* log records below the correct logger (two of them were on
  the toplevel logger)
* log a purported inflateInit error as warning, should be sent to
  Sentry instead of having to wait for people to wonder why the thing
  is completely broken
2021-01-15 14:19:17 +01:00
Xavier Morel
560c6e6b16 [IMP] mergebot: log repr of comments (might show oddities) 2021-01-14 07:42:10 +01:00
Xavier Morel
ba1a8ee089 [IMP] runbot_merge, forwardport: update some logging
Downgrade an error and a warning to info, and upgrade two warnings to
error.

Point is to improve logic of log levels & sentry visibility.

Fixes #258
2021-01-13 16:12:35 +01:00
Xavier Morel
95e35dde90 [IMP] runbot_merge: logging when bumping timeout
I'd forgotten that in order to better handle cases where the CI is
highly backed up (and / or slow for some reason), we actually update
the CI timeout to really take the last "pending" status as the "true
start" of the CI. This might explain why lots of stagings needed extra
time: as of right now, out of 28835 stagings

- 20086 had their timeout bumped by more than 15mn
- 6967 had their timeout bumped by more than 30mn
- 264 had their timeout bumped by more than 1h
- 30 had their timeout bumped by more than 2h

Add some logging every time the CI is bumped this way, so we have
better visibility into that event.

Closes #429
2021-01-13 16:12:35 +01:00
Xavier Morel
3cc87051dd [FIX] runbot_merge: avoid repeatedly warning about the same failures
The mergebot has a feature to ping users when an approved PR or
forward-port suffers from a CI failure, as those PRs might be somewhat
unattended (so the author needs to be warned explicitly).

Because the runbot can send the same failure information multiple
times, the mergebot also has a *deduplication* feature, however this
deduplication feature was too weak to handle the case where the PR has
2+ failures e.g. ci and linting as it only stores the last-seen
failure, and there would be two different failures here.

Worse, because the validation step looks at all required statuses, in
that case it would send a failure ping message for each failed
status *on each inbound status*: first it'd notify about the ci
failure and store that, then it'd see the linting failure, check
against the previous (ci), consider it a new failure, notify, and
store that. Rinse and repeat every time runbot sends a ci *or* lint
failure, leading to a lot of dumb and useless spam.

Fix by storing the entire current failure state (a map of context:
status) instead of just the last-seen status data.

Note: includes a backwards-compatibility shim where we just convert a
stored status into a full `{context: status}` map. This uses the
"current context" because we don't have the original, but if it was a
different context it's not going to match anyway (the target_url
should be different) and if it was the same context then there's a
chance we skip sending a redundant notification.

Fixes #435
2021-01-13 16:12:35 +01:00
Xavier Morel
e175609950 [IMP] forwardport: unmodified fw automatically inherit overrides
Before this change, a CI override would have to be replicated on most
/ all forward-ports of the base PR. This was intentional to see how it
would shake out, the answer being that it's rather annoying.

Also add a `statuses_full` computed field on PRs for the aggregate
status: the existing `statuses` field is just a copy of the commit
statuses which I didn't remember I kept free of the overrides so the
commit statuses could be displayed "as-is" in the backend (the
overrides are displayed separately). And while at it fix the PR
dashboard to use that new field: that was basically the intention but
then I went on to use the "wrong" field hence #433.

Mebbe the UI part should be displayed using a computed M2M (?)
as a table or as tags instead? This m2m could indicate whether the
status is an override or an "intrinsic" status.

Also removed some dead code:

* leftover from the removed tagging feature (removed the tag
  manipulation but forgot some of the setup / computations)
* unused local variables
* an empty skipped test case

Fixes #439.

Fixes #433.
2021-01-13 16:11:14 +01:00
Xavier Morel
d751cf46a0 [IMP] forwardport: add logging to branch reinsertion
When a new branch is created between other branches, the process to
try and look for forward-port PRs to create to "fill in" currently has
no logging so it's very difficult to figure out why it decides not to
do something.

Add some logging to the process to try and better understand what
happens.

Fixes #441
2021-01-12 12:54:37 +01:00