From ffa8d58099182e8c07b2c93d7913375ba858647c Mon Sep 17 00:00:00 2001 From: AsfaMumtaz Date: Tue, 12 Sep 2023 02:43:17 +0500 Subject: [PATCH 1/6] Update fetch_params_github.py --- scripts/python/fetch-params/fetch_params_github.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/python/fetch-params/fetch_params_github.py b/scripts/python/fetch-params/fetch_params_github.py index 7f53357..761e318 100644 --- a/scripts/python/fetch-params/fetch_params_github.py +++ b/scripts/python/fetch-params/fetch_params_github.py @@ -23,12 +23,12 @@ def fetch_params_github(provider, username, password, hash, workspace, repositor if provider == "github": url = f"https://api.github.com/repos/{workspace}/{repository}/pulls" print(url) - pull_requests = send_api_request (url, password) + pull_requests = send_api_request_github(url, password) if pull_requests: for pr in pull_requests: pull_request_id = pr['number'] url = f"https://api.github.com/repos/{workspace}/{repository}/pulls/{pull_request_id}/commits" - commits = send_api_request(url,"", password, "github") + commits = send_api_request_github(url,"", password, "github") if commits: for commit in commits: print(f"Commit SHA: {commit['sha']}") From ea7593103a0b0876cabda7c7545371561fed3ee5 Mon Sep 17 00:00:00 2001 From: AsfaMumtaz Date: Tue, 12 Sep 2023 03:00:35 +0500 Subject: [PATCH 2/6] Update Dockerfile --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index e93d4fb..f55a7a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -112,10 +112,6 @@ RUN wget https://github.com/yannh/kubeconform/releases/download/$KUBECONFORM/kub kubeconform -v && \ echo "Installed kubeconform-"${KUBECONFORM} -# install locust ( https://docs.locust.io/en/stable ) -RUN pip3 install locust && \ - locust -V && \ - echo "Installed locust" # roxctl client RUN curl -sL -o /usr/local/bin/roxctl https://mirror.openshift.com/pub/rhacs/assets/${ROX_VERSION}/bin/Linux/roxctl && \ From 5a483131330f5a61bc486846e2243be68cadc2ee Mon Sep 17 00:00:00 2001 From: AsfaMumtaz Date: Tue, 12 Sep 2023 03:21:44 +0500 Subject: [PATCH 3/6] Update Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index f55a7a8..2de8f82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,6 +67,9 @@ RUN cd /tmp && \ # install jinja2 cli RUN pip3 install j2cli && \ echo "Installed jinja2 cli" + +RUN pip3 install requests && \ + echo "Installed requests package" # install maven ENV MAVEN_HOME /usr/lib/mvn From 9981a59f53b3965732f19bc69b7f2885482ad086 Mon Sep 17 00:00:00 2001 From: AsfaMumtaz Date: Tue, 12 Sep 2023 03:47:23 +0500 Subject: [PATCH 4/6] Update fetch_params_github.py --- scripts/python/fetch-params/fetch_params_github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/python/fetch-params/fetch_params_github.py b/scripts/python/fetch-params/fetch_params_github.py index 761e318..91fabdc 100644 --- a/scripts/python/fetch-params/fetch_params_github.py +++ b/scripts/python/fetch-params/fetch_params_github.py @@ -28,7 +28,7 @@ def fetch_params_github(provider, username, password, hash, workspace, repositor for pr in pull_requests: pull_request_id = pr['number'] url = f"https://api.github.com/repos/{workspace}/{repository}/pulls/{pull_request_id}/commits" - commits = send_api_request_github(url,"", password, "github") + commits = send_api_request_github(url, password) if commits: for commit in commits: print(f"Commit SHA: {commit['sha']}") From 9ca6597b0fcc4b0758a30aa6e669695d46dd33c1 Mon Sep 17 00:00:00 2001 From: AsfaMumtaz Date: Tue, 12 Sep 2023 08:28:53 +0500 Subject: [PATCH 5/6] Update fetch_params_github.py --- scripts/python/fetch-params/fetch_params_github.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/python/fetch-params/fetch_params_github.py b/scripts/python/fetch-params/fetch_params_github.py index 91fabdc..c72353b 100644 --- a/scripts/python/fetch-params/fetch_params_github.py +++ b/scripts/python/fetch-params/fetch_params_github.py @@ -24,8 +24,11 @@ def fetch_params_github(provider, username, password, hash, workspace, repositor url = f"https://api.github.com/repos/{workspace}/{repository}/pulls" print(url) pull_requests = send_api_request_github(url, password) + found = False if pull_requests: for pr in pull_requests: + if found == True: + break pull_request_id = pr['number'] url = f"https://api.github.com/repos/{workspace}/{repository}/pulls/{pull_request_id}/commits" commits = send_api_request_github(url, password) @@ -35,4 +38,9 @@ def fetch_params_github(provider, username, password, hash, workspace, repositor if commit['sha'] == hash: print(f"Found hash in PR {pull_request_id}") found = True + return pull_request_id break + else: + return None + else: + return None From f3abd241bb5ee772d6fd3c1fa978613df60a47d5 Mon Sep 17 00:00:00 2001 From: AsfaMumtaz Date: Tue, 12 Sep 2023 08:39:57 +0500 Subject: [PATCH 6/6] Update fetch_params_github.py --- scripts/python/fetch-params/fetch_params_github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/python/fetch-params/fetch_params_github.py b/scripts/python/fetch-params/fetch_params_github.py index c72353b..5f140e0 100644 --- a/scripts/python/fetch-params/fetch_params_github.py +++ b/scripts/python/fetch-params/fetch_params_github.py @@ -28,7 +28,7 @@ def fetch_params_github(provider, username, password, hash, workspace, repositor if pull_requests: for pr in pull_requests: if found == True: - break + break pull_request_id = pr['number'] url = f"https://api.github.com/repos/{workspace}/{repository}/pulls/{pull_request_id}/commits" commits = send_api_request_github(url, password)