@@ -84,11 +84,17 @@ def run_cli(self, args):
8484 raise ChipFlowError (
8585 "Key `chipflow.project_id` is not defined in chipflow.toml; "
8686 "see https://chipflow.io/beta for details on how to join the beta" )
87- if ( "CHIPFLOW_API_KEY_ID" not in os . environ or
88- "CHIPFLOW_API_KEY_SECRET" not in os .environ ):
87+ # Check for CHIPFLOW_API_KEY_SECRET or CHIPFLOW_API_KEY
88+ if not os . environ . get ( "CHIPFLOW_API_KEY" ) and not os .environ . get ( "CHIPFLOW_API_KEY_SECRET" ):
8989 raise ChipFlowError (
90- "Environment variables `CHIPFLOW_API_KEY_ID` and `CHIPFLOW_API_KEY_SECRET` "
91- "must be set in order to submit a design" )
90+ "Environment variable `CHIPFLOW_API_KEY` must be set to submit a design."
91+ )
92+ # Log a deprecation warning if CHIPFLOW_API_KEY_SECRET is used
93+ if os .environ .get ("CHIPFLOW_API_KEY_SECRET" ):
94+ logger .warning (
95+ "Environment variable `CHIPFLOW_API_KEY_SECRET` is deprecated. "
96+ "Please migrate to using `CHIPFLOW_API_KEY` instead."
97+ )
9298
9399 rtlil_path = self .prepare () # always prepare before submission
94100 if args .action == "submit" :
@@ -104,6 +110,11 @@ def prepare(self):
104110 def submit (self , rtlil_path , * , dry_run = False , wait = False ):
105111 """Submit the design to the ChipFlow cloud builder.
106112 """
113+ chipflow_api_key = os .environ .get ("CHIPFLOW_API_KEY" ) or os .environ .get ("CHIPFLOW_API_KEY_SECRET" )
114+ if chipflow_api_key is None :
115+ raise ChipFlowError (
116+ "Environment variable `CHIPFLOW_API_KEY` is empty."
117+ )
107118 git_head = subprocess .check_output (
108119 ["git" , "-C" , os .environ ["CHIPFLOW_ROOT" ],
109120 "rev-parse" , "--short" , "HEAD" ],
@@ -160,7 +171,7 @@ def submit(self, rtlil_path, *, dry_run=False, wait=False):
160171 build_submit_url ,
161172 # TODO: This needs to be reworked to accept only one key, auth accepts user and pass
162173 # TODO: but we want to submit a single key
163- auth = (os . environ [ "CHIPFLOW_API_KEY_ID" ], os . environ [ "CHIPFLOW_API_KEY_SECRET" ] ),
174+ auth = (None , chipflow_api_key ),
164175 data = data ,
165176 files = {
166177 "rtlil" : open (rtlil_path , "rb" ),
@@ -191,7 +202,7 @@ def submit(self, rtlil_path, *, dry_run=False, wait=False):
191202 logger .info ("Polling build status..." )
192203 status_resp = requests .get (
193204 build_status_url ,
194- auth = (os . environ [ "CHIPFLOW_API_KEY_ID" ], os . environ [ "CHIPFLOW_API_KEY_SECRET" ] )
205+ auth = (None , chipflow_api_key )
195206 )
196207 if status_resp .status_code != 200 :
197208 logger .error (f"Failed to fetch build status: { status_resp .text } " )
@@ -219,7 +230,7 @@ def submit(self, rtlil_path, *, dry_run=False, wait=False):
219230 stream_event_counter += 1
220231 with requests .get (
221232 log_stream_url ,
222- auth = (os . environ [ "CHIPFLOW_API_KEY_ID" ], os . environ [ "CHIPFLOW_API_KEY_SECRET" ] ),
233+ auth = (None , chipflow_api_key ),
223234 stream = True
224235 ) as log_resp :
225236 if log_resp .status_code == 200 :
0 commit comments