4949 resolve_connector_name_and_directory ,
5050)
5151
52- AIRBYTE_GCP_PROJECT_ID = os .environ .get (
53- "AIRBYTE_GCP_PROJECT_ID " ,
52+ GCP_PROJECT_ID : str = os .environ .get (
53+ "GCP_PROJECT_ID " ,
5454 "dataline-integration-testing" ,
5555)
56+ """The GCP project ID to use for fetching integration test secrets."""
57+
5658CONNECTOR_LABEL = "connector"
5759GLOBAL_MASK_KEYS_URL = "https://connectors.airbyte.com/files/registries/v0/specs_secrets_mask.yaml"
5860
@@ -86,8 +88,11 @@ def secrets_cli_group() -> None:
8688@click .option (
8789 "--gcp-project-id" ,
8890 type = str ,
89- default = AIRBYTE_GCP_PROJECT_ID ,
90- help = f"GCP project ID. Defaults to '{ AIRBYTE_GCP_PROJECT_ID } '." ,
91+ default = GCP_PROJECT_ID ,
92+ help = (
93+ "GCP project ID for retrieving integration tests credentials. "
94+ "Defaults to the value of the `GCP_PROJECT_ID` environment variable, if set."
95+ ),
9196)
9297@click .option (
9398 "--print-ci-secrets-masks" ,
@@ -98,7 +103,7 @@ def secrets_cli_group() -> None:
98103)
99104def fetch (
100105 connector : str | Path | None = None ,
101- gcp_project_id : str = AIRBYTE_GCP_PROJECT_ID ,
106+ gcp_project_id : str = GCP_PROJECT_ID ,
102107 print_ci_secrets_masks : bool = False ,
103108) -> None :
104109 """Fetch secrets for a connector from Google Secret Manager.
@@ -195,41 +200,41 @@ def fetch(
195200
196201
197202@secrets_cli_group .command ("list" )
198- @click .option (
199- "--connector-name" ,
203+ @click .argument (
204+ "connector" ,
205+ required = False ,
200206 type = str ,
201- help = "Name of the connector to fetch secrets for. Ignored if --connector-directory is provided." ,
202- )
203- @click .option (
204- "--connector-directory" ,
205- type = click .Path (exists = True , file_okay = False , path_type = Path ),
206- help = "Path to the connector directory." ,
207+ metavar = "[CONNECTOR]" ,
207208)
208209@click .option (
209210 "--gcp-project-id" ,
210211 type = str ,
211- default = AIRBYTE_GCP_PROJECT_ID ,
212- help = f"GCP project ID. Defaults to '{ AIRBYTE_GCP_PROJECT_ID } '." ,
212+ default = GCP_PROJECT_ID ,
213+ help = (
214+ "GCP project ID for retrieving integration tests credentials. "
215+ "Defaults to the value of the `GCP_PROJECT_ID` environment variable, if set."
216+ ),
213217)
214218def list_ (
215- connector_name : str | None = None ,
216- connector_directory : Path | None = None ,
217- gcp_project_id : str = AIRBYTE_GCP_PROJECT_ID ,
219+ connector : str | Path | None = None ,
220+ * ,
221+ gcp_project_id : str = GCP_PROJECT_ID ,
218222) -> None :
219223 """List secrets for a connector from Google Secret Manager.
220224
221225 This command fetches secrets for a connector from Google Secret Manager and prints
222226 them as a table.
223227
228+ [CONNECTOR] can be a connector name (e.g. 'source-pokeapi'), a path to a connector directory, or omitted to use the current working directory.
229+ If a string containing '/' is provided, it is treated as a path. Otherwise, it is treated as a connector name.
230+
224231 If no connector name or directory is provided, we will look within the current working
225232 directory. If the current working directory is not a connector directory (e.g. starting
226233 with 'source-') and no connector name or path is provided, the process will fail.
227234 """
228235 click .echo ("Scanning secrets..." , err = True )
229236
230- connector_name = connector_name or resolve_connector_name (
231- connector_directory = connector_directory or Path ().resolve ().absolute (),
232- )
237+ connector_name , _ = resolve_connector_name_and_directory (connector )
233238 secrets : list [Secret ] = _fetch_secret_handles ( # type: ignore
234239 connector_name = connector_name ,
235240 gcp_project_id = gcp_project_id ,
@@ -306,7 +311,7 @@ def _get_secret_url(secret_name: str, gcp_project_id: str) -> str:
306311
307312def _fetch_secret_handles (
308313 connector_name : str ,
309- gcp_project_id : str = AIRBYTE_GCP_PROJECT_ID ,
314+ gcp_project_id : str = GCP_PROJECT_ID ,
310315) -> list ["Secret" ]: # type: ignore
311316 """Fetch secrets from Google Secret Manager."""
312317 if not secretmanager :
0 commit comments