fix(sfcompute): build instance name from RefID and environment ID - #158
Draft
jainvishesh11 wants to merge 1 commit into
Draft
jainvishesh11 wants to merge 1 commit into
jainvishesh11 wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Environment creation on SFCompute v2 fails with:
Root Cause
SFCompute treats the instance name as a unique key per workspace, and every Brev environment on a cloud credential shares one workspace.
CreateInstancesent only the sanitized user-supplied environment name, while the globally unique RefID went to tags only, which SFCompute ignores for uniqueness.Fix
Compose the name from Brev IDs instead of the user's supplied environment name:
Giving e.g.
inst-2toqsvHXfalevkjPXY2QNJZL9HF-p82qfn5qs. The Instance ID is a primary key so the name is unique per instance and the environment ID is also included for searchability.Files changed
v1/providers/sfcomputev2/instance.go: addedmakeSFCName;CreateInstanceuses it instead ofsanitizeSFCName(attrs.Name)v1/providers/sfcomputev2/instance_test.go: added tests for determinism (retry safety) and uniqueness across instancesRelated Ticket
BREV-12012