-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into improve_fix/releases/armenzg
- Loading branch information
Showing
105 changed files
with
2,184 additions
and
1,609 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
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
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 |
---|---|---|
|
@@ -11,6 +11,13 @@ LABEL org.opencontainers.image.authors="[email protected]" | |
# add our user and group first to make sure their IDs get assigned consistently | ||
RUN groupadd -r sentry && useradd -r -m -g sentry sentry | ||
|
||
RUN : \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
libexpat1 \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ARG GOSU_VERSION=1.17 | ||
ARG GOSU_SHA256=bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3 | ||
ARG TINI_VERSION=0.19.0 | ||
|
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,12 @@ | ||
from sentry.api.bases.organization import OrganizationEndpoint | ||
from sentry.api.exceptions import ResourceDoesNotExist | ||
|
||
VALID_PROVIDERS = {"launchdarkly"} | ||
|
||
|
||
class OrganizationFlagsEndpoint(OrganizationEndpoint): | ||
|
||
def convert_args(self, *args, **kwargs): | ||
if kwargs.get("provider", "") not in VALID_PROVIDERS: | ||
raise ResourceDoesNotExist | ||
return super().convert_args(*args, **kwargs) |
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,47 @@ | ||
from datetime import datetime, timezone | ||
|
||
from rest_framework import serializers | ||
from rest_framework.request import Request | ||
from rest_framework.response import Response | ||
|
||
from sentry import features | ||
from sentry.api.api_owners import ApiOwner | ||
from sentry.api.api_publish_status import ApiPublishStatus | ||
from sentry.api.base import region_silo_endpoint | ||
from sentry.flags.endpoints import OrganizationFlagsEndpoint | ||
from sentry.flags.models import FlagWebHookSigningSecretModel | ||
from sentry.models.organization import Organization | ||
|
||
|
||
class FlagWebhookSigningSecretValidator(serializers.Serializer): | ||
secret = serializers.CharField(required=True) | ||
|
||
|
||
@region_silo_endpoint | ||
class OrganizationFlagsWebHookSigningSecretEndpoint(OrganizationFlagsEndpoint): | ||
authentication_classes = () | ||
owner = ApiOwner.REPLAY | ||
permission_classes = () | ||
publish_status = {"POST": ApiPublishStatus.PRIVATE} | ||
|
||
def post(self, request: Request, organization: Organization, provider: str) -> Response: | ||
if not features.has( | ||
"organizations:feature-flag-audit-log", organization, actor=request.user | ||
): | ||
return Response("Not enabled.", status=404) | ||
|
||
validator = FlagWebhookSigningSecretValidator(data=request.data) | ||
if not validator.is_valid(): | ||
return self.respond(validator.errors, status=400) | ||
|
||
FlagWebHookSigningSecretModel.objects.create_or_update( | ||
organization=organization, | ||
provider=provider, | ||
values={ | ||
"created_by": request.user.id, | ||
"date_added": datetime.now(tz=timezone.utc), | ||
"secret": validator.validated_data["secret"], | ||
}, | ||
) | ||
|
||
return Response(status=201) |
Oops, something went wrong.