Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
infra
kiwi
tcmscontrib
Commits
4e775563
Commit
4e775563
authored
Nov 12, 2021
by
Nicolas Gelot
Browse files
Initial commit
parents
Pipeline
#145940
failed with stage
in 1 minute and 11 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
4e775563
dist/
.gitlab-ci.yml
0 → 100644
View file @
4e775563
image
:
python:3.10-slim
stages
:
-
build
package
:
stage
:
build
before_script
:
-
pip install flit==3.4.0
script
:
-
flit build
README.md
0 → 100644
View file @
4e775563
# Kiwi TCMS Gitlab plugin
Kiwi TCMS Gitlab plugin customizes the creation of Gitlab issue to follow the
E Foundation issue
[
template
](
https://gitlab.e.foundation/e/backlog/-/blob/master/.gitlab/issue_templates/issue-template-bug.md
)
.
## Install
First install the python package
pip install tcms_gitlab_efoundation_plugin
Then update the Kiwi setting like below
```
python
EXTERNAL_BUG_TRACKERS
+=
[
"tcms_gitlab_efoundation_plugin.gitlab.GitlabEFoundation"
]
```
You can also refer to the Kiwi documentation about
[
plugin
](
https://kiwitcms.readthedocs.io/en/latest/plugins/index.html
)
pyproject.toml
0 → 100644
View file @
4e775563
[build-system]
requires
=
[
"flit_core >=3.2,<4"
]
build-backend
=
"flit_core.buildapi"
[project]
name
=
"tcms_gitlab_efoundation_plugin"
version
=
"0.1"
description
=
"Kiwi TCMS Gitlab plugin customizes the creation of Gitlab issue to follow the E Foundation guidelines"
authors
=
[
{name
=
"Nicolas Gelot"
,
email
=
"nicolas.gelot@e.email"
}
,
]
readme
=
"README.md"
classifiers
=
[
"Environment :: Console"
,
"Intended Audience :: Developers"
,
"Intended Audience :: System Administrators"
,
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)"
,
"Operating System :: POSIX"
,
"Programming Language :: Python"
,
"Programming Language :: Python :: 3"
,
"Programming Language :: Python :: 3.8"
,
"Programming Language :: Python :: 3.9"
,
"Programming Language :: Python :: 3.10"
,
"Topic :: Software Development"
,
"Topic :: Software Development :: Libraries :: Python Modules"
,
"Topic :: Software Development :: Quality Assurance"
,
"Topic :: Software Development :: Testing"
,
"Topic :: Software Development :: Testing :: Acceptance"
]
requires-python
=
">=3.8"
dependencies
=
[
"kiwitcms >= 10.4"
,
]
[project.urls]
Source
=
"https://gitlab.e.foundation/e/tools"
[project.entry-points."kiwitcms.plugins"]
tcms_gitlab_efoundation_plugin
=
"tcms_gitlab_efoundation_plugin"
tcms_gitlab_efoundation_plugin/__init__.py
0 → 100644
View file @
4e775563
tcms_gitlab_efoundation_plugin/gitlab.py
0 → 100644
View file @
4e775563
from
tcms.issuetracker.types
import
Gitlab
from
tcms.core.contrib.linkreference.models
import
LinkReference
class
GitlabEFoundation
(
Gitlab
):
def
report_issue_from_testexecution
(
self
,
execution
,
user
):
repo_id
=
self
.
it_class
.
repo_id
(
self
.
bug_system
)
project
=
self
.
rpc
.
projects
.
get
(
repo_id
)
# see https://python-gitlab.readthedocs.io/en/latest/api/gitlab.v4.html#gitlab.v4.objects.ProjectIssueManager
new_issue
=
project
.
issues
.
create
(
{
"title"
:
f
"Failed test:
{
execution
.
case
.
summary
}
"
,
"description"
:
self
.
_report_comment
(
execution
),
}
)
# and also add a link reference that will be shown in the UI
LinkReference
.
objects
.
get_or_create
(
execution
=
execution
,
url
=
new_issue
.
attributes
[
"web_url"
],
is_defect
=
True
,
)
return
new_issue
.
attributes
[
"web_url"
]
def
_report_comment
(
self
,
execution
):
# pylint: disable=no-self-use
"""
Returns the comment which is used in the original defect report.
"""
comment
=
f
"""
- /e/ version:
{
execution
.
build
.
name
}
- Device model(s):
- Device rooted: yes/no
## Summary
Filed from execution
{
execution
.
get_full_url
()
}
and reported by
{
execution
.
assignee
.
username
}
## The problem
**Steps to reproduce**
Run the test case {{execution.case.summary}][
{
execution
.
get_full_url
()
}
]
**What is the current behavior?**
This test case fails with build
{
execution
.
build
.
name
}
**What is the expected correct behavior?**
<What you should see instead>
## Technical informations
**Relevant logs (`adb logcat`)**
<Paste any relevant logs in the codeblock bellow>
```
```
**Relevant screenshots**
<Screenshots of the problem>
## Solutions
**Workaround**
<To get the feature working or at least to make the device usable>
**Possible fixes**
<Any idea to fix the issue or a link to the line of code that might be the cause for this problem>
/label ~Bug
"""
return
comment
tcms_gitlab_efoundation_plugin/menu.py
0 → 100644
View file @
4e775563
from
django.urls
import
reverse_lazy
# Follows the format of ``tcms.settings.common.MENU_ITEMS``
MENU_ITEMS
=
[
(
"View gitlab issue template"
,
reverse_lazy
(
"gitlab-issue-tpl"
)),
]
tcms_gitlab_efoundation_plugin/templates/tcms_gitlab_efoundation_plugin/main.html
0 → 100644
View file @
4e775563
{% extends "base.html" %}
{% load static %}
{% block title %}An example view of Telemetry plugin{% endblock %}
{% block body_class %}cards-pf{% endblock %}
{% block contents %}
<div
class=
"container-fluid container-cards-pf"
>
<div
class=
"row row-cards-pf"
>
<div
class=
"col-sm-12 col-md-12 col-lg-12"
>
<div
class=
"card-pf card-pf-accented card-pf-aggregate-status card-pf-aggregate-status-mini"
>
<h2
class=
"card-pf-title"
>
<span
class=
"pficon pficon-template"
></span>
<span
class=
"card-pf-aggregate-status-count"
>
Gitlab E Foundation plugin installed
</span>
See the page of the
<a
href=
"https://gitlab.e.foundation/e/infra/kiwi/tcms_gitlab_efoundation_plugin"
>
project
</a>
.
</h2>
<div
class=
"card-pf-body"
>
<p
class=
"card-pf-aggregate-status-notifications"
>
<span
class=
"card-pf-aggregate-status-notification"
>
<span
class=
"pficon pficon-info"
></span>
</span>
</p>
</div>
</div>
</div>
</div>
<!-- /row -->
</div>
<!-- /container -->
{% endblock %}
tcms_gitlab_efoundation_plugin/urls.py
0 → 100644
View file @
4e775563
from
django.urls
import
re_path
from
.
import
views
urlpatterns
=
[
re_path
(
r
"gitlab-issue-tpl/$"
,
views
.
Gitlab
.
as_view
(),
name
=
"gitlab-issue-tpl"
),
]
tcms_gitlab_efoundation_plugin/views.py
0 → 100644
View file @
4e775563
from
django.views.generic.base
import
TemplateView
class
Gitlab
(
TemplateView
):
# pylint: disable=missing-permission-required
template_name
=
"tcms_gitlab_efoundation_plugin/main.html"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment