Skip to content

Commit

Permalink
Merge pull request #85 from vauxoo-dev/9.0-vx-oca-merge-moy
Browse files Browse the repository at this point in the history
[REF] runbot_travis2docker: Enable test_disable option on travis2docker and auto pull image
  • Loading branch information
moylop260 authored Nov 27, 2016
2 parents cdfeb54 + 75dd58e commit 5dbc294
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 62 deletions.
18 changes: 2 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,11 @@ virtualenv:
install:
- git clone https://github.com/Vauxoo/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- pip install gitlab3
- pip install docker-py
- pip install --upgrade --pre travis2docker
- travis_install_nightly
- git clone --depth=1 https://github.com/odoo/odoo-extra ~/odoo-extra
- sed -i '/from matplotlib.font_manager import FontProperties/d' ~/odoo-extra/runbot/runbot.py
- sed -i '/from matplotlib.textpath import TextToPath/d' ~/odoo-extra/runbot/runbot.py
- sed -i '/'matplotlib'/d' ~/odoo-extra/runbot/__openerp__.py
- sed -i "/import test_crawl/d" ~/odoo-extra/runbot/__init__.py
- sed -i 's/base.menu_config/base.menu_administration/g' ~/odoo-extra/runbot/res_config_view.xml
# Change cron interval to avoid interference with tests
- sed -i "s/'interval_number'>1</'interval_number'>120</g" ~/odoo-extra/runbot/runbot.xml

# odoo-extra has a bunch of v9 modules which aren't compatible, remove them
- (cd ~/odoo-extra; rm -rf $(ls | grep -v runbot$))
- if [ "${TESTS}" == "1" ]; then travis_wait docker pull vauxoo/odoo-80-image-shippable-auto; fi
- docker run --restart=always -d -p 5000:5000 --name registry registry:2
- if [[ "${TESTS}" == "1" ]]; then ${TRAVIS_BUILD_DIR}/.travis_requirements.sh; fi

script:
- docker run -d -p 5000:5000 --name registry registry:2
- travis_run_tests

after_success:
Expand Down
21 changes: 21 additions & 0 deletions .travis_requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -v

export DEPS=${HOME}
# odoo-extra has a bunch of v9 modules which aren't compatible, remove them
(cd $DEPS/odoo-extra; rm -rf $(ls | grep -v runbot$))

# odoo version 9.0 compatibility
sed -i 's/base.menu_config/base.menu_administration/g' ${DEPS}/odoo-extra/runbot/res_config_view.xml

# Disabling matplotlib by https://github.com/travis-ci/travis-ci/issues/4948
sed -i '/from matplotlib.font_manager import FontProperties/d' $DEPS/odoo-extra/runbot/runbot.py
sed -i '/from matplotlib.textpath import TextToPath/d' $DEPS/odoo-extra/runbot/runbot.py
sed -i '/'matplotlib'/d' $DEPS/odoo-extra/runbot/__openerp__.py

# Change cron interval to avoid interference with tests
sed -i "s/'interval_number'>1</'interval_number'>60</g" $DEPS/odoo-extra/runbot/runbot.xml

# Disabling test_crawl (native runbot fail)
find ${HOME} -name __init__.py -exec sed -i "/import test_crawl/d" {} \;
1 change: 1 addition & 0 deletions oca_dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
odoo-extra https://github.com/odoo/odoo-extra master
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
travis2docker
2 changes: 1 addition & 1 deletion runbot_travis2docker/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Runbot travis to docker",
"summary": "Generate docker with odoo instance based on .travis.yml",
"version": "8.0.1.0.0",
"version": "9.0.1.1.0",
"category": "runbot",
"website": "https://www.vauxoo.com",
"author": "Vauxoo,Odoo Community Association (OCA)",
Expand Down
4 changes: 3 additions & 1 deletion runbot_travis2docker/models/runbot_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def get_docker_build_cmd(self):
self.ensure_one()
build = self
cmd = [
'docker', 'build', '--no-cache', '-t', build.docker_image,
'docker', 'build', '--pull', '--no-cache', '-t', build.docker_image,
build.dockerfile_path,
]
return cmd
Expand Down Expand Up @@ -168,6 +168,8 @@ def get_docker_run_cmd(self):
'-e', 'PG_LOGS_ENABLE=1',
'-e', 'PG_NON_DURABILITY=1',
'-e', 'START_SSH=1',
'-e', 'TEST_ENABLE=%d' % (
not build.repo_id.travis2docker_test_disable),
'-p', '%d:%d' % (build.port, 8069),
'-p', '%d:%d' % (build.port + 1, 22),
] + pr_cmd_env + cache_cmd_env + [
Expand Down
1 change: 1 addition & 0 deletions runbot_travis2docker/models/runbot_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ class RunbotRepo(models.Model):
"images and docker pull cache images. E.g. localhost:5000. "
"If is empty won't push it. "
"Don't Use this feature if you use just one runbot server.")
travis2docker_test_disable = fields.Boolean('Test Disable?')
89 changes: 45 additions & 44 deletions runbot_travis2docker/views/runbot_repo_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,65 @@
<record id="view_runbot_build_form" model="ir.ui.view">
<field name="model">runbot.build</field>
<field name="inherit_id" ref="runbot.view_build_form"/>
<field name="priority">5</field>
<field name="priority">5</field>
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<field name="introspection"/>
</xpath>
<xpath expr="//header" position="replace">
<xpath expr="//header" position="replace">
<header>
<button name="kill_build" type="object" string="Kill This Build"
help="Kill this build, It will work only with dockerized builds."
confirm="This action can not be cancelled, are you sure?"
groups="runbot.group_runbot_admin" />
<button name="rebuild" type="object" string="Force Rebuild"
help="Kill and Start again."
confirm="This action can not be cancelled, are you sure?"
groups="runbot.group_runbot_admin" />
</header>
<button name="kill_build" type="object" string="Kill This Build"
help="Kill this build, It will work only with dockerized builds."
confirm="This action can not be cancelled, are you sure?"
groups="runbot.group_runbot_admin" />
<button name="rebuild" type="object" string="Force Rebuild"
help="Kill and Start again."
confirm="This action can not be cancelled, are you sure?"
groups="runbot.group_runbot_admin" />
</header>
</xpath>
</field>
</record>
<record id="view_runbot_repo_form" model="ir.ui.view">
<field name="model">runbot.repo</field>
<field name="inherit_id" ref="runbot.view_repo_form"/>
<field name="priority">5</field>
<field name="priority">5</field>
<field name="arch" type="xml">
<xpath expr="//sheet" position="before">
<header>
<button name="update" type="object" string="Update"
groups="runbot.group_runbot_admin"/>
<button name="cron" type="object" string="Cron"
groups="runbot.group_runbot_admin"/>
<!--
<button name="killall" type="object" string="Killall" groups="runbot.group_runbot_admin"/>
-->
</header>
</xpath>
<xpath expr="//div[@class='oe_title']" position="replace">
</xpath>
<xpath expr="//sheet" position="before">
<header>
<button name="update" type="object" string="Update"
groups="runbot.group_runbot_admin"/>
<button name="cron" type="object" string="Cron"
groups="runbot.group_runbot_admin"/>
<!--
<button name="killall" type="object" string="Killall" groups="runbot.group_runbot_admin"/>
-->
</header>
</xpath>
<xpath expr="//div[@class='oe_title']" position="replace">
</xpath>
<xpath expr="//group" position="before">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
<label for="group_ids" class="oe_edit_only"/>
<field name="group_ids" widget="many2many_tags"/>
</xpath>
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
<label for="group_ids" class="oe_edit_only"/>
<field name="group_ids" widget="many2many_tags"/>
</xpath>
<xpath expr="//group" position="replace">
<group>
<group name="parameters" cols="3" string="Paramenters">
<field name="mode"/>
<field name="nginx"/>
<field name="token"/>
<field name="hook_time" readonly="1"/>
</group>
<group name="travis2docker" cols="3" string="Travis2Docker Paramenters">
<field name="is_travis2docker_build"/>
<field name="use_docker_cache"/>
<field name="docker_registry_server"/>
</group>
</group>
</xpath>
<group>
<group name="parameters" cols="3" string="Paramenters">
<field name="mode"/>
<field name="nginx"/>
<field name="token"/>
<field name="hook_time" readonly="1"/>
</group>
<group name="travis2docker" cols="3" string="Travis2Docker Paramenters">
<field name="is_travis2docker_build"/>
<field name="travis2docker_test_disable" attrs="{'invisible': [('is_travis2docker_build', '=', False)]}"/>
<field name="use_docker_cache"/>
<field name="docker_registry_server"/>
</group>
</group>
</xpath>
</field>
</record>

Expand Down

0 comments on commit 5dbc294

Please sign in to comment.