@@ -40,16 +40,7 @@ def infer_scenario_from_environment() -> BuildScenario:
4040
4141@dataclass
4242class BuildContext :
43- """Holds the context of the current build, detected from the environment."""
44-
45- ECR_BASE_URL = "268558157000.dkr.ecr.us-east-1.amazonaws.com"
46-
47- REGISTRY_MAP = {
48- BuildScenario .RELEASE : f"{ ECR_BASE_URL } /julienben/staging-temp" , # TODO: replace with real staging repo
49- BuildScenario .MASTER : f"{ ECR_BASE_URL } /dev" ,
50- BuildScenario .PATCH : f"{ ECR_BASE_URL } /dev" ,
51- BuildScenario .DEVELOPMENT : os .environ .get ("BASE_REPO_URL" ),
52- }
43+ """Define build parameters based on the build scenario."""
5344
5445 scenario : BuildScenario
5546 git_tag : Optional [str ] = None
@@ -72,26 +63,19 @@ def from_scenario(cls, scenario: BuildScenario) -> "BuildContext":
7263 signing_enabled = signing_enabled ,
7364 version = git_tag or patch_id ,
7465 )
75-
76- @classmethod
77- def from_environment (cls ) -> "BuildContext" :
78- """Auto-detect build context from environment variables."""
79- scenario = infer_scenario_from_environment ()
80- return cls .from_scenario (scenario )
8166
8267 def get_version (self ) -> str :
83- """Gets the primary version string for the current build ."""
68+ """Gets the version that will be used to tag the images ."""
8469 if self .scenario == BuildScenario .RELEASE :
8570 return self .git_tag
8671 if self .patch_id :
8772 return self .patch_id
8873 return "latest"
8974
9075 def get_base_registry (self ) -> str :
91- """Get the base registry URL for the current build scenario."""
92- registry = self .REGISTRY_MAP .get (self .scenario )
93- if not registry :
94- raise ValueError (f"No registry defined for scenario { self .scenario } " )
95- logger .info (f"Using registry: { registry } " )
96- return registry
76+ """Get the base registry URL for the current scenario."""
77+ if self .scenario == BuildScenario .RELEASE :
78+ return os .environ .get ("STAGING_REPO_URL" )
79+ else :
80+ return os .environ .get ("BASE_REPO_URL" )
9781
0 commit comments