-
Notifications
You must be signed in to change notification settings - Fork 373
feat(ui): expose custom registry force sync #2869
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,9 +7,9 @@ | |
| from sqlalchemy import select | ||
| from sqlalchemy.orm import selectinload | ||
|
|
||
| from tracecat.authz.controls import require_scope | ||
| from tracecat.authz.controls import has_scope, require_scope | ||
| from tracecat.db.models import RegistryRepository, RegistryVersion | ||
| from tracecat.exceptions import RegistryError, RegistryNotFound | ||
| from tracecat.exceptions import RegistryError, RegistryNotFound, ScopeDeniedError | ||
| from tracecat.registry.constants import DEFAULT_REGISTRY_ORIGIN | ||
| from tracecat.registry.repositories.schemas import ( | ||
| RegistryRepositoryCreate, | ||
|
|
@@ -122,15 +122,23 @@ async def sync_repository( | |
| if repository.organization_id != self.organization_id: | ||
| raise RegistryNotFound("Registry repository not found") | ||
|
|
||
| target_commit_sha = sync_params.target_commit_sha if sync_params else None | ||
| force = sync_params.force if sync_params else False | ||
| if force and not has_scope( | ||
| self.role.scopes or frozenset(), "org:registry:delete" | ||
| ): | ||
| raise ScopeDeniedError( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents |
||
| required_scopes=["org:registry:delete"], | ||
| missing_scopes=["org:registry:delete"], | ||
| ) | ||
|
Comment on lines
+130
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a caller has Useful? React with 👍 / 👎. |
||
|
|
||
| if repository.origin != DEFAULT_REGISTRY_ORIGIN: | ||
| await check_entitlement( | ||
| self.session, self.role, Entitlement.CUSTOM_REGISTRY | ||
| ) | ||
|
|
||
| actions_service = RegistryActionsService(self.session, self.role) | ||
| last_synced_at = datetime.now(UTC) | ||
| target_commit_sha = sync_params.target_commit_sha if sync_params else None | ||
| force = sync_params.force if sync_params else False | ||
|
|
||
| is_git_ssh = repository.origin.startswith("git+ssh://") | ||
| git_repo_package_name: str | None = None | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.