-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support for extending the TrackerIssue model
- Loading branch information
Showing
9 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
FROM python:3.10-slim | ||
LABEL maintainer="[email protected]" | ||
LABEL maintainer="[email protected]" | ||
LABEL name="tools/tracker-exporter" | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
from tracker_exporter.models.issue import TrackerIssue | ||
from tracker_exporter.utils.helpers import to_snake_case, validate_resource | ||
from tracker_exporter import configure_sentry, run_etl | ||
|
||
from yandex_tracker_client.collections import Issues | ||
|
||
|
||
class CustomIssueFields: | ||
""" | ||
Additional custom fields for Yandex Tracker issue. | ||
Must be created in the Clickhouse issue table. | ||
""" | ||
|
||
def __init__(self, issue: Issues) -> None: | ||
self.foo_custom_field = to_snake_case(validate_resource(issue, "fooCustomField")) | ||
self.bar_custom_field = validate_resource(issue, "barCustomField") | ||
self.baz = True if "baz" in issue.tags else False | ||
|
||
|
||
class ExtendedTrackerIssue(TrackerIssue, CustomIssueFields): | ||
"""Extended Yandex Tracker issue model with custom fields.""" | ||
|
||
def __init__(self, issue: Issues) -> None: | ||
super().__init__(issue) | ||
CustomIssueFields.__init__(self, issue) | ||
|
||
|
||
def main() -> None: | ||
"""Entry point.""" | ||
run_etl( | ||
ignore_exceptions=False, | ||
issue_model=ExtendedTrackerIssue | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
configure_sentry() | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters