Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade packages and remove AUTHOR_EMAIL and AUTHOR_NAME because it breaks signed commit #17

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/make-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: "3.9"
python-version: "3.12"

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.7
python_version = 3.12
mypy_path = gitlab2sentry

[mypy-pytest]
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim
FROM python:3.12-slim

WORKDIR /usr/src/app

Expand All @@ -10,6 +10,7 @@ RUN groupadd --gid 1000 appuser \

USER appuser
COPY gitlab2sentry/ gitlab2sentry/
COPY tests/ tests/
COPY run.py run.py
Solvik marked this conversation as resolved.
Show resolved Hide resolved

CMD ["python3", "run.py"]
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ make upgrade
- name: GITLAB_SENTRYCLIRC_MR_TITLE
value: "your sentryclirc mr title"
# Gitlab configuration values
- name: GITLAB_AUTHOR_NAME
value: author-name
- name: GITLAB_AUTHOR_EMAIL
value: your-author-email
- name: GITLAB_GRAPHQL_SUFFIX
value: api/graphql
# - name: GITLAB_MENTIONS
Expand Down
12 changes: 0 additions & 12 deletions gitlab2sentry/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
TEST_DSN_MR_CONTENT,
TEST_DSN_MR_DESCRIPTION,
TEST_DSN_MR_TITLE,
TEST_GITLAB_AUTHOR_EMAIL,
TEST_GITLAB_AUTHOR_NAME,
TEST_GITLAB_GRAPHQL_PAGE_LENGTH,
TEST_GITLAB_GRAPHQL_SUFFIX,
TEST_GITLAB_GRAPHQL_TIMEOUT,
Expand Down Expand Up @@ -138,16 +136,6 @@ def is_test_env(env: str) -> bool:
else int(os.environ["GITLAB_GRAPHQL_PAGE_LENGTH"])
)
GITLAB_GROUP_IDENTIFIER = os.getenv("GITLAB_GROUP_IDENTIFIER", "")
GITLAB_AUTHOR_EMAIL = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'aurais été de l'avis de rajouter une option signed_commit, qui sera en mutual exclusive avec l'author.
Ca eviterait un changement cassant, mais en temporaire ca me va de simplement degager les 2 options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it’s important to apply conditions in this case, as it remains relevant in other setups as well. I'm working on proposing a change that aligns with this approach.

TEST_GITLAB_AUTHOR_EMAIL
if is_test_env(ENV)
else os.environ["GITLAB_AUTHOR_EMAIL"]
)
GITLAB_AUTHOR_NAME = (
TEST_GITLAB_AUTHOR_NAME
if is_test_env(ENV)
else os.environ["GITLAB_AUTHOR_NAME"]
)
GITLAB_PROJECT_CREATION_LIMIT = int(os.getenv("GITLAB_CREATION_DAYS_LIMIT", 30))
GITLAB_RMV_SRC_BRANCH = (
TEST_GITLAB_RMV_SRC_BRANCH
Expand Down
6 changes: 1 addition & 5 deletions gitlab2sentry/utils/gitlab_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
DSN_MR_CONTENT,
DSN_MR_TITLE,
ENV,
GITLAB_AUTHOR_EMAIL,
GITLAB_AUTHOR_NAME,
GITLAB_GRAPHQL_PAGE_LENGTH,
GITLAB_GRAPHQL_SUFFIX,
GITLAB_GRAPHQL_TIMEOUT,
Expand Down Expand Up @@ -207,8 +205,6 @@ def _get_or_create_sentryclirc(
)
f = project.files.create(
{
"author_email": GITLAB_AUTHOR_EMAIL,
"author_name": GITLAB_AUTHOR_NAME,
"branch": branch_name,
"commit_message": SENTRYCLIRC_COM_MSG,
"content": content,
Expand All @@ -220,7 +216,7 @@ def _get_default_mentions(self, project: Project) -> str:
return ", ".join(
[
f"@{member.username}"
for member in project.members.all()
for member in project.members.list(all=True, iterator=True)
if (
member.access_level >= GITLAB_MENTIONS_ACCESS_LEVEL
and member.state != "blocked"
Expand Down
4 changes: 0 additions & 4 deletions helm/values-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ cronjob:
- name: GITLAB_SENTRYCLIRC_MR_TITLE
value: "[gitlab2sentry] Merge me to add sentry to {project_name} or close me"
# Gitlab configuration values
- name: GITLAB_AUTHOR_NAME
value: gitlab2sentry
- name: GITLAB_AUTHOR_EMAIL
value: your-author-email
- name: GITLAB_GRAPHQL_SUFFIX
value: api/graphql
# - name: GITLAB_MENTIONS
Expand Down
18 changes: 5 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
aiohttp==3.8.1
aiohttp==3.10.5
awesome-slugify==1.6.5
certifi==2020.6.20
Solvik marked this conversation as resolved.
Show resolved Hide resolved
chardet==3.0.4
gql==3.2.0
idna==2.10
python-gitlab==2.5.0
gql==3.5.0
python-gitlab==4.10.0
pytz==2022.1
pyyaml==6.0.0
regex==2020.10.28
requests==2.24.0
requests-toolbelt==0.9.1
sentry-sdk==0.19.5
Unidecode==0.4.21
urllib3==1.25.11
requests==2.32.3
sentry-sdk==2.14.0
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self):


class TestGitlabMemberManager:
def all(self):
def list(self, all=True, iterator=True):
return TEST_GITLAB_PROJECT_MEMBERS


Expand Down
4 changes: 1 addition & 3 deletions tests/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,5 @@
TEST_GITLAB_GRAPHQL_SUFFIX = "test-content"
TEST_GITLAB_GRAPHQL_TIMEOUT = 10
TEST_GITLAB_GRAPHQL_PAGE_LENGTH = 0
TEST_GITLAB_AUTHOR_EMAIL = "test-content"
TEST_GITLAB_AUTHOR_NAME = "test-content"
TEST_GITLAB_RMV_SRC_BRANCH = True
TEST_GITLAB_MR_KEYWORD = "sentry"
TEST_GITLAB_MR_KEYWORD = "sentry"
4 changes: 2 additions & 2 deletions tests/test_gitlab_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_get_default_mentions(gitlab_provider_fixture, gitlab_project_fixture):
)
_project_non_blocked_members = [
member
for member in gitlab_project_fixture.members.all()
for member in gitlab_project_fixture.members.list(all=True)
if member.state != "blocked"
]
assert len(_mentioned_members) == len(_project_non_blocked_members)
Expand Down Expand Up @@ -168,4 +168,4 @@ def test_get_all_projects(
]
)
== 1
)
)
Loading