-
Notifications
You must be signed in to change notification settings - Fork 415
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: Import / export of features across environments and orgs #3026
feat: Import / export of features across environments and orgs #3026
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…ures_from_environments
Uffizzi Preview |
@permission_classes([FeatureImportPermissions]) | ||
def feature_import(request: Request, environment_id: int) -> Response: | ||
upload_serializer = FeatureImportUploadSerializer(data=request.data) | ||
upload_serializer.is_valid(raise_exception=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zachaysan I moved this check here to follow standard DRF patterns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Okay yeah that makes more sense.
def feature_import(request: Request, environment_id: int) -> Response: | ||
upload_serializer = FeatureImportUploadSerializer(data=request.data) | ||
upload_serializer.is_valid(raise_exception=True) | ||
_feature_import = upload_serializer.save(environment_id=environment_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name of this variable to stop my IDE complaining about it shadowing the name from the outer scope.
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingChanges
This PR allows someone using Flagsmith to export the information around their feature flags from a given environment in order to import them into another environment even at a different organisation or instance of flagsmith. Changes include:
environment_id
and a list oftag_ids
as part of a post body and kicks off a job to generate the export."Production | 2023-11-23 15:36 UTC"
.id
.SKIP
which skips any existing features that are named the same thing. The second is calledOVERWRITE
which discards an existing feature and related objects before creating a new one to load with.How did you test this code?
Many individual tests for the views and the tasks. To test import and export tasks I elected to test them together to verify the process worked from download to upload. I also manually tested the file download endpoint to make sure the header was correctly set to initiate a download.
I was unable to test the JavaScript friendly file upload API, so although I tried my best to follow guides, the implementer of the frontend (Novak) may want to have me on a video call when he's wiring that part up.