Skip to content

Commit

Permalink
currency: use the net-http
Browse files Browse the repository at this point in the history
Signed-off-by: Varsha GS <varsha.gs@ibm.com>
  • Loading branch information
GSVarsha committed May 31, 2024
1 parent 4e71872 commit ab04c8d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .tekton/.currency/currency-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ spec:
pip install -r resources/requirements.txt
python scripts/generate_report.py
if [ $? -ne 0 ]; then
echo "Error occured while generating the ruby tracer currency report." >&2
exit 1
fi
cat docs/report.md
---
apiVersion: tekton.dev/v1beta1
Expand Down
33 changes: 17 additions & 16 deletions .tekton/.currency/scripts/generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
JSON_FILE = "resources/table.json"
REPORT_FILE = "docs/report.md"
API_V1_ENDPOINT = "https://rubygems.org/api/v1/versions/"
LATEST_SUPPORTED_RUBY_VERSION = "3.3.1"

def filter_taskruns(taskrun_filter, taskruns):
filtered_taskruns = list(filter(taskrun_filter, taskruns))
Expand Down Expand Up @@ -41,7 +40,7 @@ def get_taskruns(namespace, task_name):


def process_taskrun_logs(
taskruns, core_v1_client, namespace, task_name, library, tekton_ci_output
taskruns, core_v1_client, namespace, library, tekton_ci_output, check_net_http
):
for tr in taskruns:
pod_name = tr["status"]["podName"]
Expand All @@ -53,14 +52,19 @@ def process_taskrun_logs(
print(
f"Retrieving container logs from the successful taskrun pod {pod_name} of taskrun {taskrun_name}.."
)
if check_net_http:
version_match = re.search("(net-http) \([\w:]* ([\d.]+)\)", logs)
tekton_ci_output += f"{version_match[1]} {version_match[2]}\n"
check_net_http=False

match = re.search(f"Installing ({library} [^\s]+)", logs)
tekton_ci_output += f"{match[1]}\n"
break
else:
print(
f"Unable to retrieve container logs from the successful taskrun pod {pod_name} of taskrun {taskrun_name}."
)
return tekton_ci_output
return tekton_ci_output, check_net_http


def get_tekton_ci_output():
Expand All @@ -85,6 +89,8 @@ def get_tekton_ci_output():
task_name = "ruby-tracer-unittest-default-libraries-task"
default_taskruns = get_taskruns(namespace, task_name)

check_net_http=True

for library, pattern in default_libraries_dict.items():
taskrun_filter = (
lambda tr: tr["metadata"]["name"].endswith(
Expand All @@ -94,13 +100,13 @@ def get_tekton_ci_output():
)
filtered_default_taskruns = filter_taskruns(taskrun_filter, default_taskruns)

tekton_ci_output = process_taskrun_logs(
tekton_ci_output, check_net_http = process_taskrun_logs(
filtered_default_taskruns,
core_v1_client,
namespace,
task_name,
library,
tekton_ci_output,
check_net_http=check_net_http
)

other_libraries_dict = {
Expand Down Expand Up @@ -132,13 +138,13 @@ def get_tekton_ci_output():
other_taskruns = get_taskruns(namespace, task_name)
filtered_other_taskruns = filter_taskruns(taskrun_filter, other_taskruns)

tekton_ci_output = process_taskrun_logs(
tekton_ci_output, check_net_http = process_taskrun_logs(
filtered_other_taskruns,
core_v1_client,
namespace,
task_name,
library,
tekton_ci_output,
check_net_http=False
)

return tekton_ci_output
Expand Down Expand Up @@ -200,17 +206,12 @@ def main():
package = item["Package name"]
package = package.lower().replace("::", "-")

if package == "net-http":
last_supported_version = LATEST_SUPPORTED_RUBY_VERSION
latest_version = get_latest_stable_ruby_version()
latest_version = get_upstream_version(package)

if not package in ["rails lts", "rails-api"]:
last_supported_version = get_last_supported_version(tekton_ci_output, package)
else:
latest_version = get_upstream_version(package)

if not package in ["rails lts", "rails-api"]:
last_supported_version = get_last_supported_version(tekton_ci_output, package)
else:
last_supported_version = latest_version
last_supported_version = latest_version

up_to_date = isUptodate(last_supported_version, latest_version)

Expand Down

0 comments on commit ab04c8d

Please sign in to comment.