-
-
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.
Revert "[DEL] runbot_subject_skip: Deprecated because is now supporte…
…d officially" This reverts commit 90306b0.
- Loading branch information
Showing
7 changed files
with
163 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
=================== | ||
runbot_subject_skip | ||
=================== | ||
|
||
This module skip a build based on the commit message. | ||
Inspired by Travis-CI: https://docs.travis-ci.com/user/customizing-the-build#Skipping-a-build | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need create a commit message with the following keywords: | ||
- "[skip ci]" or "[ci skip]" uppercase or lowercase in anywhere | ||
|
||
The builds will be skipped. | ||
|
||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/146/11.0 | ||
|
||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* Just is used the first line of the commit message but in travis they are using all lines. | ||
|
||
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 smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Moisés López <moylop260@vauxoo.com> (https://www.vauxoo.com) | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Funders | ||
------- | ||
|
||
The development of this module has been financially supported by: | ||
|
||
* Vauxoo (https://www.vauxoo.com) | ||
|
||
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,2 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from . import models |
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,18 @@ | ||
# Copyright <2018> <Vauxoo info@vauxoo.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Runbot subject skip", | ||
"summary": "Skip build if commit message has '[ci skip]'", | ||
"version": "11.0.1.0.0", | ||
"category": "runbot", | ||
"website": "https://github.com/OCA/runbot-addons", | ||
"author": "Vauxoo, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"runbot", | ||
], | ||
"data": [ | ||
], | ||
"application": False, | ||
"installable": True, | ||
} |
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,2 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
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,26 @@ | ||
# Copyright <2018> <Vauxoo info@vauxoo.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import re | ||
|
||
from odoo import api, models | ||
|
||
SKIP_WORDS = ['[ci skip]', '[skip ci]'] | ||
SKIP_WORDS_RE = re.compile("|".join(map(re.escape, SKIP_WORDS))) | ||
|
||
|
||
class RunbotBuild(models.Model): | ||
_inherit = "runbot.build" | ||
|
||
def subject_skip(self): | ||
"""Skip build if there is a commit message with one SKIP_WORDS""" | ||
for build in self.filtered(lambda b: | ||
SKIP_WORDS_RE.search(b.subject.lower())): | ||
build._log('subject_skip', 'The commit message skipped this build') | ||
build._skip() | ||
|
||
@api.model | ||
def create(self, values): | ||
build = super().create(values) | ||
build.subject_skip() | ||
return 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,2 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from . import test_runbot_skip_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,39 @@ | ||
# Copyright <2018> <Vauxoo info@vauxoo.com> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
|
||
from odoo.tests.common import TransactionCase | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class TestRunbotSkipBuild(TransactionCase): | ||
|
||
def test_skip_build(self): | ||
"""Test the [ci skip] feature""" | ||
repo = self.env["runbot.repo"].create({ | ||
"name": "https://github.com/ORG/REPO.git", | ||
}) | ||
branch = self.env["runbot.branch"].create({ | ||
"name": "refs/heads/master", | ||
"repo_id": repo.id, | ||
}) | ||
build = self.env["runbot.build"].create({ | ||
"name": "HEAD", | ||
"branch_id": branch.id, | ||
"subject": "Test [ci skip] feature", | ||
}) | ||
self.assertEqual( | ||
build.state, 'done', "State should be done") | ||
self.assertEqual( | ||
build.result, 'skipped', "Result should be skipped") | ||
build = self.env["runbot.build"].create({ | ||
"name": "HEAD", | ||
"branch_id": branch.id, | ||
"subject": "Test no ci skip feature", | ||
}) | ||
self.assertEqual( | ||
build.state, 'pending', "State should be pending") | ||
self.assertNotEqual( | ||
build.result, 'skipped', "Result shouldn't be skipped") |