-
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
fix: Force environments to be different names #5058
fix: Force environments to be different names #5058
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Docker builds report
|
Uffizzi Preview |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5058 +/- ##
=======================================
Coverage 97.43% 97.43%
=======================================
Files 1214 1214
Lines 42253 42264 +11
=======================================
+ Hits 41169 41180 +11
Misses 1084 1084 ☔ View full report in Codecov by Sentry. |
api/environments/views.py
Outdated
existing_environment = Environment.objects.filter( | ||
name=serializer.validated_data["name"], | ||
project=serializer.validated_data["project"], | ||
) | ||
if existing_environment: | ||
raise ValidationError("Existing environment for given name.") |
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 think we can do this in a much simpler way using the serializer as per the PR I linked on the issue (see here)
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.
Sorry I missed the linked PR! I've updated the code to handle this in a similar manner to what you posted.
Changes
This forces new environments to have unique names. This was not intentionally done at the model level because some existing integrations rely on environment names and could break if they were updated to different names to solve existing conflicts.
How did you test this code?
One new test.