Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into docs/better-openapi-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed Dec 9, 2024
2 parents 5d5dfcc + fa84cda commit 259c946
Show file tree
Hide file tree
Showing 104 changed files with 2,958 additions and 2,172 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.155.0"
".": "2.156.1"
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## [2.156.1](https://github.com/Flagsmith/flagsmith/compare/v2.156.0...v2.156.1) (2024-12-04)


### Bug Fixes

* save versioned segment overrides ([#4892](https://github.com/Flagsmith/flagsmith/issues/4892)) ([f5e3410](https://github.com/Flagsmith/flagsmith/commit/f5e3410dec3ed09ffe99a913836ce2ebd1044a6d))

## [2.156.0](https://github.com/Flagsmith/flagsmith/compare/v2.155.0...v2.156.0) (2024-12-04)


### Features

* combine value + segment change requests for versioned environments ([#4738](https://github.com/Flagsmith/flagsmith/issues/4738)) ([e6b0e2f](https://github.com/Flagsmith/flagsmith/commit/e6b0e2f799d0c6bc513e622ca19b9698f6f76db2))
* Enterprise licensing ([#3624](https://github.com/Flagsmith/flagsmith/issues/3624)) ([fbd1a13](https://github.com/Flagsmith/flagsmith/commit/fbd1a13497ef805e3b23e1877e7ccfe087cf197b))
* Scheduled segment overrides ([#4805](https://github.com/Flagsmith/flagsmith/issues/4805)) ([bb7849c](https://github.com/Flagsmith/flagsmith/commit/bb7849c799fff98c1750adf1d5a057479994d41b))
* tag based permissions ([#4853](https://github.com/Flagsmith/flagsmith/issues/4853)) ([7c4e2ff](https://github.com/Flagsmith/flagsmith/commit/7c4e2ff23ea66bf8e3dfb57b3492454a831b1bed))


### Bug Fixes

* add migration to clean up corrupt data caused by feature versioning ([#4873](https://github.com/Flagsmith/flagsmith/issues/4873)) ([e17f92d](https://github.com/Flagsmith/flagsmith/commit/e17f92df02c5b08a8f6ba498ce49185d37beb994))
* button style ([#4884](https://github.com/Flagsmith/flagsmith/issues/4884)) ([679acdd](https://github.com/Flagsmith/flagsmith/commit/679acdd26cb18f16626a4809caa0aea65060e466))
* cannot create new segments due to segment validation ([#4886](https://github.com/Flagsmith/flagsmith/issues/4886)) ([05ab7cf](https://github.com/Flagsmith/flagsmith/commit/05ab7cf876611de613aececc0f70f5987955e446))
* Set Hubspot cookie name from request body ([#4880](https://github.com/Flagsmith/flagsmith/issues/4880)) ([7d3b253](https://github.com/Flagsmith/flagsmith/commit/7d3b2531c9abc02aceeee5193472ddc92bc772ac))

## [2.155.0](https://github.com/Flagsmith/flagsmith/compare/v2.154.0...v2.155.0) (2024-12-03)


Expand Down
2 changes: 1 addition & 1 deletion api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ POETRY_VERSION ?= 1.8.3
GUNICORN_LOGGER_CLASS ?= util.logging.GunicornJsonCapableLogger

SAML_REVISION ?= v1.6.4
RBAC_REVISION ?= v0.11.1
RBAC_REVISION ?= v0.11.2

-include .env-local
-include $(DOTENV_OVERRIDE_FILE)
Expand Down
7 changes: 6 additions & 1 deletion api/app/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,9 @@

SECURE_REDIRECT_EXEMPT = env.list("DJANGO_SECURE_REDIRECT_EXEMPT", default=[])
SECURE_REFERRER_POLICY = env.str("DJANGO_SECURE_REFERRER_POLICY", default="same-origin")
SECURE_CROSS_ORIGIN_OPENER_POLICY = env.str("DJANGO_SECURE_CROSS_ORIGIN_OPENER_POLICY", default="same-origin")
SECURE_CROSS_ORIGIN_OPENER_POLICY = env.str(
"DJANGO_SECURE_CROSS_ORIGIN_OPENER_POLICY", default="same-origin"
)
SECURE_SSL_HOST = env.str("DJANGO_SECURE_SSL_HOST", default=None)
SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=False)

Expand Down Expand Up @@ -1008,6 +1010,9 @@
"ENABLE_TASK_PROCESSOR_HEALTH_CHECK", default=False
)

# Allows us to prevent the postpone decorator from running things async
ENABLE_POSTPONE_DECORATOR = env.bool("ENABLE_POSTPONE_DECORATOR", default=True)

ENABLE_CLEAN_UP_OLD_TASKS = env.bool("ENABLE_CLEAN_UP_OLD_TASKS", default=True)
TASK_DELETE_RETENTION_DAYS = env.int("TASK_DELETE_RETENTION_DAYS", default=30)
TASK_DELETE_BATCH_SIZE = env.int("TASK_DELETE_BATCH_SIZE", default=2000)
Expand Down
2 changes: 2 additions & 0 deletions api/app/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@
3wIDAQAB
-----END PUBLIC KEY-----
"""

ENABLE_POSTPONE_DECORATOR = False
1 change: 1 addition & 0 deletions api/audit/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def get_audited_instance_from_audit_log_record(
uuid=audit_log_record.related_object_uuid,
environment=audit_log_record.environment,
)
.select_related("feature")
.first()
)

Expand Down
1 change: 1 addition & 0 deletions api/audit/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def signal_wrapper(sender, instance, **kwargs):
RelatedObjectType.FEATURE.name,
RelatedObjectType.FEATURE_STATE.name,
RelatedObjectType.SEGMENT.name,
RelatedObjectType.EF_VERSION.name,
]:
return None
return signal_function(sender, instance, **kwargs)
Expand Down
71 changes: 27 additions & 44 deletions api/integrations/dynatrace/dynatrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import requests

from audit.models import AuditLog
from audit.related_object_type import RelatedObjectType
from features.models import Feature
from audit.services import get_audited_instance_from_audit_log_record
from features.models import Feature, FeatureState
from features.versioning.models import EnvironmentFeatureVersion
from integrations.common.wrapper import AbstractBaseEventIntegrationWrapper
from segments.models import Segment

Expand Down Expand Up @@ -57,45 +58,27 @@ def generate_event_data(audit_log_record: AuditLog) -> dict:


def _get_deployment_name(audit_log_record: AuditLog) -> str:
try:
related_object_type = RelatedObjectType[audit_log_record.related_object_type]

if related_object_type in (
RelatedObjectType.FEATURE,
RelatedObjectType.FEATURE_STATE,
):
return _get_deployment_name_for_feature(
audit_log_record.related_object_id, related_object_type
)
elif related_object_type == RelatedObjectType.SEGMENT:
return _get_deployment_name_for_segment(audit_log_record.related_object_id)
except KeyError:
pass

# use 'Deployment' as a fallback to maintain current behaviour in the
# event that we cannot determine the correct name to return.
return DEFAULT_DEPLOYMENT_NAME


def _get_deployment_name_for_feature(
object_id: int, object_type: RelatedObjectType
) -> str:
qs = Feature.objects.all_with_deleted()
if object_type == RelatedObjectType.FEATURE:
qs = qs.filter(id=object_id)
elif object_type == RelatedObjectType.FEATURE_STATE:
qs = qs.filter(feature_states__id=object_id).distinct()

if feature := qs.first():
return f"Flagsmith Deployment - Flag Changed: {feature.name}"

# use 'Deployment' as a fallback to maintain current behaviour in the
# event that we cannot determine the correct name to return.
return DEFAULT_DEPLOYMENT_NAME


def _get_deployment_name_for_segment(object_id: int) -> str:
if segment := Segment.live_objects.all_with_deleted().filter(id=object_id).first():
return f"Flagsmith Deployment - Segment Changed: {segment.name}"

return DEFAULT_DEPLOYMENT_NAME
audited_instance = get_audited_instance_from_audit_log_record(audit_log_record)

if isinstance(audited_instance, Feature):
deployment_name = _get_deployment_name_for_feature(audited_instance)
elif isinstance(audited_instance, FeatureState) or isinstance(
audited_instance, EnvironmentFeatureVersion
):
deployment_name = _get_deployment_name_for_feature(audited_instance.feature)
elif isinstance(audited_instance, Segment):
deployment_name = _get_deployment_name_for_segment(audited_instance)
else:
# use 'Deployment' as a fallback to maintain current behaviour in the
# event that we cannot determine the correct name to return.
deployment_name = DEFAULT_DEPLOYMENT_NAME

return deployment_name


def _get_deployment_name_for_feature(feature: Feature) -> str:
return f"Flagsmith Deployment - Flag Changed: {feature.name}"


def _get_deployment_name_for_segment(segment: Segment) -> str:
return f"Flagsmith Deployment - Segment Changed: {segment.name}"
7 changes: 7 additions & 0 deletions api/integrations/grafana/mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
FeatureState,
FeatureStateValue,
)
from features.versioning.models import EnvironmentFeatureVersion
from integrations.grafana.types import GrafanaAnnotation
from segments.models import Segment

Expand Down Expand Up @@ -49,6 +50,12 @@ def _get_instance_tags_from_audit_log_record(
*_get_feature_tags(feature),
]

if isinstance(instance, EnvironmentFeatureVersion):
return [
f"feature:{instance.feature.name}",
*_get_feature_tags(instance.feature),
]

return []


Expand Down
38 changes: 9 additions & 29 deletions api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ hubspot-api-client = "^8.2.1"
djangorestframework-dataclasses = "^1.3.1"
pyotp = "^2.9.0"
flagsmith-task-processor = { git = "https://github.com/Flagsmith/flagsmith-task-processor", tag = "v1.0.2" }
flagsmith-common = { git = "https://github.com/Flagsmith/flagsmith-common", tag = "v1.2.0" }
flagsmith-common = { git = "https://github.com/Flagsmith/flagsmith-common", tag = "v1.4.2" }
tzdata = "^2024.1"
djangorestframework-simplejwt = "^5.3.1"

Expand All @@ -196,7 +196,7 @@ flagsmith-ldap = { git = "https://github.com/flagsmith/flagsmith-ldap", tag = "v
optional = true

[tool.poetry.group.workflows.dependencies]
workflows-logic = { git = "https://github.com/flagsmith/flagsmith-workflows", tag = "v2.7.0" }
workflows-logic = { git = "https://github.com/flagsmith/flagsmith-workflows", tag = "v2.7.4" }

[tool.poetry.group.dev.dependencies]
django-test-migrations = "~1.2.0"
Expand Down
Loading

0 comments on commit 259c946

Please sign in to comment.