diff --git a/bt5/erp5_test_result/ActionTemplateItem/portal_types/Gitlab%20REST%20Connector/view.xml b/bt5/erp5_test_result/ActionTemplateItem/portal_types/Gitlab%20REST%20Connector/view.xml new file mode 100644 index 0000000000000000000000000000000000000000..7a81d84fe42bccd0b5c34337848af6696da02191 --- /dev/null +++ b/bt5/erp5_test_result/ActionTemplateItem/portal_types/Gitlab%20REST%20Connector/view.xml @@ -0,0 +1,85 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>action_type/object_view</string> + </tuple> + </value> + </item> + <item> + <key> <string>category</string> </key> + <value> <string>object_view</string> </value> + </item> + <item> + <key> <string>condition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>icon</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>view</string> </value> + </item> + <item> + <key> <string>permissions</string> </key> + <value> + <tuple> + <string>View</string> + </tuple> + </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Action Information</string> </value> + </item> + <item> + <key> <string>priority</string> </key> + <value> <float>1.0</float> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>View</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>1</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Expression" module="Products.CMFCore.Expression"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>text</string> </key> + <value> <string>string:${object_url}/GitlabRESTConnector_view</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.py b/bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.py new file mode 100644 index 0000000000000000000000000000000000000000..63a78a69f54057536b3e6762d86620736cc31503 --- /dev/null +++ b/bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2019 Nexedi SARL and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + + +from urllib import quote_plus +from urlparse import urlparse +from urlparse import urljoin +import logging + +from AccessControl import ClassSecurityInfo +import requests + +from Products.ERP5Type import Permissions +from Products.ERP5Type.Globals import InitializeClass +from Products.ERP5Type.XMLObject import XMLObject + + +class GitlabRESTConnector(XMLObject): + """Connects to gitlab v4 REST API. + """ + logger = logging.getLogger(__name__) + security = ClassSecurityInfo() + + def _getRepositoryIdFromRepositoryUrl(self, repository_url): + # repository_url will be https://lab.nexedi.com/user/project.git + # convert this to user%2fproject + username_repo = urlparse(repository_url).path[1:] # remove leading / + if username_repo.endswith('/'): + username_repo = username_repo[:-1] + if username_repo.endswith('.git'): + username_repo = username_repo[:-4] + return quote_plus(username_repo) + + security.declareProtected( + Permissions.AccessContentsInformation, + 'postCommitStatus') + def postCommitStatus(self, repository_url, commit_sha, state, target_url, name): + """Post the build status of a commit. + + https://docs.gitlab.com/ce/api/commits.html#post-the-build-status-to-a-commit + """ + url = urljoin( + self.getUrlString(), + "projects/{id}/statuses/{sha}".format( + id=self._getRepositoryIdFromRepositoryUrl(repository_url), + sha=commit_sha + ) + ) + self.logger.info("posting commit status to %s", url) + response = requests.post( + url, + headers={"PRIVATE-TOKEN": self.getToken()}, + json={ + "state": state, + "target_url": target_url, + "name": name + }, + timeout=5) + response.raise_for_status() + + +InitializeClass(GitlabRESTConnector) diff --git a/bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.xml b/bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.xml new file mode 100644 index 0000000000000000000000000000000000000000..0ff43076f46ed28f6f32c4a5944bbe2394e19cf5 --- /dev/null +++ b/bt5/erp5_test_result/DocumentTemplateItem/portal_components/document.erp5.GitlabRESTConnector.xml @@ -0,0 +1,123 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Document Component" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_recorded_property_dict</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>default_reference</string> </key> + <value> <string>GitlabRESTConnector</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>document.erp5.GitlabRESTConnector</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Document Component</string> </value> + </item> + <item> + <key> <string>sid</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>text_content_error_message</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>text_content_warning_message</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>version</string> </key> + <value> <string>erp5</string> </value> + </item> + <item> + <key> <string>workflow_history</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary> + <item> + <key> <string>component_validation_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> + </pickle> + <pickle> + <tuple> + <none/> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>validate</string> </value> + </item> + <item> + <key> <string>validation_state</string> </key> + <value> <string>validated</string> </value> + </item> + </dictionary> + </list> + </tuple> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml b/bt5/erp5_test_result/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml index 2f1981626a0a16698ee8b2c2e6340f1f9ef91a64..e686e76122b935c1b957fea6d1fd602ef14cbcac 100644 --- a/bt5/erp5_test_result/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml +++ b/bt5/erp5_test_result/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml @@ -33,4 +33,7 @@ <item>SlapOS Agent Test Suite</item> <item>Test Suite</item> </portal_type> + <portal_type id="Web Service Tool"> + <item>Gitlab REST Connector</item> + </portal_type> </allowed_content_type_list> \ No newline at end of file diff --git a/bt5/erp5_test_result/PortalTypePropertySheetTemplateItem/property_sheet_list.xml b/bt5/erp5_test_result/PortalTypePropertySheetTemplateItem/property_sheet_list.xml index 5472a608af50093d2d232c20cc94910f44992fae..1ceacd894871eebc36a04c43a52563196801aacb 100644 --- a/bt5/erp5_test_result/PortalTypePropertySheetTemplateItem/property_sheet_list.xml +++ b/bt5/erp5_test_result/PortalTypePropertySheetTemplateItem/property_sheet_list.xml @@ -13,6 +13,11 @@ <portal_type id="ERP5 Scalability Distributor"> <item>ScalabilityDistributor</item> </portal_type> + <portal_type id="Gitlab REST Connector"> + <item>GitlabRESTConnector</item> + <item>Reference</item> + <item>Url</item> + </portal_type> <portal_type id="Scalability Test Suite"> <item>Arrow</item> <item>ScalabilityTestSuite</item> @@ -58,6 +63,7 @@ <item>TestSuiteConstraint</item> </portal_type> <portal_type id="Test Suite Repository"> + <item>Arrow</item> <item>TestSuiteRepository</item> <item>TestSuiteRepositoryConstraint</item> </portal_type> diff --git a/bt5/erp5_test_result/PortalTypeTemplateItem/portal_types/Gitlab%20REST%20Connector.xml b/bt5/erp5_test_result/PortalTypeTemplateItem/portal_types/Gitlab%20REST%20Connector.xml new file mode 100644 index 0000000000000000000000000000000000000000..3c06672aee43046e6dc8653a268a7674d4d0d825 --- /dev/null +++ b/bt5/erp5_test_result/PortalTypeTemplateItem/portal_types/Gitlab%20REST%20Connector.xml @@ -0,0 +1,60 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Base Type" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>content_icon</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Gitlab REST Connector</string> </value> + </item> + <item> + <key> <string>init_script</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>permission</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Base Type</string> </value> + </item> + <item> + <key> <string>type_class</string> </key> + <value> <string>GitlabRESTConnector</string> </value> + </item> + <item> + <key> <string>type_interface</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>type_mixin</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/bt5/erp5_test_result/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml index 529e9e3de0a95e2cee0da4955c4bd27a34723c3a..bb0539240012ad0494226920aeab0ccac6ce625f 100644 --- a/bt5/erp5_test_result/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml +++ b/bt5/erp5_test_result/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml @@ -19,6 +19,10 @@ <type>ERP5 Scalability Distributor</type> <workflow>edit_workflow, validation_workflow</workflow> </chain> + <chain> + <type>Gitlab REST Connector</type> + <workflow>edit_workflow, validation_workflow</workflow> + </chain> <chain> <type>Scalability Test Suite</type> <workflow>edit_workflow, test_suite_workflow</workflow> @@ -37,7 +41,7 @@ </chain> <chain> <type>Test Result</type> - <workflow>edit_workflow, test_result_workflow</workflow> + <workflow>edit_workflow, test_result_gitlab_interaction_workflow, test_result_workflow</workflow> </chain> <chain> <type>Test Result Line</type> diff --git a/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/GitlabRESTConnector.xml b/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/GitlabRESTConnector.xml new file mode 100644 index 0000000000000000000000000000000000000000..25af24afc2e92059af94ab6a6cacf4ba7a11ce90 --- /dev/null +++ b/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/GitlabRESTConnector.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Property Sheet" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>GitlabRESTConnector</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Property Sheet</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/GitlabRESTConnector/token_property.xml b/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/GitlabRESTConnector/token_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..f0cf5580e95d0f31c9344334e1325f661dbe4594 --- /dev/null +++ b/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/GitlabRESTConnector/token_property.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/string</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Personal access token\n +\n +https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>token_property</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>read_permission</string> </key> + <value> <string>Manage properties</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/TestNode/computer_guid_property.xml b/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/TestNode/computer_guid_property.xml index 8a2286c52940946c5e802e2654ab83fbae03f84f..7a4c480c900e307f1603497f25d55d8203829028 100644 --- a/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/TestNode/computer_guid_property.xml +++ b/bt5/erp5_test_result/PropertySheetTemplateItem/portal_property_sheets/TestNode/computer_guid_property.xml @@ -1,38 +1,38 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Standard Property" module="erp5.portal_type"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>categories</string> </key> - <value> - <tuple> - <string>elementary_type/string</string> - </tuple> - </value> - </item> - <item> - <key> <string>description</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>computer_guid_property</string> </value> - </item> - <item> - <key> <string>portal_type</string> </key> - <value> <string>Standard Property</string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string>computer_guid</string> </value> - </item> - </dictionary> - </pickle> - </record> +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/string</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>computer_guid_property</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>computer_guid</string> </value> + </item> + </dictionary> + </pickle> + </record> </ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view.xml new file mode 100644 index 0000000000000000000000000000000000000000..4882df8be559af10ce95a90319631d72b43a7131 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view.xml @@ -0,0 +1,137 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ERP5 Form" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>action</string> </key> + <value> <string>Base_edit</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>edit_order</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>encoding</string> </key> + <value> <string>UTF-8</string> </value> + </item> + <item> + <key> <string>enctype</string> </key> + <value> <string>multipart/form-data</string> </value> + </item> + <item> + <key> <string>group_list</string> </key> + <value> + <list> + <string>left</string> + <string>right</string> + <string>center</string> + <string>bottom</string> + <string>hidden</string> + </list> + </value> + </item> + <item> + <key> <string>groups</string> </key> + <value> + <dictionary> + <item> + <key> <string>bottom</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>center</string> </key> + <value> + <list> + <string>my_description</string> + </list> + </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>left</string> </key> + <value> + <list> + <string>my_reference</string> + <string>my_url_string</string> + </list> + </value> + </item> + <item> + <key> <string>right</string> </key> + <value> + <list> + <string>my_token</string> + <string>my_translated_validation_state_title</string> + </list> + </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>GitlabRESTConnector_view</string> </value> + </item> + <item> + <key> <string>method</string> </key> + <value> <string>POST</string> </value> + </item> + <item> + <key> <string>name</string> </key> + <value> <string>GitlabRESTConnector_view</string> </value> + </item> + <item> + <key> <string>pt</string> </key> + <value> <string>form_view</string> </value> + </item> + <item> + <key> <string>row_length</string> </key> + <value> <int>4</int> </value> + </item> + <item> + <key> <string>stored_encoding</string> </key> + <value> <string>UTF-8</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Gitlab REST Connector</string> </value> + </item> + <item> + <key> <string>unicode_mode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>update_action</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>update_action_title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_description.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_description.xml new file mode 100644 index 0000000000000000000000000000000000000000..e98bd2614bed171964af7f47a08b452bd9c82b49 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_description.xml @@ -0,0 +1,90 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_description</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_description</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_reference.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_reference.xml new file mode 100644 index 0000000000000000000000000000000000000000..892518905d970fb59f1badfaa6aab7083c31a866 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_reference.xml @@ -0,0 +1,90 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_reference</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_view_mode_reference</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_token.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_token.xml new file mode 100644 index 0000000000000000000000000000000000000000..4a8beeaeb01323755010be152b1043c31ae234e4 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_token.xml @@ -0,0 +1,111 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_token</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_string_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>items</string> </key> + <value> + <list> + <tuple> + <string>FTP</string> + <string>ftp</string> + </tuple> + <tuple> + <string>SFTP</string> + <string>sftp</string> + </tuple> + </list> + </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Token</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_translated_validation_state_title.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_translated_validation_state_title.xml new file mode 100644 index 0000000000000000000000000000000000000000..f8bf5216b58f242f89e84c2b71a6fa143dfe5460 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_translated_validation_state_title.xml @@ -0,0 +1,90 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_translated_validation_state_title</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_view_mode_translated_workflow_state_title</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_url_string.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_url_string.xml new file mode 100644 index 0000000000000000000000000000000000000000..2cde5718370dde8f1858f657c11c6056322bae21 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/GitlabRESTConnector_view/my_url_string.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_url_string</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_string_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>URL</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_annotateCommit.py b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_annotateCommit.py new file mode 100644 index 0000000000000000000000000000000000000000..d40da17dd8c63e4d2277a99a4be65a2c255dc900 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_annotateCommit.py @@ -0,0 +1,18 @@ +"""Annotate a commit with state of the test (running, canceled, success, failed) +""" +portal = context.getPortalObject() + +portal_absolute_url = portal.ERP5Site_getAbsoluteUrl() + +test_suite_data = context.TestResult_getTestSuiteData() +if test_suite_data: + for repository_info in test_suite_data['repository_dict'].values(): + connector_url = repository_info['connector_relative_url'] + if connector_url: + portal.restrictedTraverse(connector_url).postCommitStatus( + repository_info['repository_url'], + repository_info['revision'], + state, + '%s/%s' % ( portal_absolute_url, context.getRelativeUrl() ), + context.getTitle() + ) diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_annotateCommit.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_annotateCommit.xml new file mode 100644 index 0000000000000000000000000000000000000000..c857c6ea3c420eee593329bbc227705034124147 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_annotateCommit.xml @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>TestResult_annotateCommit</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getJumpVCSResultList.py b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getJumpVCSResultList.py index 3b087ed878a9b860b307b5710fa8c002adccd493..affeb5cf235fd99cbd51fe5f23b4308cd33a7581 100644 --- a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getJumpVCSResultList.py +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getJumpVCSResultList.py @@ -1,33 +1,13 @@ "Jump to gitlab or gitweb web interface to view commit" -portal = context.getPortalObject() -test_suite_list = portal.portal_catalog( - portal_type='Test Suite', - validation_state=('validated', 'invalidated'), - title={'query': context.getTitle(), 'key': 'ExactMatch'}) - -if not test_suite_list: - return [] - -test_suite = sorted( - [test_suite.getObject() for test_suite in test_suite_list], - key=lambda test_suite: test_suite.getValidationState() == 'validated')[0] - -# TODO: make this jump test suite - -# decode the reference ( ${buildout_section_id}=${number of commits}-${hash},${buildout_section_id}=${number of commits}-${hash}, ... ) -repository_dict = {} -for repository_string in context.getReference().split(','): - repository_code, revision = repository_string.split('-') - repository_dict[repository_code.split('=')[0]] = revision - +from Products.PythonScripts.standard import Object +test_suite_data = context.TestResult_getTestSuiteData() result_list = [] -from Products.PythonScripts.standard import Object def makeVCSLink(repository_url, revision): # https://user:pass@lab.nexedi.cn/user/repo.git -> https://user:pass@lab.nexedi.cn/user/repo/commit/hash - if 'lab.nexedi.cn' in repository_url and repository_url.endswith('.git'): + if 'lab.nexedi' in repository_url and repository_url.endswith('.git'): repository_url = repository_url[:-len('.git')] if '@' in repository_url: # remove credentials scheme = repository_url.split(':')[0] @@ -49,11 +29,11 @@ def makeVCSLink(repository_url, revision): repository=repository_url, revision=revision) -for repository in test_suite.contentValues(portal_type='Test Suite Repository'): +for repository in test_suite_data['repository_dict'].values(): result_list.append( makeVCSLink( - repository.getProperty('git_url'), - repository_dict[repository.getProperty('buildout_section_id')])) + repository['repository_url'], + repository['revision'])) if len(result_list) == 1: from zExceptions import Redirect diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getTestSuiteData.py b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getTestSuiteData.py new file mode 100644 index 0000000000000000000000000000000000000000..d60f5d627e595afba3508e5cc198fe407ae673d7 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getTestSuiteData.py @@ -0,0 +1,49 @@ +"""Returns info about a test result, a mapping containing: + + test_suite_relative_url: relative url of test suite + repository_dict: for each test suite repository, keyed by buildout section id: + revision: commit sha + repository_url: git url of the repository + commits_count: number of commits + +returns None if test suite cannot be found. +""" +portal = context.getPortalObject() + +test_suite_list = portal.portal_catalog( + portal_type='Test Suite', + validation_state=('validated', 'invalidated'), + title={'query': context.getTitle(), 'key': 'ExactMatch'}) + +if not test_suite_list: + return None + +test_suite = sorted( + [test_suite.getObject() for test_suite in test_suite_list], + key=lambda test_suite: test_suite.getValidationState() == 'validated')[-1] + + +# decode the reference ( ${buildout_section_id}=${number of commits}-${hash},${buildout_section_id}=${number of commits}-${hash} ) +repository_dict = {} +if context.getReference() and '-' in context.getReference(): # tolerate invalid references, especially for tests + for repository_string in context.getReference().split(','): + buildout_section_id_and_commits_count, revision = repository_string.split('-') + buildout_section_id, commits_count = buildout_section_id_and_commits_count.split('=') + repository_dict[buildout_section_id] = { + 'revision': revision, + 'commits_count': int(commits_count), + } + +# add information about test suite repositories +for test_result_repository in test_suite.contentValues(portal_type='Test Suite Repository'): + repository_data = repository_dict.setdefault(test_result_repository.getBuildoutSectionId(), {}) + repository_data['repository_url'] = test_result_repository.getGitUrl() + repository_data['connector_relative_url'] = test_result_repository.getDestination() + +if REQUEST: + REQUEST.RESPONSE.setHeader('content-type', 'application/json; charset=utf-8') + +return { + 'test_suite_relative_url': test_suite.getRelativeUrl(), + 'repository_dict': repository_dict, +} diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getTestSuiteData.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getTestSuiteData.xml new file mode 100644 index 0000000000000000000000000000000000000000..dcb1b9f058a103a3b62d76e629905f0ce6cc5deb --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestResult_getTestSuiteData.xml @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>REQUEST=None</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>TestResult_getTestSuiteData</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuiteRepository_view.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuiteRepository_view.xml index fd45df661948d7a17bc9d3e3a3c5ed480d0153da..7102ad2cd079f5ff6b2d854a24a793035663d196 100644 --- a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuiteRepository_view.xml +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuiteRepository_view.xml @@ -103,7 +103,9 @@ <item> <key> <string>right</string> </key> <value> - <list/> + <list> + <string>my_destination_title</string> + </list> </value> </item> </dictionary> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuiteRepository_view/my_destination_title.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuiteRepository_view/my_destination_title.xml new file mode 100644 index 0000000000000000000000000000000000000000..ff153179b589caa2552344b813ac1a263929fdc9 --- /dev/null +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuiteRepository_view/my_destination_title.xml @@ -0,0 +1,133 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>columns</string> + <string>description</string> + <string>portal_type</string> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_destination_title</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>columns</string> </key> + <value> + <list> + <tuple> + <string>title</string> + <string>Gitlab REST Connector</string> + </tuple> + <tuple> + <string>url_string</string> + <string>URL</string> + </tuple> + <tuple> + <string>translated_validation_state_title</string> + <string>State</string> + </tuple> + </list> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Connector to gitlab API to annotate commits from this repository with test result status.</string> </value> + </item> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_relation_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> + <list> + <tuple> + <string>Gitlab REST Connector</string> + <string>Gitlab REST Connector</string> + </tuple> + </list> + </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Gitlab Connector</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view/listbox.xml b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view/listbox.xml index 46acf2dbb555eb6cfce7871fc6b5a7bde2189cde..ee4bfe23eac3c481569118fa685a21b2dfb1487f 100644 --- a/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view/listbox.xml +++ b/bt5/erp5_test_result/SkinTemplateItem/portal_skins/erp5_test_result/TestSuite_view/listbox.xml @@ -98,6 +98,10 @@ <string>branch</string> <string>Branch</string> </tuple> + <tuple> + <string>destination_title</string> + <string>Gitlab Connector</string> + </tuple> </list> </value> </item> diff --git a/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py b/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py index 3e200d436c539c4e921717bf76063f401e18d9c4..7fbcea6725d836852273847ce5706ed02748aecd 100644 --- a/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py +++ b/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py @@ -3,6 +3,9 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase import json from time import sleep from DateTime import DateTime +import responses +import httplib + class TestTaskDistribution(ERP5TypeTestCase): def afterSetUp(self): @@ -152,7 +155,7 @@ class TestTaskDistribution(ERP5TypeTestCase): self.scalability_distributor.getRelativeUrl()) def test_02b_checkConsistencyOnTestSuite(self): - test_suite, = self._createTestSuite() + test_suite, = self._createTestSuite() # pylint: disable=unbalanced-tuple-unpacking self.tic() test_suite_repository, = test_suite.objectValues(portal_type="Test Suite Repository") self.checkPropertyConstraint(test_suite, 'title', 'ERP5-MASTER') @@ -169,7 +172,7 @@ class TestTaskDistribution(ERP5TypeTestCase): Make sure validation of test suite generate a reference, and revalidating a test suite should not change reference """ - test_suite, = self._createTestSuite() + test_suite, = self._createTestSuite() # pylint: disable=unbalanced-tuple-unpacking self.assertTrue(test_suite.getReference() != None) self.tic() test_suite.invalidate() @@ -187,7 +190,7 @@ class TestTaskDistribution(ERP5TypeTestCase): """ Check the constraint avoiding duplicates of test suites """ - test_suite, = self._createTestSuite() + test_suite, = self._createTestSuite() # pylint: disable=unbalanced-tuple-unpacking self.tic() test_suite_clone = test_suite.Base_createCloneDocument(batch_mode=1) self.assertRaises(ValidationFailed, self.portal.portal_workflow.doActionFor, test_suite_clone, 'validate_action') @@ -360,10 +363,9 @@ class TestTaskDistribution(ERP5TypeTestCase): while a test suite with high priority is waiting for more nodes to speed up. """ for x in range(10): - config_list = json.loads(self.distributor.startTestSuite( - title="COMP%s-Node1" % x)) + json.loads(self.distributor.startTestSuite(title="COMP%s-Node1" % x)) test_suite_list = self._createTestSuite(quantity=3) - test_suite_1, test_suite_2, test_suite_3 = test_suite_list + test_suite_1, test_suite_2, test_suite_3 = test_suite_list # pylint: disable=unbalanced-tuple-unpacking test_suite_list[0].setIntIndex(1) # test suite 1, up to 1 testnode test_suite_list[1].setIntIndex(5) # test suite 2, up to 5 testnodes test_suite_list[2].setIntIndex(8) # test suite 3, up to 10 testnodes @@ -869,7 +871,7 @@ class TestTaskDistribution(ERP5TypeTestCase): It shall be possible on a test suite to define configuration we would like to use to create slapos instance. """ - test_suite, = self._createTestSuite(cluster_configuration=None) + test_suite, = self._createTestSuite(cluster_configuration=None) # pylint: disable=unbalanced-tuple-unpacking self.tic() self.assertEquals('{"configuration_list": [{}]}', self.distributor.generateConfiguration(test_suite.getTitle())) test_suite.setClusterConfiguration("{'foo': 3}") @@ -896,7 +898,7 @@ class TestTaskDistribution(ERP5TypeTestCase): When we have two test suites and we have two test nodes, we should have one test suite distributed per test node """ - test_node_one, test_node_two = self._createTestNode(quantity=2) + test_node_one, test_node_two = self._createTestNode(quantity=2) # pylint: disable=unbalanced-tuple-unpacking test_suite_one = self._createTestSuite(reference_correction=+0, title='one')[0] self._createTestSuite(reference_correction=+1, @@ -989,23 +991,23 @@ class TestTaskDistribution(ERP5TypeTestCase): [test_node_two, ["one", "seven", "height" , "six"]]) # Check that additional test node would get work for missing assignments # No move a test suite is done since in average we miss slots - test_node_three, = self._createTestNode(reference_correction=2) + test_node_three, = self._createTestNode(reference_correction=2) # pylint: disable=unbalanced-tuple-unpacking check([test_node_zero, ["three", "four", "height", "six"]], [test_node_one, ["two", "four", "seven" , "six"]], [test_node_two, ["one", "seven", "height" , "six"]], [test_node_three, ["seven", "height"]]) # With even more test node, check that we move some work to less # busy test nodes - test_node_four, = self._createTestNode(reference_correction=3) - test_node_five, = self._createTestNode(reference_correction=4) + test_node_four, = self._createTestNode(reference_correction=3) # pylint: disable=unbalanced-tuple-unpacking + test_node_five, = self._createTestNode(reference_correction=4) # pylint: disable=unbalanced-tuple-unpacking check([test_node_zero, ["three", "six", "height"]], [test_node_one, ["two", "six", "seven"]], [test_node_two, ["one", "seven", "height"]], [test_node_three, ["four", "seven", "height"]], [test_node_four, ["four", "seven", "height"]], [test_node_five, ["six", "seven", "height"]]) - test_node_six, = self._createTestNode(reference_correction=5) - test_node_seven, = self._createTestNode(reference_correction=6) + test_node_six, = self._createTestNode(reference_correction=5) # pylint: disable=unbalanced-tuple-unpacking + test_node_seven, = self._createTestNode(reference_correction=6) # pylint: disable=unbalanced-tuple-unpacking check([test_node_zero, ["three", "height"]], [test_node_one, ["two", "seven"]], [test_node_two, ["one", "height"]], @@ -1020,7 +1022,7 @@ class TestTaskDistribution(ERP5TypeTestCase): Check that the property max_test_suite on the distributor could be used to customize the quantity of test suite affected per test node """ - test_node, = self._createTestNode(quantity=1) + test_node, = self._createTestNode(quantity=1) # pylint: disable=unbalanced-tuple-unpacking test_suite_list = self._createTestSuite(quantity=5) self.tool.TestTaskDistribution.setMaxTestSuite(None) self.tic() @@ -1040,8 +1042,9 @@ class TestTaskDistribution(ERP5TypeTestCase): When we have two test suites and we have two test nodes, we should have one test suite distributed per test node """ - test_node_one, test_node_two = self._createTestNode(quantity=2, - specialise_value=self.performance_distributor) + test_node_one, test_node_two = self._createTestNode( # pylint: disable=unbalanced-tuple-unpacking + quantity=2, + specialise_value=self.performance_distributor) test_suite_one = self._createTestSuite( title='one', specialise_value=self.performance_distributor)[0] self._createTestSuite(title='two', reference_correction=+1, @@ -1103,7 +1106,6 @@ class TestTaskDistribution(ERP5TypeTestCase): self.assertEqual(set(['test suite 1|COMP32-Node1', 'test suite 2|COMP32-Node1']), set([x['test_suite_title'] for x in config_list])) - revision = 'a=a,b=b,c=c' result = self._createTestResult(test_title='test suite 1|COMP32-Node1', distributor=self.performance_distributor) self.tic() @@ -1410,4 +1412,133 @@ class TestTaskDistribution(ERP5TypeTestCase): self.tic() self._createTestResult(test_title='Periodicity Disabled Test Suite') - self.assertEqual(None, test_suite.getAlarmDate()) \ No newline at end of file + self.assertEqual(None, test_suite.getAlarmDate()) + + +class TestGitlabRESTConnectorInterface(ERP5TypeTestCase): + """Tests for Gitlab commits annotations. + """ + def afterSetUp(self): + connector = self.portal.portal_web_services.newContent( + portal_type='Gitlab REST Connector', + reference='lab.example.com', + url_string='https://lab.example.com/api/v4/', + token='123456' + ) + connector.validate() + + self.project = self.portal.project_module.newContent( + portal_type='Project', + title=self.id() + ) + self.test_suite = self.portal.test_suite_module.newContent( + portal_type='Test Suite', + title=self.id(), + source_project_value=self.project, + ) + self.test_suite.newContent( + portal_type='Test Suite Repository', + branch='master', + git_url='https://lab.example.com/nexedi/test.git', + buildout_section_id='test', + destination_value=connector, + ) + # another unrelated repository, without connector, this + # should not cause any API call. + self.test_suite.newContent( + portal_type='Test Suite Repository', + branch='master', + git_url='https://lab.nexedi.com/nexedi/erp5.git', + buildout_section_id='erp5', + profile_path='software-release/software.cfg' + ) + self.test_suite.validate() + + self.test_result = self.portal.test_result_module.newContent( + portal_type='Test Result', + source_project_value=self.project, + title=self.id(), + reference='erp5=1-dc7b6e2e85e9434a97694a698884b057b7d30286,test=10-cc4c79c003f7cfe0bfcbc7b302eac988110c96ae' + ) + self.post_commit_status_url = \ + 'https://lab.example.com/api/v4/projects/nexedi%2Ftest/statuses/cc4c79c003f7cfe0bfcbc7b302eac988110c96ae' + self.tic() + + def beforeTearDown(self): + self.test_suite.invalidate() + self.tic() + + def _response_callback(self, state): + """Callback for responses, checking that request was correct to mark commit as `state` + """ + def _callback(request): + self.assertEqual( + '123456', + request.headers['PRIVATE-TOKEN']) + + body = json.loads(request.body) + self.assertEqual( + state, + body['state']) + self.assertIn( + self.test_result.getRelativeUrl(), + body['target_url']) + self.assertEqual( + self.id(), + body['name']) + return (httplib.CREATED, {'content-type': 'application/json'}, '{}') + return _callback + + def test_start_test(self): + with responses.RequestsMock() as rsps: + rsps.add_callback( + responses.POST, + self.post_commit_status_url, + self._response_callback('running')) + self.test_result.start() + self.tic() + + def _start_test_result(self): + with responses.RequestsMock() as rsps: + rsps.add( + responses.POST, + self.post_commit_status_url, + {}) + self.test_result.start() + self.tic() + + def test_cancel_test(self): + self._start_test_result() + with responses.RequestsMock() as rsps: + rsps.add_callback( + responses.POST, + self.post_commit_status_url, + self._response_callback('canceled')) + self.test_result.cancel() + self.tic() + + def test_stop_test_success(self): + self._start_test_result() + self.test_result.newContent( + portal_type='Test Result Line', + all_tests=1 + ) + self.test_result.setStringIndex('PASS') + with responses.RequestsMock() as rsps: + rsps.add_callback( + responses.POST, + self.post_commit_status_url, + self._response_callback('success')) + self.test_result.stop() + self.tic() + + def test_stop_test_failure(self): + self._start_test_result() + self.test_result.setStringIndex('FAILED') + with responses.RequestsMock() as rsps: + rsps.add_callback( + responses.POST, + self.post_commit_status_url, + self._response_callback('failed')) + self.test_result.stop() + self.tic() diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow.xml new file mode 100644 index 0000000000000000000000000000000000000000..1a8ffca16c0120b75a95a99d11461d327c5d12f7 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow.xml @@ -0,0 +1,46 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>creation_guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Update gitlab status of commits after test results</string> </value> + </item> + <item> + <key> <string>groups</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>test_result_gitlab_interaction_workflow</string> </value> + </item> + <item> + <key> <string>manager_bypass</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Interaction Workflow Definition</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions.xml new file mode 100644 index 0000000000000000000000000000000000000000..e18bf8cbf778a6808aa24ec39bba4b527d7b1bef --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Interaction" module="Products.ERP5.Interaction"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_mapping</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>interactions</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/cancel.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/cancel.xml new file mode 100644 index 0000000000000000000000000000000000000000..418776a92a53ba81c89f88d66d9cb532f99a24cf --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/cancel.xml @@ -0,0 +1,100 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <list> + <string>TestResult_afterCancel</string> + </list> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>cancel</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>cancel</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>portal_type_group_filter</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>temporary_document_disallowed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/start.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/start.xml new file mode 100644 index 0000000000000000000000000000000000000000..2385149dcdbd2c6d076cd94f7efa970710a6a44d --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/start.xml @@ -0,0 +1,100 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <list> + <string>TestResult_afterStart</string> + </list> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>start</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>start</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>portal_type_group_filter</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>temporary_document_disallowed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/stop.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/stop.xml new file mode 100644 index 0000000000000000000000000000000000000000..4d18441a2c8653d46ca783b3d4a582a3e13d1045 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/interactions/stop.xml @@ -0,0 +1,100 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <list> + <string>TestResult_afterStop</string> + </list> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>stop</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>stop</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>portal_type_group_filter</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>temporary_document_disallowed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts.xml new file mode 100644 index 0000000000000000000000000000000000000000..072c8f6540c07806bee17a34c920ec09b2de1bd5 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Scripts" module="Products.DCWorkflow.Scripts"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_mapping</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>scripts</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterCancel.py b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterCancel.py new file mode 100644 index 0000000000000000000000000000000000000000..be4451f0fbdb071577c85e2b0e4f7791c449a29f --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterCancel.py @@ -0,0 +1 @@ +sci['object'].activate(activity='SQLQueue').TestResult_annotateCommit('canceled') diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterCancel.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterCancel.xml new file mode 100644 index 0000000000000000000000000000000000000000..ca7eaa1724eb36dfb5f9aa426fb5994ed5298192 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterCancel.xml @@ -0,0 +1,70 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>sci</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>TestResult_afterCancel</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStart.py b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStart.py new file mode 100644 index 0000000000000000000000000000000000000000..cd9e2504bbed70d61c48dbc9ebddcc0881f51f47 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStart.py @@ -0,0 +1 @@ +sci['object'].activate(activity='SQLQueue').TestResult_annotateCommit('running') diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStart.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStart.xml new file mode 100644 index 0000000000000000000000000000000000000000..0a373adb122a29811e16995f6926b6023a2162bc --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStart.xml @@ -0,0 +1,70 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>sci</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>TestResult_afterStart</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStop.py b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStop.py new file mode 100644 index 0000000000000000000000000000000000000000..9f23daa3a54c17f2d98df8015060bd28ed959df4 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStop.py @@ -0,0 +1,7 @@ +test_result = sci['object'] + +state = 'failed' +if test_result.getStringIndex() == 'PASS' and test_result.getProperty('all_tests', 0) > 0: + state = 'success' + +test_result.activate(activity='SQLQueue').TestResult_annotateCommit(state) diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStop.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStop.xml new file mode 100644 index 0000000000000000000000000000000000000000..064c0a555bdf0c576cf62c47a462f0865e10cce8 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/scripts/TestResult_afterStop.xml @@ -0,0 +1,70 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>sci</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>TestResult_afterStop</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/variables.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/variables.xml new file mode 100644 index 0000000000000000000000000000000000000000..6ae03699d19840ac42b097dfc0a5f34edd416170 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/variables.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Variables" module="Products.DCWorkflow.Variables"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_mapping</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>variables</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/worklists.xml b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/worklists.xml new file mode 100644 index 0000000000000000000000000000000000000000..c3432aa051eac2d67ec0692a384adb38d1b6bac8 --- /dev/null +++ b/bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_gitlab_interaction_workflow/worklists.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Worklists" module="Products.DCWorkflow.Worklists"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_mapping</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>worklists</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_test_result/bt/dependency_list b/bt5/erp5_test_result/bt/dependency_list index 5baeafc5b1227837c37fd3f0c8f296901189987c..b930b50bab92371477536a6f84905b118494df3c 100644 --- a/bt5/erp5_test_result/bt/dependency_list +++ b/bt5/erp5_test_result/bt/dependency_list @@ -1 +1,2 @@ -erp5_project \ No newline at end of file +erp5_project +erp5_web_service \ No newline at end of file diff --git a/bt5/erp5_test_result/bt/template_action_path_list b/bt5/erp5_test_result/bt/template_action_path_list index fa5330639731199acb035a0b4bc51c39eaee37f5..53c19a44c93dd8670f26526b706bf5b5f653f85e 100644 --- a/bt5/erp5_test_result/bt/template_action_path_list +++ b/bt5/erp5_test_result/bt/template_action_path_list @@ -3,6 +3,7 @@ Benchmark Result | view Cloud Performance Unit Test Distributor | view ERP5 Project Unit Test Distributor | view ERP5 Scalability Distributor | view +Gitlab REST Connector | view Scalability Test Suite | vcs_repository Scalability Test Suite | view SlapOS Agent Distributor | view diff --git a/bt5/erp5_test_result/bt/template_document_id_list b/bt5/erp5_test_result/bt/template_document_id_list index ca38cd260a4e28510afa810497b569b3baabd0be..ddae4f92949be64f0cf0bae890a6889bafb28b3b 100644 --- a/bt5/erp5_test_result/bt/template_document_id_list +++ b/bt5/erp5_test_result/bt/template_document_id_list @@ -2,4 +2,5 @@ document.erp5.TestNode document.erp5.TestSuite document.erp5.TestSuiteRepository document.erp5.ERP5ScalabilityDistributor -document.erp5.SlapOSAgentDistributor \ No newline at end of file +document.erp5.SlapOSAgentDistributor +document.erp5.GitlabRESTConnector \ No newline at end of file diff --git a/bt5/erp5_test_result/bt/template_portal_type_allowed_content_type_list b/bt5/erp5_test_result/bt/template_portal_type_allowed_content_type_list index c7bcb79791e93513c7e89280d6702bb13efd403c..16cbb6a757f48330b1295a73d870567aae02655f 100644 --- a/bt5/erp5_test_result/bt/template_portal_type_allowed_content_type_list +++ b/bt5/erp5_test_result/bt/template_portal_type_allowed_content_type_list @@ -13,4 +13,5 @@ Test Result | Test Result Node Test Suite Module | Scalability Test Suite Test Suite Module | SlapOS Agent Test Suite Test Suite Module | Test Suite -Test Suite | Test Suite Repository \ No newline at end of file +Test Suite | Test Suite Repository +Web Service Tool | Gitlab REST Connector \ No newline at end of file diff --git a/bt5/erp5_test_result/bt/template_portal_type_id_list b/bt5/erp5_test_result/bt/template_portal_type_id_list index 1863eeb721a04787725582eae226432267681e75..fd3eff869eebf316b46caa3490a200bd8b0da064 100644 --- a/bt5/erp5_test_result/bt/template_portal_type_id_list +++ b/bt5/erp5_test_result/bt/template_portal_type_id_list @@ -3,6 +3,7 @@ Benchmark Result Line Cloud Performance Unit Test Distributor ERP5 Project Unit Test Distributor ERP5 Scalability Distributor +Gitlab REST Connector Scalability Test Suite SlapOS Agent Distributor SlapOS Agent Test Suite diff --git a/bt5/erp5_test_result/bt/template_portal_type_property_sheet_list b/bt5/erp5_test_result/bt/template_portal_type_property_sheet_list index ff7a41ea6791d304ae4243715e0c7ad5eab0f794..9e612bd4ecfd26af0f2f33794885eb78511de351 100644 --- a/bt5/erp5_test_result/bt/template_portal_type_property_sheet_list +++ b/bt5/erp5_test_result/bt/template_portal_type_property_sheet_list @@ -4,6 +4,9 @@ Benchmark Result | SortIndex Benchmark Result | Task ERP5 Project Unit Test Distributor | UnitTestDistributor ERP5 Scalability Distributor | ScalabilityDistributor +Gitlab REST Connector | GitlabRESTConnector +Gitlab REST Connector | Reference +Gitlab REST Connector | Url Scalability Test Suite | Arrow Scalability Test Suite | ScalabilityTestSuite Scalability Test Suite | TestSuite @@ -23,6 +26,7 @@ Test Result Node | Task Test Result | Comment Test Result | SortIndex Test Result | Task +Test Suite Repository | Arrow Test Suite Repository | TestSuiteRepository Test Suite Repository | TestSuiteRepositoryConstraint Test Suite | Arrow diff --git a/bt5/erp5_test_result/bt/template_portal_type_workflow_chain_list b/bt5/erp5_test_result/bt/template_portal_type_workflow_chain_list index a6ecf8e57e8059aab263c24f37ae34bb0ed8c100..79574c44d18ca52200da5a1615041011b9c70335 100644 --- a/bt5/erp5_test_result/bt/template_portal_type_workflow_chain_list +++ b/bt5/erp5_test_result/bt/template_portal_type_workflow_chain_list @@ -8,6 +8,8 @@ ERP5 Project Unit Test Distributor | edit_workflow ERP5 Project Unit Test Distributor | validation_workflow ERP5 Scalability Distributor | edit_workflow ERP5 Scalability Distributor | validation_workflow +Gitlab REST Connector | edit_workflow +Gitlab REST Connector | validation_workflow Scalability Test Suite | edit_workflow Scalability Test Suite | test_suite_workflow SlapOS Agent Distributor | edit_workflow @@ -21,6 +23,7 @@ Test Result Line | test_result_workflow Test Result Node | edit_workflow Test Result Node | test_result_workflow Test Result | edit_workflow +Test Result | test_result_gitlab_interaction_workflow Test Result | test_result_workflow Test Suite | edit_workflow Test Suite | test_suite_workflow \ No newline at end of file diff --git a/bt5/erp5_test_result/bt/template_property_sheet_id_list b/bt5/erp5_test_result/bt/template_property_sheet_id_list index 9cd2e5db593754e502e4cd29e9763e979b80df3c..3063a04ae8aa5e14d231267b61a782124d33427d 100644 --- a/bt5/erp5_test_result/bt/template_property_sheet_id_list +++ b/bt5/erp5_test_result/bt/template_property_sheet_id_list @@ -1,4 +1,5 @@ TestSuite +GitlabRESTConnector CommandLineResult TestSuiteRepository TestSuiteRepositoryConstraint diff --git a/bt5/erp5_test_result/bt/template_workflow_id_list b/bt5/erp5_test_result/bt/template_workflow_id_list index b7da9f73fd0b708d0fba651902d72dbb000feb70..a8f411571bae88499d4c39aba4789c41666b5748 100644 --- a/bt5/erp5_test_result/bt/template_workflow_id_list +++ b/bt5/erp5_test_result/bt/template_workflow_id_list @@ -1,3 +1,4 @@ test_node_workflow +test_result_gitlab_interaction_workflow test_result_workflow test_suite_workflow \ No newline at end of file diff --git a/product/ERP5/tests/testXHTML.py b/product/ERP5/tests/testXHTML.py index c92765b2245a2fbcda5745d7f7a227c3e5b06b03..bb17785c63c666516f3cd5efae3202addcb6ad4a 100644 --- a/product/ERP5/tests/testXHTML.py +++ b/product/ERP5/tests/testXHTML.py @@ -443,6 +443,7 @@ class TestXHTML(TestXHTMLMixin): 'erp5_email_reader', 'erp5_commerce', 'erp5_credential', + 'erp5_web_service', 'erp5_test_result', 'erp5_forge',