Commit Graph

1833 Commits

Author SHA1 Message Date
Xavier Morel
65c303a750 [FIX] runbot_merge: bot info fetch
`r0` is still used afterwards as the response object, so don't
overwrite it when parsing the JSON body.
2024-02-12 10:18:59 +01:00
Xavier Morel
3a4fa494f8 [FIX] runbot_merge: incorrectly named endpoint
Method has the same name as its preceding sibling, so it overwrites
it and one of the endpoints is not accessible.
2024-02-12 10:18:25 +01:00
Xavier-Do
ecfdb5693d [FIX] runbot: branch computation 2024-02-10 10:17:44 +01:00
Xavier-Do
2fa5a6aee7 [IMP] runbot: add has_pr filter 2024-02-09 16:32:25 +01:00
Xavier-Do
a0dd2fa560 [FIX] runbot: fix search limit 2024-02-09 16:32:25 +01:00
Xavier-Do
a7f6a9b157 [IMP] runbot: allow bundle access per name 2024-02-09 16:32:25 +01:00
Xavier-Do
db2da457ad [FIX] runbot: hide legend in new charjs version
The option namespace for label changed  in version 3.0
See https://www.chartjs.org/docs/3.0.2/configuration/legend.html
2024-02-09 16:32:25 +01:00
Christophe Monniez
36fdec11d5 [FIX] runbot: fix errors first and last seen dates
Because of a bad dependency on the compute, the first seen date and last
seen date are not always updated.

e.g.: a new build is scanned and a build is added to a linked error, the
parent error seen dates are not updated.

A test is added to reproduce the case.
2024-02-09 08:22:28 -01:00
Christophe Monniez
89a279d9dd [REL] 17.0 2024-02-09 08:22:28 -01:00
Xavier-Do
b6bc0e3911 [IMP] runbot: allow to disable fetch on start 2024-02-05 12:00:28 +01:00
Xavier-Do
7bbd1271c6 [FIX] runbot: fix tools.py 2024-02-05 11:48:37 +01:00
Xavier-Do
be95c8b364 [FIX] runbot: fix upgrade to 17.0 2024-02-05 10:25:31 +01:00
Christophe Monniez
6dd2580e21 [FIX] runbot: fix various js issues for 17.0 2024-02-05 07:17:31 -01:00
Xavier-Do
8f34312967 [FIX] runbot: adapt js for 17.0 2024-01-30 10:50:58 +01:00
Xavier-Do
3b50f172c0 [FIX] runbot: adapt settings to 17.0 2024-01-30 10:50:58 +01:00
Xavier-Do
a250794432 [FIX] runbot: adapt attrs
remove all attrs in xml views

To help with that, a scripts was written, minimal but sufficent

    #!/usr/bin/python3
    import glob
    import re
    from ast import literal_eval

    def leaf_to_python(leaf):
        if len(leaf) != 3:
            raise ValueError('This script doesnt support leaf', leaf)
        field, operator, value = leaf
        if operator == '=':
            return f'not {field}' if value is False else field if value is True else f'{field} == {value!r}'
        if operator == '!=':
            return f'not {field}' if value is True else field if value is False else f'{field} != {value!r}'
        if operator == 'in':
            return f'{field} in {value!r}'
        if operator == 'not in':
            return f'{field} not in {value!r}'
        raise ValueError('This script doesnt support operator', operator)

    for file in glob.glob('**/*.xml', recursive=True):
        with open(file) as f:
            content = f.read()
            attrs_list = re.findall(r'attrs="{.*}"', content)
            if attrs_list:
                for attrs in attrs_list:
                    match = re.match(r'''attrs="{'(invisible|readonly)': ?(\[.*\])}"''', attrs)
                    attr = match.groups()[0]
                    domain = literal_eval(match.groups()[1])
                    condition = ' and '.join([leaf_to_python(leaf) for leaf in domain])
                    replace = f'{attr}="{condition}"'
                    content = content.replace(attrs, replace)
                with open(file, 'w') as fw:
                    fw.write(content)
2024-01-30 10:50:58 +01:00
Xavier-Do
e83db83533 [REL] runbot: adapt for 17.0 2024-01-30 10:50:58 +01:00
Christophe Monniez
e9fc57816b [FIX] runbot: properly move builds to the merged error
When build errors are merged together, the builds of the merged errors
should be moved to the only error that will be kept.
It 's not the case because the merge method is assigning a compute field
and moreover it was hidden in the tests because the compute was not
triggered.

With this commit, the build_error_link is updated to point to the new
error. The test is modified to properly check the case and also to add a
case when the link already exists.

The access rights are updated to allow admin to unlink the
build_error_link records. Otherwise the action could fail when the link
already exists.
2024-01-30 08:50:12 -01:00
Christophe Monniez
3ff4787788 [FIX] runbot: allow build parsing with same error
When a build that contains the same error that appears two times is
parsed, it crashes because of the unique constraint on build error link.

With this commit, only one link with the same error is created.
Two tests are added for the two cases:
- a new error appearing two times in a same build
- an existing error appearing two times in a same build
2024-01-25 14:31:04 -01:00
Xavier-Do
0b20a834c7 [FIX] runbot: fix typos 2024-01-25 08:44:48 +01:00
Christophe Monniez
b949ea1817 [FIX] runbot: adapt build error search for link model
Since c6f9d1f0c a new model was added to link build errors and builds.
The _search_version and _search_trigger_ids were not adapted to work
with this new model.
2024-01-25 06:41:01 -01:00
Xavier-Do
5406d29f8f [FIX] runbot: fix prepare 2024-01-25 08:40:42 +01:00
Christophe Monniez
c6f9d1f0c5 [IMP] runbot: use real log date on build errors
In the build error view, a list of build is displayed with a confusing
create date. The create date in the list is the creation date of the
build, leading to a confusion with the creation of the build log
creation.

With this commit, the real log creation is used in this view.

To achieve that, the many2many relation is extended with a
log_date which is filled when a build log entry is parsed.
2024-01-24 13:02:22 -01:00
Christophe Monniez
d2bb42264e [IMP] runbot: give more information about known errors 2024-01-24 13:02:22 -01:00
Christophe Monniez
7c0c03753d [IMP] runbot: add warning ribbon when an error is a link
It happens that a user edits or annotates a build error form without
noticing that the error is linked to another one. In that case, the
modification or the note is probably useless. So a warning ribbon should
grab his attention.

While at it, we change the warning ribbon when an error has a test-tag
to not be confused with the link ribbon and also because removing a
test-tag can lead to a real danger (for the mergebot stagings).
2024-01-24 13:02:22 -01:00
Christophe Monniez
ef045c8540 [IMP] runbot: move builds on host page into a tab 2024-01-24 13:02:22 -01:00
Christophe Monniez
05d072d6eb [IMP] runbot: add a frontend button to view batch in backend 2024-01-24 13:02:22 -01:00
Christophe Monniez
c322458c5b [IMP] runbot: add a frontend btn to parse a single log 2024-01-24 13:02:22 -01:00
Christophe Monniez
68892398cd [FIX] runbot: fix error_log parse_log method 2024-01-24 13:02:22 -01:00
Christophe Monniez
c837e7330c [IMP] runbot: remove useless prefix on build errors 2024-01-24 08:54:39 -01:00
Christophe Monniez
6030988560 [IMP] runbot: allow to filter team errors by trigger 2024-01-24 08:54:39 -01:00
Christophe Monniez
bef9dc0e49 [FIX] runbot: properly compute error versions and triggers 2024-01-24 08:54:39 -01:00
Christophe Monniez
f47beb31ba [FIX] runbot: fix the favorites filter bug 2024-01-24 08:54:39 -01:00
Christophe Monniez
2999f92cdb [IMP] runbot: allow to search errors in a single version
When filtering the build error tree view based on the versions equality,
the results may not be what you expect.

e.g.: searching for `versions is equal to 16.0` gives the errors that
appeared in `16.0` (hopefully) but also those which appeared in other
versions too.

With this commit, this search will give the errors that appeared in the
specified version only. When the user wants to list errors that appeared
in `16.0` and other versions too, he has to use the `contains 16.0`
criteria.
2024-01-24 08:54:39 -01:00
Christophe Monniez
08c614a86e [IMP] runbot: add optional fingerprint in error list view 2024-01-24 07:43:33 -01:00
Christophe Monniez
bddac0a645 [IMP] runbot: allow to choose the replacement string
When defining cleaning regex, the replacement character is always the
percent sign as it's hard coded in various methods.

With this commit, a replacement string can be defined by cleaning regex
and fallback to the percent sign by default.
2024-01-24 07:43:33 -01:00
Christophe Monniez
7ce79b434e [IMP] runbot: improve build error cleaning action
With this commit, when build errors are re-cleaned, they are also merged
if the fingerprints when fingerprints are matching.

Also, this fixes the ir_logging compute that associate a build error
so that the active build error is preferred over an inactive one.
2024-01-24 07:43:33 -01:00
Xavier-Do
c513edc6ad [IMP] runbot: allow to use dev foreigh branches
Using dev branch from foreign project to fill missing commits looks like
a bad idea, mainly because the lifecycle of the branches is not the same

In some case, it can be useful to allow that to test a branch with a
future change in the base project that will be needed to make the branch
work. As an example introducing a small api change in odoo to make an
override easier, or introducing a module that may be needed to use
the feature.

This commit changes that by allowing to configure on the project or
bundle if we allow to use foreign bundle as reference *before* checking
the base bundle.
2024-01-24 09:30:10 +01:00
Xavier Morel
95393afde8 [FIX] runbot_merge: extraction of authorship info during rebase
Turns out I've always been mistaken about the handling of quotes
*inside* shell parameters, apparently they are always consumed by the
shell unless nested so

    --foo="bar"

reaches the underlying program as

    --foo=bar

This means when using subprocess (without shell=True), adding the
quotes leads to mishandling of the parameters (as the subprocess now
has quotes it's not equipped to deal with).

This exact error is made in the `--pretty` parameter of git show,
locally this results in the author name and the committer email being
terminated by double quotes although somehow other layers seem to
exclude those from the end result (I assume `commit-tree` strips the
quotes from the envvars under the assumption that users can mistakenly
quote them or something?

Anyway while it does not seem harmful (so far), better safe than
sorry.
2024-01-22 15:36:37 +01:00
Xavier Morel
64d80c276b [FIX] *: tests not working with github actual
Add intermediate forks to a pair of tests, because github now (?)
requires being able to write on a branch to create a PR from it, so
the non-collaborator reviewers were not able to create a PR from a
branch created by user.
2024-01-16 15:07:25 +01:00
Xavier Morel
4b9fb513eb [IMP] *: make to_pr more resilient to webhook delays
Github delivery delays keep getting worse. Depending on what comes
before `to_pr`, this leads it to fail more often as it runs before the
PR it's looking for was signaled to the mergebot.

In order to mitigate this issue, add a wait loop in `to_pr`, waiting
up to 4 seconds for the PR it's looking for before aborting.

Also replace manual lookups by `to_pr` in every method of
`TestPRUpdate` while at it since it hit a few of the issues. And
remove the xfail test case since it seems unlikely github will change
tack (maybe? could be worth testing to be sure).
2024-01-16 15:03:45 +01:00
Xavier Morel
7054c865d7 [FIX] *: ngrok tunnel for 3.x
ngrok 3 scrambled some of the tunnel configuration keys. Most notably,
it replaced the ill-named `bind_tls` by an explicit list of http
`schemes`. Although it *removed* `bind_tls` so the fix is necessary
for ngrok to work again (especially as ngrok2 is reaching EOL).

While at it, improve the tunnel setup somewhat:

- remove fixme which we're probably not going to fix after all
- if we spawn ngrok ourselves, keep the handle around so we can
- kill the process we spawned directly instead of looking it up
  somewhat awkwardly
2024-01-16 14:59:01 +01:00
Xavier Morel
cea1b62ac2 [FIX] runbot_merge: commit messages should be trimmed indeed
Reverts commit 85a7890023 which
untrimmed the commits: while it's *probably* true that git and
github's APIs differ in their treatment of whitespace (in that git
pretty much always terminates the commit message with a newline while
github does not, as far as I understand, though I didn't really
validate it) the issue was that github also trims on *output* when
fetching over the API, something the fake did not do.

So rather than update the test data I should have fixed the fake, but
I failed to realise that at the time. I only realised when I decided
to re-run against github actual (something I rarely do anymore as it's
painfully slow) and it went on to choke on every message I'd updated.
2024-01-16 10:51:37 +01:00
Xavier Morel
45f0c8cc81 [FIX] runbot_merge: rebase logging
The logging line was copied over from the github-api version, but it
was not correctly fixed up to match, leading to a lot of spam on
stderr when debug is enabled (aka spams journalctl on the production
server).

Splat the logging call out of `rebase` and into the various callers,
so they have access to the pr object to log it.
2024-01-16 09:53:57 +01:00
Xavier Morel
1cb31cf2c2 [FIX] runbot_merge: 1.9 version & migration
Forgot to bump the version when creating the migration. Also convert
the migration to a single sql query, although the migration will never
run because I ran the query manually to fix things up after finding
out the data was "dirty" since the new code (assuming only modern
statuses) was merged without running the migration.

Thankfully it looks like the impact was not too severe (because the
legacy statuses should only be present on very old commits / PRs), I
don't remember when I deployed the update but apparently just a pair
of PRs got affected, because their `previous_failure` was the old
style and thus broke the "new failure" check.
2024-01-16 09:44:13 +01:00
Xavier Morel
994cea467c [FIX] runbot_merge: typo in freeze wizard
Forgot to deref the id of the staging we're trying to lock, so the
specific case where we start a freeze with a bump PR and an
outstanding staging in master would instantly blow up.
2024-01-16 07:54:43 +01:00
Xavier-Do
3f260ba08f [FIX] runbot: wakeup child without parent db
A check was add to avoid to wakeup a child if there is a parent database
Most of the time, it was a mistake.

In some case it can be legit, if the parent only creates subbuid without
installing any database.
This commit fixes that by allowing to wake up child if the parent has no
database.
2023-12-15 10:41:21 +01:00
Xavier-Do
fe87569044 [FIX] runbot: allow rebuild when killed
The feature was there but broken, lets fix it.
2023-12-05 10:06:18 +01:00
Xavier-Do
bf2528dbd0 [FIX] runbot: avoid non local redirect
The goal of this feature is to redirect to the build
2023-12-05 10:06:18 +01:00
Xavier Morel
b21fbaf9cc [IMP] runbot_merge: prevent merging empty commits
The low-level APIs used by the staging process don't do any merge
check, so because of the way Git works it's possible for them to merge
commits with content as empty commits, e.g. if something was merged
then backported and the backport was merged on top. This should
trigger a merge failure as we don't really want to merge newly
empty. This is a feature which some high level commands of git
support, kind-of, e.g. by default `git rebase --interactive` will ask
about newly empty commits.

Take care to allow merging already-empty commits, as these do have a
use for signaling, freezes, ....

Fixes #809
2023-11-30 12:45:39 +01:00