@@ -67,7 +67,7 @@ def _create_cr(volcengine_settings: dict[str, str], cr_settings: dict[str, str])
6767@click .option (
6868 "--base-image-tag" ,
6969 required = True ,
70- help = f"Base VeADK image tag can be 'preview', 'latest', or a VeADK version (e.g., { VERSION } ). " ,
70+ help = f"Base VeADK image tag can be 'preview', 'latest', or a VeADK version (e.g., { VERSION } )" ,
7171)
7272@click .option (
7373 "--github-url" ,
@@ -86,48 +86,43 @@ def _create_cr(volcengine_settings: dict[str, str], cr_settings: dict[str, str])
8686)
8787@click .option (
8888 "--access-key" ,
89- default = None ,
90- help = "Volcengine access key" ,
89+ default = getenv ( "VOLCENGINE_ACCESS_KEY" ) ,
90+ help = "Volcengine access key, if not set, will use the value of environment variable VOLCENGINE_ACCESS_KEY " ,
9191)
9292@click .option (
9393 "--secret-key" ,
94- default = None ,
95- help = "Volcengine secret key" ,
94+ default = getenv ( "VOLCENGINE_SECRET_KEY" ) ,
95+ help = "Volcengine secret key, if not set, will use the value of environment variable VOLCENGINE_SECRET_KEY " ,
9696)
9797@click .option (
9898 "--region" ,
9999 default = "cn-beijing" ,
100- help = "Volcengine region" ,
100+ help = "Volcengine region, default is cn-beijing " ,
101101)
102102@click .option (
103- "--cr-domain " ,
104- default = None ,
105- help = "Container Registry domain " ,
103+ "--cr-instance-name " ,
104+ default = DEFAULT_CR_INSTANCE_NAME ,
105+ help = "Container Registry instance name, default is veadk-user-instance " ,
106106)
107107@click .option (
108108 "--cr-namespace-name" ,
109- default = None ,
110- help = "Container Registry namespace name" ,
111- )
112- @click .option (
113- "--cr-region" ,
114- default = None ,
115- help = "Container Registry region" ,
109+ default = DEFAULT_CR_NAMESPACE_NAME ,
110+ help = "Container Registry namespace name, default is veadk-user-namespace" ,
116111)
117112@click .option (
118- "--cr-instance-name " ,
119- default = None ,
120- help = "Container Registry instance name " ,
113+ "--cr-repo " ,
114+ default = DEFAULT_CR_REPO_NAME ,
115+ help = "Container Registry repo, default is veadk-user-repo " ,
121116)
122117@click .option (
123- "--cr-repo " ,
124- default = None ,
125- help = "Container Registry repo " ,
118+ "--cr-region " ,
119+ default = "cn-beijing" ,
120+ help = "Container Registry region, default is cn-beijing " ,
126121)
127122@click .option (
128123 "--function-id" ,
129124 default = None ,
130- help = "Volcengine FaaS function ID" ,
125+ help = "Volcengine FaaS function ID, if not set, a new function will be created automatically " ,
131126)
132127def pipeline (
133128 base_image_tag : str ,
@@ -137,11 +132,10 @@ def pipeline(
137132 access_key : str ,
138133 secret_key : str ,
139134 region : str ,
140- cr_domain : str ,
141- cr_namespace_name : str ,
142- cr_region : str ,
143135 cr_instance_name : str ,
136+ cr_namespace_name : str ,
144137 cr_repo : str ,
138+ cr_region : str ,
145139 function_id : str ,
146140) -> None :
147141 """Integrate a veadk project to volcengine pipeline for CI/CD"""
@@ -150,56 +144,28 @@ def pipeline(
150144 "Welcome use VeADK to integrate your project to volcengine pipeline for CI/CD."
151145 )
152146
153- if not access_key :
154- access_key = getenv ("VOLCENGINE_ACCESS_KEY" )
155- if not secret_key :
156- secret_key = getenv ("VOLCENGINE_SECRET_KEY" )
157-
158147 volcengine_settings = {
159148 "volcengine_access_key" : access_key ,
160149 "volcengine_secret_key" : secret_key ,
161150 "volcengine_region" : region ,
162151 }
163152
164153 cr_settings = {
165- "cr_domain" : cr_domain ,
166- "cr_namespace_name" : cr_namespace_name ,
167- "cr_region" : cr_region ,
154+ "cr_domain" : f"{ cr_instance_name } -{ cr_region } .cr.volces.com" ,
168155 "cr_instance_name" : cr_instance_name ,
156+ "cr_namespace_name" : cr_namespace_name ,
169157 "cr_repo" : cr_repo ,
158+ "cr_region" : cr_region ,
170159 }
171160
172- if not all (cr_settings .values ()):
173- click .echo (
174- "Not all Container Registry (CR) information is specified; it will be auto-completed and created."
175- )
161+ _create_cr (volcengine_settings , cr_settings )
176162
177- for key , value in cr_settings .items ():
178- if key == "cr_domain" and value is None :
179- cr_settings [key ] = (
180- f"{ DEFAULT_CR_INSTANCE_NAME } -cn-beijing.cr.volces.com"
181- )
182- elif key == "cr_namespace_name" and value is None :
183- cr_settings [key ] = DEFAULT_CR_NAMESPACE_NAME
184- elif key == "cr_region" and value is None :
185- cr_settings [key ] = "cn-beijing"
186- elif key == "cr_instance_name" and value is None :
187- cr_settings [key ] = DEFAULT_CR_INSTANCE_NAME
188- elif key == "cr_repo" and value is None :
189- cr_settings [key ] = DEFAULT_CR_REPO_NAME
190-
191- _create_cr (volcengine_settings , cr_settings )
192-
193- click .echo ("Using the following CR configuration:" )
194- click .echo (f"Container Registry domain: { cr_settings ['cr_domain' ]} " )
195- click .echo (
196- f"Container Registry namespace name: { cr_settings ['cr_namespace_name' ]} "
197- )
198- click .echo (f"Container Registry region: { cr_settings ['cr_region' ]} " )
199- click .echo (
200- f"Container Registry instance name: { cr_settings ['cr_instance_name' ]} "
201- )
202- click .echo (f"Container Registry repo: { cr_settings ['cr_repo' ]} " )
163+ click .echo ("Using the following CR configuration:" )
164+ click .echo (f"Container Registry domain: { cr_settings ['cr_domain' ]} " )
165+ click .echo (f"Container Registry namespace name: { cr_settings ['cr_namespace_name' ]} " )
166+ click .echo (f"Container Registry region: { cr_settings ['cr_region' ]} " )
167+ click .echo (f"Container Registry instance name: { cr_settings ['cr_instance_name' ]} " )
168+ click .echo (f"Container Registry repo: { cr_settings ['cr_repo' ]} " )
203169
204170 if not function_id :
205171 click .echo (
0 commit comments