Skip to content

Commit a445ab6

Browse files
authored
Base64 decode the app secret for pytorch-auto-revert lamba (#6967)
They way that the lambdas are structured and the terraform is setup, it is not possible to pass newlines as environment variables. So the github app key, that is a private key, needs to be b64 encoded.
1 parent 976691c commit a445ab6

File tree

1 file changed

+7
-1
lines changed
  • aws/lambda/pytorch-auto-revert/pytorch_auto_revert

1 file changed

+7
-1
lines changed

aws/lambda/pytorch-auto-revert/pytorch_auto_revert/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

33
import argparse
4+
import base64
45
import logging
56
import os
67

@@ -133,6 +134,11 @@ def get_opts() -> argparse.Namespace:
133134
def main(*args, **kwargs) -> None:
134135
load_dotenv()
135136
opts = get_opts()
137+
138+
gh_app_secret = ""
139+
if opts.github_app_secret:
140+
gh_app_secret = base64.b64decode(opts.github_app_secret).decode("utf-8")
141+
136142
setup_logging(opts.log_level)
137143
CHCliFactory.setup_client(
138144
opts.clickhouse_host,
@@ -143,7 +149,7 @@ def main(*args, **kwargs) -> None:
143149
)
144150
GHClientFactory.setup_client(
145151
opts.github_app_id,
146-
opts.github_app_secret,
152+
gh_app_secret,
147153
opts.github_installation_id,
148154
opts.github_access_token,
149155
)

0 commit comments

Comments
 (0)