Commit Graph

383 Commits

Author SHA1 Message Date
Christophe Monniez
f9b057840a
[IMP] readme: add the Odoo workflow
Closes #34
2018-09-10 09:50:17 +02:00
Andreas Perhab
3915f3d7ae [IMP] runbot: perform fetch with one git command
Closes: #33
2018-09-06 11:56:58 +02:00
JKE-be
0542b68b92 [IMP] runbot: allow to search multi terms with |
With this feature you can easily search your branch and branch from your team; or your features...

Eg: jke|-website or -jke|-rde|-qsm|...

Closes: #32
2018-09-06 10:03:57 +02:00
Xavier Morel
47c3e752e9 [IMP] runbot_merge: add action for planned PR fetches 2018-09-03 17:53:43 +02:00
Xavier Morel
fd705d241a [IMP] runbot_merge: secret field & titles for o2m tables 2018-09-03 17:50:18 +02:00
Xavier Morel
ec5d60d027 [CHG] runbot_merge: unapprove on PR update
After discussion with mat, rco and moc, if a PR is updated it should
be unapproved for safety reasons: if a reviewer approves a PR, that's
what should be merged, if there are things to fix/change a reviewer
should at least rubberstamp the changes to avoid mistakes.

This is a bit more noisy/constraining, but can be changed or tuned
afterwards if it's considered too constraining.
2018-09-03 13:55:39 +02:00
Xavier Morel
5c4018b91e [ADD] runbot_merge
Does not change anything in runbot itself, so if there's things which
don't work or we need to change we can probably fix them in master
directly.
2018-09-03 13:23:27 +02:00
Xavier Morel
175649cd13 [IMP] runbot_merge: test readme & remove leftover pass 2018-09-03 13:16:36 +02:00
Xavier Morel
2724e47633 [IMP] runbot_merge: readme updates 2018-09-03 13:16:36 +02:00
Xavier Morel
a40b4c20da [ADD] runbot_merge: flag to disable rebase before merge
rebase-and-merge (or squash-merge if pr.commits == 1) remains default,
but there are use cases like forward ports (merge branch X into branch
X+1 so that fixes to X are available in X+1) where we really really
don't want to rebase the source.

This commits implements two alternative merge methods:

If the PR and its target are ~disjoint, perform a straight merge (same
as old default mode).

However if the head of the PR has two parents *and* one of these
parents is a commit of the target, assume this is a merge commit to
fix a conflict (common during forward ports as X+1 will have changed
independently from and incompatibly with X in some ways).

In that case, merge by copying the PR's head atop the
target (basically rebase just that commit, only updating the link to
the parent which is part of target so that it points to the head of
target instead of whatever it was previously).
2018-09-03 13:16:36 +02:00
Xavier Morel
6d7c728471 [CHG] runbot_merge: toggle default merge method to rebase-and-merge
After discussion with al & rco, conclusion was default PR merging method
should be rebase-and-merge for cleaner history.

Add test for that scenario (w/ test for final DAG) and implement this
change.
2018-09-03 13:16:36 +02:00
Xavier Morel
63be381453 [FIX] runbot_merge: testing of batch contents
* Add ids accessor to the remote Model fake
* Explicitly ignore order when unnecessary, a test fails since the
  ordering of prs has been changed for UI purposes. This is only an
  issue for Remote though it's unclear why (as the local Issue/PR
  objects should still have a per-repo sequence)
2018-09-03 13:16:36 +02:00
Xavier Morel
a15ab1c481 [FIX] runbot_merge: work with admin[uid=2]
* correctly fetch the admin's uid when running remote tests
* looks like I had forgotten to add any sort of access rights, so add
  some
2018-09-03 13:16:36 +02:00
Xavier Morel
0afe8797f4 [IMP] runbot_merge: avoid unnecessary fetches
* avoid fetching PRs for un-managed branches if we know up-front
* avoid processing comments with no commands (avoids fetching the
  corresponding PR which we know nothing about yet and which may or
  may not be for a managed branch)
2018-09-03 13:16:36 +02:00
Xavier Morel
cab683ae0f [IMP] runbot_merge: remove "sync PRs", fetch unknown PRs
The old "sync pr" thing is turning out to be a bust, while it
originally worked fine these days it's a catastrophe as the v4 API
performances seem to have significantly degraded, to the point that
fetching all 15k PRs by pages of 100 simply blows up after a few
hundreds/thousands.

Instead, add a table of PRs to sync: if we get notified of a
"compatible" PR (enabled repo & target) which we don't know of, create
an entry in a "fetch jobs" table, then a cron will handle fetching the
PR then fetching/applying all relevant metadata (statuses,
review-comments and reviews).

Also change indexation of Commit(sha) and PR(head) to hash, as btree
indexes are not really sensible for such content (the ordering is
unhelpful and the index locality is awful by design/definition).
2018-09-03 13:16:36 +02:00
Xavier Morel
899ee4e2c4 [IMP] runbot_merge: error-reporting during PR sync 2018-09-03 13:16:36 +02:00
Xavier Morel
76c4d24bf5 [IMP] runbot_merge: don't create unstaged stagings
Previously when splitting staging we'd create two never-staged
stagings. In a system where the stagings get deleted once done
with (succeeeded or failed) that's not really important, but now that
we want to keep stagings around inactive things get problematic as
this method gunks up the stagings table, plus the post-split stagings
would "steal" the original's batches, losing information (relation
between stagings and batches).

Replace these empty stagings with dedicated *split* objects. A batch
can belong to both a staging and a split, the split is deleted once a
new staging has been created from it.

Eventually we may want to make batches shared between stagings (so we
can track the entire history of a batch) but currently that's only
PR-level.
2018-09-03 13:16:36 +02:00
Xavier Morel
8bc90283f8 [IMP] runbot_merge: stop deleting batches & stagings
If we want a dashboard with a history of stagings, maybe not deleting
them would be a good idea.

A replacement for the headless stagings would probably be a good idea:
currently they're created when splitting a failed staging containing
more than one batch, but their only purpose is as splits of existing
batches to be deactivated/deleted to be re-staged (new batches &
stagings are created then as e.g. some of the batches may not be
merge-able anymore) and that's a bit weird.
2018-09-03 13:16:36 +02:00
Xavier Morel
3b0a794c7b [ADD] runbot_merge: trivial dashboard 2018-09-03 13:16:36 +02:00
Xavier Morel
6494ea6cb0 [ADD] runbot_merge: webhook signature support 2018-09-03 13:16:36 +02:00
Xavier Morel
35f33cee6d [FIX] runbot_merge: a few warnings 2018-09-03 13:16:36 +02:00
Xavier Morel
323aa20053 [ADD] runbot_merge: remote github plugin 2018-09-03 13:16:36 +02:00
Xavier Morel
b35a24ca62 [FIX] runbot_merge: undesired merge conflict
Not quite sure why local didn't hit it but don't really care either.
2018-09-03 13:16:36 +02:00
Xavier Morel
50b9943d78 [FIX] runbot_merge: review action is APPROVE
Despite the review *state* being APPROVE*D*.

Fix test & handling in mock github.
2018-09-03 13:16:36 +02:00
Xavier Morel
3de8262b50 [REM] runbot_merge: tests of updating a merged or closed PR
Github apparently doesn't sync merged/closed PRs (which makes sense
but isn't really documented) so strip out test and assume that never
happens (with a log error in case it ever does).
2018-09-03 13:16:36 +02:00
Xavier Morel
7451a94358 [IMP] runbot_merge: PR source branch/label handling
Remote's labels are not entirely under our control as the part before
":" is the *owner* of the source repo => introduce additional "owned"
fixture to handle this case, as it may diverge from the "user" role if
running the tests against an organisation.
2018-09-03 13:16:36 +02:00
Xavier Morel
0725c77323 [IMP] runbot_merge: logging of comment commands (or lack thereof) 2018-09-03 13:16:36 +02:00
Xavier Morel
381c504584 [IMP] runbot_merge: logins -> user roles
Can't really assume we can get the github logins "user" or "reviewer"
to run the test suite remotely, so add an indirection and backronym
those to *roles* instead. The local test suite has identical roles &
logins, but the remote version does not.

Also use the "other" role for any random user, and don't create its
partner up-front.

Also renamed the self-reviewer user to self_reviewer, that's a bit
less weird when dealing with e.g. ini files.
2018-09-03 13:16:36 +02:00
Xavier Morel
91937aac27 [FIX] runbot_merge: incorrect changes spec/order (depth) 2018-09-03 13:16:36 +02:00
Xavier Morel
f67bdd8c5e [FIX] runbot_merge: incorrect relation name in M2O 2018-09-03 13:16:36 +02:00
Xavier Morel
4005eea72a [FIX] runbot_merge: github API error
Turns out PATCH /git/refs/:ref returns a 422 when the ref does not
exist, rather than the 404 I'd expected.

Also improve the error message by including the JSON body which tends
to be more descriptive/helpful than the reason for Github's API.

Maybe I should replace all raise_for_status() by printing the JSON
body instead...
2018-09-03 13:16:36 +02:00
Xavier Morel
d98d40389d [IMP] runbot_merge: pluginify github mock
This is the preparation of an attempt to make these tests work with
both a local github mock (in-memory) and a remote actual github.

Move a bunch of fixtures relying on the specific github
implementation (and odoo-as-library access) to the "local" plugin,
including splitting the "repo" fixture.

The specific fixtures will likely have to be adjusted as the
remote endpoint is fleshed out.
2018-09-03 13:16:36 +02:00
Xavier Morel
5e64f79730 [ADD] runbot_merge: update squash flags when PR commits are updated
If the PR's commits count changes, the squash state should be updated
to match/reflect.
2018-09-03 13:16:36 +02:00
Xavier Morel
df2d19302b [REM] runbot_merge: support for squash+/squash-
AL thinks it's not useful and it's better to always squash/rebase a
single commit & merge multiple. Mark tests as xfail'd instead of
removing them.

Also mark test_edit_retarget_managed as skipped explicitly
2018-09-03 13:16:36 +02:00
Xavier Morel
b30bb09319 [FIX] runbot_merge: when closing a staged PR, cancel the staging 2018-09-03 13:16:36 +02:00
xmo-odoo
7233179d6a [FIX] runbot_merge: only cancel active staging on p=0
Not when any priority is set on any PR…
2018-09-03 13:16:36 +02:00
Xavier Morel
9286b346e8 [FIX] runbot_merge: IDE warnings 2018-09-03 13:16:36 +02:00
Xavier Morel
34497a91b4 [FIX] runbot_merge: don't try to stage urgent PRs in error 2018-09-03 13:16:36 +02:00
Xavier Morel
47428a4580 [IMP] runbot_merge: only label PR if not created merged/closed
Would generate a ton of GH API churn when synchronising.
2018-09-03 13:16:36 +02:00
Xavier Morel
39a0d723af [ADD] runbot_merge: tag PR to signify state changes 2018-09-03 13:16:36 +02:00
Xavier Morel
7033952913 [ADD] runbot_merge: reviews support
Reviews are interpreted like comments and can contain any number of
commands, with the difference that APPROVED and REQUEST_CHANGES are
interpreted as (respectively) r+ and r- prefixes.
2018-09-03 13:16:36 +02:00
Xavier Morel
49c8fdbed2 [IMP] runbot_merge: prioritize p0 more
* p0 cancel existing stagings in order to be staged as soon as
  possible
* p0 PRs should be picked over split batches
* p0 bypass PR-level CI and review requirements
* p0 can be set on any of a batch's PR, matched PRs will be staged
  alongside even if their priority is the default
2018-09-03 13:16:36 +02:00
Xavier Morel
e6f5b84a19 [IMP] runbot_merge: add PR ID to commit message when merging 2018-09-03 13:16:36 +02:00
Xavier Morel
ea9203c359 [IMP] allow delegate reviewers to retry and r- 2018-09-03 13:16:36 +02:00
Xavier Morel
781b679648 [FIX] runbot_merge: de-f-string-ify 2018-09-03 13:16:36 +02:00
Xavier Morel
933559da04 [IMP] runbot_merge: repos shoud be unique
Having the same repository in two different projects makes no sense,
the two projects will conflict with one another.
2018-09-03 13:16:36 +02:00
Xavier Morel
e52d08ecdf [ADD] runbot_merge: a merge bot
No actual dependency on runbot, should be usable completely
independently.
2018-09-03 13:16:36 +02:00
Christophe Monniez
cfba7da06d
[IMP] runbot: skip an additional port for chrome
In a near future, Odoo will use Chrome Headless instead of phantomjs.
Chrome needs a port to listen to and it was decided that it will be
http_port + 2.
With this commit, we ensure that this port is not used by another build.

Closes #30
2018-08-14 13:57:31 +02:00
Olivier Dony
b98b8dedd9 [IMP] runbot: make nginx server_name more specific
Avoids overly generic vhost declaration, and makes config easier to
understand.

We only want to allow such hosts:
    <build_dest>.runbotX.odoo.com
    <build_dest>-<db_name_extension>.runbotX.odoo.com

Where <db_name_extension> is usually "all" or "base".
2018-07-30 12:11:39 +02:00
Christophe Simonis
e815571d14 [ADD] runbot: new /runbot/glances route
Allow to have a glances on sticky builds status.

Closes: #28
2018-06-25 09:26:35 +02:00