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

feat: make notify_error default to true in config #601

Open
wants to merge 3 commits into
base: main
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
2 changes: 2 additions & 0 deletions database/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ class Repository(CodecovBaseModel):
owner = relationship(Owner, foreign_keys=[ownerid], back_populates="repositories")
bot = relationship(Owner, foreign_keys=[bot_id])

created_at = Column(types.DateTime, nullable=True)

__table_args__ = (
Index("repos_slug", "ownerid", "name", unique=True),
Index("repos_service_ids", "ownerid", "service_id", unique=True),
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem
https://github.com/codecov/shared/archive/355b4c38a6403307719a147b70d6dcf17c29bbaf.tar.gz#egg=shared
https://github.com/codecov/shared/archive/38444be0934c5cbdd133a790557a626c01bcb18e.tar.gz#egg=shared
https://github.com/codecov/test-results-parser/archive/1507de2241601d678e514c08b38426e48bb6d47d.tar.gz#egg=test-results-parser
https://github.com/codecov/timestring/archive/d37ceacc5954dff3b5bd2f887936a98a668dda42.tar.gz#egg=timestring
asgiref>=3.7.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ sentry-sdk==1.40.0
# via
# -r requirements.in
# shared
shared @ https://github.com/codecov/shared/archive/355b4c38a6403307719a147b70d6dcf17c29bbaf.tar.gz
shared @ https://github.com/codecov/shared/archive/38444be0934c5cbdd133a790557a626c01bcb18e.tar.gz
# via -r requirements.in
six==1.16.0
# via
Expand Down
15 changes: 10 additions & 5 deletions services/yaml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from shared.torngit.exceptions import TorngitClientError, TorngitError
from shared.validation.exceptions import InvalidYamlException
from shared.yaml import UserYaml
from shared.yaml.user_yaml import OwnerContext
from shared.yaml.user_yaml import OwnerContext, RepoContext

from database.enums import CommitErrorTypes
from database.models import Commit
Expand All @@ -16,15 +16,17 @@


def get_repo_yaml(repository: Repository):
context = OwnerContext(
owner_context = OwnerContext(
owner_onboarding_date=repository.owner.createstamp,
owner_plan=repository.owner.plan,
ownerid=repository.ownerid,
)
repo_context = RepoContext(repo_creation_date=repository.created_at)
return UserYaml.get_final_yaml(
owner_yaml=repository.owner.yaml,
repo_yaml=repository.yaml,
owner_context=context,
owner_context=owner_context,
repo_context=repo_context,
)


Expand Down Expand Up @@ -100,16 +102,19 @@ async def get_current_yaml(commit: Commit, repository_service) -> dict:
extra=dict(repoid=repository.repoid, commit=commit.commitid),
exc_info=True,
)
context = OwnerContext(
owner_context = OwnerContext(
owner_onboarding_date=repository.owner.createstamp,
owner_plan=repository.owner.plan,
ownerid=repository.ownerid,
)
repo_context = RepoContext(repo_creation_date=repository.created_at)

return UserYaml.get_final_yaml(
owner_yaml=repository.owner.yaml,
repo_yaml=repository.yaml,
commit_yaml=commit_yaml,
owner_context=context,
owner_context=owner_context,
repo_context=repo_context,
)


Expand Down
8 changes: 5 additions & 3 deletions tasks/sync_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from shared.reports.types import Change
from shared.torngit.exceptions import TorngitClientError
from shared.yaml import UserYaml
from shared.yaml.user_yaml import OwnerContext
from shared.yaml.user_yaml import OwnerContext, RepoContext

from app import celery_app
from database.models import Commit, Pull, Repository
Expand Down Expand Up @@ -126,15 +126,17 @@ def run_impl_within_lock(
"pull_updated": False,
"reason": "no_bot",
}
context = OwnerContext(
owner_context = OwnerContext(
owner_onboarding_date=repository.owner.createstamp,
owner_plan=repository.owner.plan,
ownerid=repository.ownerid,
)
repo_context = RepoContext(repo_creation_date=repository.created_at)
current_yaml = UserYaml.get_final_yaml(
owner_yaml=repository.owner.yaml,
repo_yaml=repository.yaml,
owner_context=context,
owner_context=owner_context,
repo_context=repo_context,
)
with metrics.timer(f"{self.metrics_prefix}.fetch_pull"):
enriched_pull = async_to_sync(fetch_and_update_pull_request_information)(
Expand Down
2 changes: 2 additions & 0 deletions tasks/tests/unit/test_clean_labels_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
CleanLabelsIndexTask,
OwnerContext,
ReadOnlyArgs,
RepoContext,
ReportService,
UserYaml,
)
Expand Down Expand Up @@ -244,6 +245,7 @@ def test__get_best_effort_commit_yaml_from_db(self, dbsession, mocker):
owner_plan=owner.plan,
owner_onboarding_date=owner.createstamp,
),
repo_context=RepoContext(repo_creation_date=commit.repository.created_at),
)


Expand Down
8 changes: 5 additions & 3 deletions tasks/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
TorngitRepoNotFoundError,
)
from shared.yaml import UserYaml
from shared.yaml.user_yaml import OwnerContext
from shared.yaml.user_yaml import OwnerContext, RepoContext

from app import celery_app
from database.enums import CommitErrorTypes, ReportType
Expand Down Expand Up @@ -464,16 +464,18 @@ def run_impl_within_lock(
commit, repository_service
)
else:
context = OwnerContext(
owner_context = OwnerContext(
owner_onboarding_date=repository.owner.createstamp,
owner_plan=repository.owner.plan,
ownerid=repository.ownerid,
)
repo_context = RepoContext(repo_creation_date=repository.created_at)
commit_yaml = UserYaml.get_final_yaml(
owner_yaml=repository.owner.yaml,
repo_yaml=repository.yaml,
commit_yaml=None,
owner_context=context,
owner_context=owner_context,
repo_context=repo_context,
)

if report_type == ReportType.COVERAGE:
Expand Down
8 changes: 5 additions & 3 deletions tasks/upload_clean_labels_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from shared.torngit.base import TorngitBaseAdapter
from shared.utils.enums import TaskConfigGroup
from shared.yaml import UserYaml
from shared.yaml.user_yaml import OwnerContext
from shared.yaml.user_yaml import OwnerContext, RepoContext

from app import celery_app
from database.models.core import Commit
Expand Down Expand Up @@ -186,16 +186,18 @@ def _get_best_effort_commit_yaml(
commit, repository_service
)
if commit_yaml is None:
context = OwnerContext(
owner_context = OwnerContext(
owner_onboarding_date=repository.owner.createstamp,
owner_plan=repository.owner.plan,
ownerid=repository.ownerid,
)
repo_context = RepoContext(repo_creation_date=repository.created_at)
commit_yaml = UserYaml.get_final_yaml(
owner_yaml=repository.owner.yaml,
repo_yaml=repository.yaml,
commit_yaml=None,
owner_context=context,
owner_context=owner_context,
repo_context=repo_context,
).to_dict()
return commit_yaml

Expand Down
Loading