Skip to content

Commit b85de7e

Browse files
committedMay 6, 2022
Fix installation_id filter, minimize docker images diff
1 parent 0caf916 commit b85de7e

File tree

8 files changed

+29
-14
lines changed

8 files changed

+29
-14
lines changed
 

‎tests/ci/cancel_and_rerun_workflow_lambda/app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def get_installation_id(jwt_token):
5353
response = requests.get("https://api.github.com/app/installations", headers=headers)
5454
response.raise_for_status()
5555
data = response.json()
56-
return data[0]["id"]
56+
for installation in data:
57+
if installation["account"]["login"] == "ClickHouse":
58+
installation_id = installation["id"]
59+
return installation_id
5760

5861

5962
def get_access_token(jwt_token, installation_id):

‎tests/ci/metrics_lambda/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
FROM public.ecr.aws/lambda/python:3.9
22

3-
# Copy function code
4-
COPY app.py ${LAMBDA_TASK_ROOT}
5-
63
# Install the function's dependencies using file requirements.txt
74
# from your project folder.
85

96
COPY requirements.txt .
107
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
118

9+
# Copy function code
10+
COPY app.py ${LAMBDA_TASK_ROOT}
11+
1212
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
1313
CMD [ "app.handler" ]

‎tests/ci/metrics_lambda/app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def get_installation_id(jwt_token):
100100
response = requests.get("https://api.github.com/app/installations", headers=headers)
101101
response.raise_for_status()
102102
data = response.json()
103-
return data[0]["id"]
103+
for installation in data:
104+
if installation["account"]["login"] == "ClickHouse":
105+
installation_id = installation["id"]
106+
return installation_id
104107

105108

106109
def get_access_token(jwt_token, installation_id):
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
FROM public.ecr.aws/lambda/python:3.9
22

3-
# Copy function code
4-
COPY app.py ${LAMBDA_TASK_ROOT}
5-
63
# Install the function's dependencies using file requirements.txt
74
# from your project folder.
85

96
COPY requirements.txt .
107
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
118

9+
# Copy function code
10+
COPY app.py ${LAMBDA_TASK_ROOT}
11+
1212
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
1313
CMD [ "app.handler" ]

‎tests/ci/termination_lambda/app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def get_installation_id(jwt_token):
3030
response = requests.get("https://api.github.com/app/installations", headers=headers)
3131
response.raise_for_status()
3232
data = response.json()
33-
return data[0]["id"]
33+
for installation in data:
34+
if installation["account"]["login"] == "ClickHouse":
35+
installation_id = installation["id"]
36+
return installation_id
3437

3538

3639
def get_access_token(jwt_token, installation_id):

‎tests/ci/token_lambda/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
FROM public.ecr.aws/lambda/python:3.9
22

3-
# Copy function code
4-
COPY app.py ${LAMBDA_TASK_ROOT}
5-
63
# Install the function's dependencies using file requirements.txt
74
# from your project folder.
85

96
COPY requirements.txt .
107
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
118

9+
# Copy function code
10+
COPY app.py ${LAMBDA_TASK_ROOT}
11+
1212
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
1313
CMD [ "app.handler" ]

‎tests/ci/token_lambda/app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ def get_installation_id(jwt_token):
1616
response = requests.get("https://api.github.com/app/installations", headers=headers)
1717
response.raise_for_status()
1818
data = response.json()
19-
return data[0]["id"]
19+
for installation in data:
20+
if installation["account"]["login"] == "ClickHouse":
21+
installation_id = installation["id"]
22+
return installation_id
2023

2124

2225
def get_access_token(jwt_token, installation_id):

‎tests/ci/workflow_approve_rerun_lambda/app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ def get_installation_id(jwt_token):
139139
response = requests.get("https://api.github.com/app/installations", headers=headers)
140140
response.raise_for_status()
141141
data = response.json()
142-
return data[0]["id"]
142+
for installation in data:
143+
if installation["account"]["login"] == "ClickHouse":
144+
installation_id = installation["id"]
145+
return installation_id
143146

144147

145148
def get_access_token(jwt_token, installation_id):

0 commit comments

Comments
 (0)