9
9
class BuildScenario (str , Enum ):
10
10
"""Represents the context in which the build is running."""
11
11
12
- RELEASE = "release" # Official release build from a git tag
12
+ RELEASE = "release" # Official release triggered by a git tag
13
13
PATCH = "patch" # CI build for a patch/pull request
14
- MASTER = "master " # CI build from a merge to the master
14
+ STAGING = "staging " # CI build from a merge to the master
15
15
DEVELOPMENT = "development" # Local build on a developer machine
16
16
17
17
@classmethod
@@ -23,15 +23,14 @@ def infer_scenario_from_environment(cls) -> "BuildScenario":
23
23
patch_id = os .getenv ("version_id" )
24
24
25
25
if git_tag :
26
- scenario = BuildScenario .RELEASE # TODO: git tag won't trigger the pipeline, only the promotion process
26
+ # Release scenario and the git tag will be used for promotion process only
27
+ scenario = BuildScenario .RELEASE
27
28
logger .info (f"Build scenario: { scenario } (git_tag: { git_tag } )" )
28
29
elif is_patch :
29
30
scenario = BuildScenario .PATCH
30
31
logger .info (f"Build scenario: { scenario } (patch_id: { patch_id } )" )
31
32
elif is_evg :
32
- scenario = (
33
- BuildScenario .MASTER
34
- ) # TODO: MASTER -> Staging
33
+ scenario = BuildScenario .STAGING
35
34
logger .info (f"Build scenario: { scenario } (patch_id: { patch_id } )" )
36
35
else :
37
36
scenario = BuildScenario .DEVELOPMENT
@@ -63,7 +62,7 @@ def from_scenario(cls, scenario: BuildScenario) -> "BuildContext":
63
62
git_tag = git_tag ,
64
63
patch_id = patch_id ,
65
64
signing_enabled = signing_enabled ,
66
- version = git_tag or patch_id , # TODO: update this
65
+ version = git_tag or patch_id ,
67
66
)
68
67
69
68
def get_version (self ) -> str :
@@ -76,7 +75,8 @@ def get_version(self) -> str:
76
75
77
76
def get_base_registry (self ) -> str :
78
77
"""Get the base registry URL for the current scenario."""
79
- if self .scenario == BuildScenario .RELEASE :
78
+ # TODO CLOUDP-335471: when working on the promotion process, use the prod registry variable in RELEASE scenario
79
+ if self .scenario == BuildScenario .STAGING :
80
80
return os .environ .get ("STAGING_REPO_URL" )
81
81
else :
82
82
return os .environ .get ("BASE_REPO_URL" )
0 commit comments