-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci_credentials: fix overwriting 'data' before getting nextPageToken #24265
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -44,12 +44,19 @@ The `VERSION=dev` will make it so it knows to use your local current working dir | |||
ci_credentials --help | |||
``` | |||
|
|||
### Write to storage | |||
### Write credentials for a specific connector to local storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
To download GSM secrets to `airbyte-integrations/connectors/source-bings-ads/secrets`: | ||
```bash | ||
ci_credentials source-bing-ads write-to-storage | ||
``` | ||
|
||
### Write credentials for all connectors to local storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
@@ -81,8 +81,8 @@ def __load_gsm_secrets(self) -> List[RemoteSecret]: | |||
if next_token: | |||
params["pageToken"] = next_token | |||
|
|||
data = self.api.get(url, params=params) | |||
for secret_info in data.get("secrets") or []: | |||
all_secrets_data = self.api.get(url, params=params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 Nice rename
@@ -103,14 +103,14 @@ def __load_gsm_secrets(self) -> List[RemoteSecret]: | |||
self.logger.info(f"found GSM secret: {log_name} = > {filename}") | |||
|
|||
versions_url = f"https://secretmanager.googleapis.com/v1/{secret_name}/versions" | |||
data = self.api.get(versions_url) | |||
enabled_versions = [version["name"] for version in data["versions"] if version["state"] == "ENABLED"] | |||
versions_data = self.api.get(versions_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Dreaming) If only python had an immutable variable feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol, too spoiled by java's pickiness!
…24265) * ci_credentials: fix overwriting 'data' before getting nextPageToken * Updates to readme
What
VERSION=dev ci_credentials all write-to-storage
would only write 100 secrets instead of the full 408How
Use diffferent variable names when getting
data
from various endpoints. Previously we were overwriting thedata
variable with different contents - therefore thenextPageToken
was either not there or invalid by the time we tried to use it, so we never got the next page.Cherrypicked from #24254 as it was quasi-necessary to run all CATs locally (you can run ci_credentials per connector, but that's slow), and I figured other people might be able to use this now.