-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
812 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=================== | ||
Buildout for runbot | ||
=================== | ||
|
||
This module was written to make it convenient to use `buildout based builds <http://pythonhosted.org/anybox.recipe.odoo>`_ on runbot. | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. turn on `Use buildouts` on a repository | ||
#. fill in a regex that allows to differentiate a normal branch name: For runbot, branches should be named ``$version-$sometext`` anyways, so this module's suggestion is to call buildout branches ``buildout-$version-$sometext`` | ||
#. check the value of the field `Buildout section`, this must be the name you use in your buildouts | ||
#. if you use multiple buildouts for the same version to implement some kind of DTAP scenario (you should), you can mark some buildout branch as the one to be used for tests by navigating to the branch and checking `Default for this version` | ||
#. when converting a repository to use buildouts, be sure to remove all dependency branches first. Otherwise, runbot will copy all of them unnecessarily. Then, rebuild some buildout branch, and when it is green, rebuild another branch that is supposed to use the buildout | ||
|
||
Background | ||
========== | ||
|
||
This module will cause buildout branches to be treated radically differently: For buildout branches, the buildout will be run, and any failures reported in the build results. For normal branches, it will search for a buildout branch with a matching version, copy this buildout to a temporary directory, manipulate buildout.cfg to use the branch to be tested and the ports assigned for this instance, then rerun the buildout, then run tests within the buildout environment. | ||
|
||
For this to work, your buildout.cfg needs to contain one addons line:: | ||
|
||
git $the_exact_repo_url_as_configured_in_runbot parts/$repo_name $version | ||
|
||
or if you use pinned branches:: | ||
|
||
git $the_exact_repo_url_as_configured_in_runbot parts/$repo_name $commit_hash branch=$version | ||
|
||
Which then will be replaced by:: | ||
|
||
git $the_exact_repo_url_as_configured_in_runbot parts/$repo_name $commit_hash branch=$current_branchname | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* none currently | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/runbot-addons/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Holger Brunn <hbrunn@therp.nl> | ||
|
||
Do not contact contributors directly about help with questions or problems concerning this addon, but use the `community mailing list <mailto:community@mail.odoo.com>`_ or the `appropriate specialized mailinglist <https://odoo-community.org/groups>`_ for help, and the bug tracker linked in `Bug Tracker`_ above for technical issues. | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2017-2018 Therp BV <http://therp.nl> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from . import models | ||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# © 2017 Therp BV <http://therp.nl> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Buildout for runbot", | ||
"version": "11.0.1.0.0", | ||
"author": "Therp BV,Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"category": "Runbot", | ||
"summary": "Build your branches using buildout", | ||
"depends": [ | ||
'runbot', | ||
], | ||
"data": [ | ||
"views/templates.xml", | ||
"views/runbot_branch.xml", | ||
"views/runbot_repo.xml", | ||
], | ||
"external_dependencies": { | ||
"python": [ | ||
"anybox.recipe.odoo", | ||
"zc.buildout", | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# © 2017 Therp BV <http://therp.nl> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2017-2018 Therp BV <http://therp.nl> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openerp import http | ||
from openerp.addons.runbot.controllers import frontend | ||
|
||
|
||
class Runbot(frontend.Runbot): | ||
def build_info(self, build): | ||
result = super(Runbot, self).build_info(build) | ||
result['uses_buildout'] = build.repo_id.uses_buildout | ||
result['buildout_version'] = build.branch_id.buildout_version | ||
return result | ||
|
||
@http.route( | ||
["/runbot/build/<model('runbot.build'):build>/rerun_buildout"], | ||
type='http', auth="public", methods=['POST'], csrf=False, | ||
) | ||
def build_rerun_buildout(self, build, **post): | ||
if build.sudo().branch_id.buildout_version: | ||
build.sudo().write({ | ||
'state': 'testing', | ||
'result': False, | ||
'job': 'job_10_test_base', | ||
}) | ||
return http.local_redirect('/runbot/repo/%s' % build.repo_id.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[buildout] | ||
parts = odoo | ||
# we need this because the current recipe on pypi is very old | ||
find-links = | ||
https://github.com/anybox/anybox.recipe.odoo/tarball/master/anybox.recipe.odoo-1.9.3.dev0.tar.gz | ||
|
||
[versions] | ||
anybox.recipe.odoo = 1.9.3.dev0 | ||
|
||
[odoo] | ||
recipe = anybox.recipe.odoo:server | ||
|
||
version = git http://github.com/oca/ocb.git odoo 9.0 depth=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2017-2018 Therp BV <http://therp.nl> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from . import runbot_repo | ||
from . import runbot_branch | ||
from . import runbot_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2017 Therp BV <http://therp.nl> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
import re | ||
from openerp import api, fields, models | ||
|
||
|
||
class RunbotBranch(models.Model): | ||
_inherit = 'runbot.branch' | ||
|
||
buildout_default = fields.Boolean('Default buildout') | ||
buildout_version = fields.Char( | ||
compute='_compute_buildout_version', store=True, | ||
) | ||
buildout_section = fields.Char( | ||
'Alternative buildout section', | ||
help='If this branch uses another section then the repo, ' | ||
'fill it in here', | ||
) | ||
buildout_branch_id = fields.Many2one( | ||
'runbot.branch', help='Default buildout branch', | ||
domain='[("repo_id", "=", repo_id)]', | ||
) | ||
|
||
@api.multi | ||
@api.depends( | ||
'name', 'repo_id.uses_buildout', 'repo_id.buildout_branch_pattern' | ||
) | ||
def _compute_buildout_version(self): | ||
for this in self: | ||
if not this.repo_id.uses_buildout: | ||
continue | ||
match = re.match( | ||
this.repo_id.buildout_branch_pattern, this.name.split('/')[-1], | ||
) | ||
if not match: | ||
continue | ||
this.update({'buildout_version': match.groupdict()['version']}) |
Oops, something went wrong.