From e71c20f395cfb66d90b647e7f8ff08b6682e56f5 Mon Sep 17 00:00:00 2001 From: Cagri Yonca Date: Fri, 19 Jun 2026 13:31:19 +0200 Subject: [PATCH] refactor: Remove tekton folder from the codebase Signed-off-by: Cagri Yonca --- .tekton/.currency/currency-pipeline.yaml | 36 --- .tekton/.currency/currency-pipelinerun.yaml | 20 -- .tekton/.currency/currency-rbac.yaml | 29 -- .../currency-scheduled-eventlistener.yaml | 55 ---- .tekton/.currency/currency-tasks.yaml | 96 ------ .tekton/.currency/docs/report.md | 35 -- .tekton/.currency/resources/requirements.txt | 6 - .tekton/.currency/resources/table.json | 198 ------------ .tekton/.currency/scripts/generate_report.py | 298 ------------------ .tekton/README.md | 297 ----------------- .tekton/github-interceptor-secret.yaml | 8 - .tekton/github-pr-eventlistener.yaml | 102 ------ .tekton/github-pr-pipeline.yaml.part | 61 ---- .tekton/github-set-status-task.yaml | 42 --- .tekton/github-webhook-ingress.yaml | 20 -- .tekton/pipeline.yaml | 78 ----- .tekton/pipelinerun.yaml | 19 -- .tekton/python-tracer-prepuller.yaml | 73 ----- .tekton/run_unittests.sh | 61 ---- .tekton/scheduled-eventlistener.yaml | 107 ------- .tekton/task.yaml | 284 ----------------- ...triggers-eventlistener-serviceaccount.yaml | 29 -- 22 files changed, 1954 deletions(-) delete mode 100644 .tekton/.currency/currency-pipeline.yaml delete mode 100644 .tekton/.currency/currency-pipelinerun.yaml delete mode 100644 .tekton/.currency/currency-rbac.yaml delete mode 100644 .tekton/.currency/currency-scheduled-eventlistener.yaml delete mode 100644 .tekton/.currency/currency-tasks.yaml delete mode 100644 .tekton/.currency/docs/report.md delete mode 100644 .tekton/.currency/resources/requirements.txt delete mode 100644 .tekton/.currency/resources/table.json delete mode 100644 .tekton/.currency/scripts/generate_report.py delete mode 100644 .tekton/README.md delete mode 100644 .tekton/github-interceptor-secret.yaml delete mode 100644 .tekton/github-pr-eventlistener.yaml delete mode 100644 .tekton/github-pr-pipeline.yaml.part delete mode 100644 .tekton/github-set-status-task.yaml delete mode 100644 .tekton/github-webhook-ingress.yaml delete mode 100644 .tekton/pipeline.yaml delete mode 100644 .tekton/pipelinerun.yaml delete mode 100644 .tekton/python-tracer-prepuller.yaml delete mode 100755 .tekton/run_unittests.sh delete mode 100644 .tekton/scheduled-eventlistener.yaml delete mode 100644 .tekton/task.yaml delete mode 100644 .tekton/tekton-triggers-eventlistener-serviceaccount.yaml diff --git a/.tekton/.currency/currency-pipeline.yaml b/.tekton/.currency/currency-pipeline.yaml deleted file mode 100644 index 0c4ae0f3..00000000 --- a/.tekton/.currency/currency-pipeline.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: tekton.dev/v1beta1 -kind: Pipeline -metadata: - name: python-currency-pipeline -spec: - params: - - name: revision - type: string - workspaces: - - name: currency-pvc - tasks: - - name: clone-repo - params: - - name: revision - value: $(params.revision) - taskRef: - name: git-clone-task - workspaces: - - name: task-pvc - workspace: currency-pvc - - name: generate-currency-report - runAfter: - - clone-repo - taskRef: - name: generate-currency-report-task - workspaces: - - name: task-pvc - workspace: currency-pvc - - name: upload-currency-report - runAfter: - - generate-currency-report - taskRef: - name: upload-currency-report-task - workspaces: - - name: task-pvc - workspace: currency-pvc diff --git a/.tekton/.currency/currency-pipelinerun.yaml b/.tekton/.currency/currency-pipelinerun.yaml deleted file mode 100644 index fedc516b..00000000 --- a/.tekton/.currency/currency-pipelinerun.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: tekton.dev/v1beta1 -kind: PipelineRun -metadata: - name: python-currency-pipelinerun -spec: - params: - - name: revision - value: "main" - pipelineRef: - name: python-currency-pipeline - serviceAccountName: currency-serviceaccount - workspaces: - - name: currency-pvc - volumeClaimTemplate: - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi diff --git a/.tekton/.currency/currency-rbac.yaml b/.tekton/.currency/currency-rbac.yaml deleted file mode 100644 index aca210e4..00000000 --- a/.tekton/.currency/currency-rbac.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: currency-serviceaccount ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: currency-clusterrole -rules: -- apiGroups: [""] - resources: ["pods", "pods/log"] - verbs: ["get", "list"] -- apiGroups: ["tekton.dev"] - resources: ["taskruns"] - verbs: ["get", "list"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: currency-clusterrolebinding -subjects: -- kind: ServiceAccount - name: currency-serviceaccount - namespace: default -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: currency-clusterrole diff --git a/.tekton/.currency/currency-scheduled-eventlistener.yaml b/.tekton/.currency/currency-scheduled-eventlistener.yaml deleted file mode 100644 index b410dc94..00000000 --- a/.tekton/.currency/currency-scheduled-eventlistener.yaml +++ /dev/null @@ -1,55 +0,0 @@ -apiVersion: triggers.tekton.dev/v1beta1 -kind: EventListener -metadata: - name: python-currency-cron-listener -spec: - serviceAccountName: tekton-triggers-eventlistener-serviceaccount - triggers: - - name: currency-cron-trigger - template: - ref: python-currency-trigger-template ---- -apiVersion: triggers.tekton.dev/v1beta1 -kind: TriggerTemplate -metadata: - name: python-currency-trigger-template -spec: - resourcetemplates: - - apiVersion: tekton.dev/v1beta1 - kind: PipelineRun - metadata: - generateName: python-currency- - spec: - pipelineRef: - name: python-currency-pipeline - serviceAccountName: currency-serviceaccount - params: - - name: revision - value: "main" - workspaces: - - name: currency-pvc - volumeClaimTemplate: - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: python-currency-cronjob -spec: - schedule: "35 1 * * Mon-Fri" - jobTemplate: - spec: - template: - spec: - containers: - - name: http-request-to-el-svc - image: quay.io/curl/curl:latest - imagePullPolicy: IfNotPresent - args: ["curl", "-X", "POST", "--data", "{}", "el-python-currency-cron-listener.default.svc.cluster.local:8080"] - restartPolicy: OnFailure ---- diff --git a/.tekton/.currency/currency-tasks.yaml b/.tekton/.currency/currency-tasks.yaml deleted file mode 100644 index 7f5ead15..00000000 --- a/.tekton/.currency/currency-tasks.yaml +++ /dev/null @@ -1,96 +0,0 @@ -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: git-clone-task -spec: - params: - - name: revision - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: clone-repo - image: public.ecr.aws/docker/library/alpine:latest - script: | - #!/bin/sh - echo "Installing git" - apk fix && apk --no-cache --update add git gpg less openssh patch - echo "Cloning repo" - cd /workspace && git clone --filter=blob:none --sparse --depth 1 https://github.com/instana/python-sensor -b $(params.revision) - cd python-sensor - git sparse-checkout add .tekton/.currency - ls -lah /workspace/python-sensor ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: generate-currency-report-task -spec: - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: generate-currency-report - image: public.ecr.aws/docker/library/python:3.12-trixie - script: | - #!/usr/bin/env bash - cd /workspace/python-sensor/.tekton/.currency - - python -m venv /tmp/venv - source /tmp/venv/bin/activate - pip install --upgrade pip - pip install -r resources/requirements.txt - - python scripts/generate_report.py - if [ $? -ne 0 ]; then - echo "Error occurred while generating the python tracer currency report." >&2 - exit 1 - fi - cat docs/report.md ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: upload-currency-report-task -spec: - params: - - name: github-token-secret - default: instanacd-github-api-token - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: upload-currency-report - image: public.ecr.aws/docker/library/alpine:latest - env: - - name: GH_ENTERPRISE_TOKEN - valueFrom: - secretKeyRef: - name: $(params.github-token-secret) - key: "GH_ENTERPRISE_TOKEN" - script: | - #!/bin/sh - echo "Installing git" - apk fix && apk --no-cache --update add git gpg less openssh patch - - echo "Cloning repo" - cd /workspace - git clone https://oauth2:$GH_ENTERPRISE_TOKEN@github.ibm.com/instana/tracer-reports.git - - if [ $? -ne 0 ]; then - echo "The attempt to clone the tracer-reports repository failed, preventing the upload of python tracer currency report." >&2 - exit 1 - fi - - cd tracer-reports - - cp ../python-sensor/.tekton/.currency/docs/report.md ./automated/currency/python/report.md - - git config user.name "Instanacd PAT for GitHub Enterprise" - git config user.email instana.ibm.github.enterprise@ibm.com - - git add . - - git commit -m "chore: Updated Python currency report" - git push origin main diff --git a/.tekton/.currency/docs/report.md b/.tekton/.currency/docs/report.md deleted file mode 100644 index a739efe1..00000000 --- a/.tekton/.currency/docs/report.md +++ /dev/null @@ -1,35 +0,0 @@ -##### This page is auto-generated. Any change will be overwritten after the next sync. Please apply changes directly to the files in the [python tracer](https://github.com/instana/python-sensor) repo. -## Python supported packages and versions -| Package name | Support Policy | Beta version | Last Supported Version | Latest version | Up-to-date | Release date | Latest Version Published At | Days behind | Cloud Native | -|:---------------------|:-----------------|:---------------|:-------------------------|:-----------------|:-------------|:---------------|:------------------------------|:--------------|:---------------| -| ASGI | 45-days | No | 3.0 | 3.0 | Yes | 2019-03-04 | 2019-03-04 | 0 day/s | No | -| WSGI | 0-day | Yes | 1.0.1 | 1.0.1 | Yes | 2010-09-26 | 2010-09-26 | 0 day/s | No | -| Django | 45-days | No | 5.2.7 | 5.2.7 | Yes | 2025-10-01 | 2025-10-01 | 0 day/s | No | -| FastAPI | 45-days | No | 0.118.0 | 0.118.0 | Yes | 2025-09-29 | 2025-09-29 | 0 day/s | No | -| Flask | 45-days | No | 3.1.2 | 3.1.2 | Yes | 2025-08-19 | 2025-08-19 | 0 day/s | No | -| Pyramid | 45-days | No | 2.0.2 | 2.0.2 | Yes | 2023-08-25 | 2023-08-25 | 0 day/s | No | -| Sanic | On demand | No | 25.3.0 | 25.3.0 | Yes | 2025-03-31 | 2025-03-31 | 0 day/s | No | -| Starlette | 45-days | No | 0.48.0 | 0.48.0 | Yes | 2025-09-13 | 2025-09-13 | 0 day/s | No | -| Tornado | 45-days | No | 6.5.2 | 6.5.2 | Yes | 2025-08-08 | 2025-08-08 | 0 day/s | No | -| Aiohttp | 45-days | No | 3.13.0 | 3.13.0 | Yes | 2025-10-06 | 2025-10-06 | 0 day/s | No | -| Httpx | 45-days | No | 0.28.1 | 0.28.1 | Yes | 2024-12-06 | 2024-12-06 | 0 day/s | No | -| Requests | 45-days | No | 2.32.5 | 2.32.5 | Yes | 2025-08-18 | 2025-08-18 | 0 day/s | No | -| Urllib3 | 45-days | No | 2.5.0 | 2.5.0 | Yes | 2025-06-18 | 2025-06-18 | 0 day/s | No | -| Grpcio | 45-days | No | 1.75.1 | 1.75.1 | Yes | 2025-09-26 | 2025-09-26 | 0 day/s | Yes | -| Cassandra-driver | 45-days | No | 3.29.2 | 3.29.2 | Yes | 2024-09-10 | 2024-09-10 | 0 day/s | No | -| Mysqlclient | 45-days | No | 2.2.7 | 2.2.7 | Yes | 2025-01-10 | 2025-01-10 | 0 day/s | Yes | -| PyMySQL | 45-days | No | 1.1.2 | 1.1.2 | Yes | 2025-08-24 | 2025-08-24 | 0 day/s | Yes | -| Pymongo | 45-days | No | 4.15.3 | 4.15.3 | Yes | 2025-10-07 | 2025-10-07 | 0 day/s | Yes | -| Psycopg2 | 45-days | No | 2.9.10 | 2.9.10 | Yes | 2024-10-16 | 2024-10-16 | 0 day/s | No | -| Redis | 45-days | No | 6.4.0 | 6.4.0 | Yes | 2025-08-07 | 2025-08-07 | 0 day/s | Yes | -| SQLAlchemy | 45-days | No | 2.0.43 | 2.0.43 | Yes | 2025-08-11 | 2025-08-11 | 0 day/s | Yes | -| Aioamqp | 45-days | No | 0.15.0 | 0.15.0 | Yes | 2022-04-05 | 2022-04-05 | 0 day/s | No | -| Aio-pika | 45-days | No | 9.5.7 | 9.5.7 | Yes | 2025-08-05 | 2025-08-05 | 0 day/s | No | -| Confluent-kafka | 45-days | No | 2.11.1 | 2.11.1 | Yes | 2025-08-18 | 2025-08-18 | 0 day/s | No | -| Kafka-python-ng | 45-days | No | 2.2.3 | 2.2.3 | Yes | 2024-10-02 | 2024-10-02 | 0 day/s | No | -| Pika | 45-days | No | 1.3.2 | 1.3.2 | Yes | 2023-05-05 | 2023-05-05 | 0 day/s | No | -| Boto3 | 45-days | No | 1.40.47 | 1.40.47 | Yes | 2025-10-07 | 2025-10-07 | 0 day/s | Yes | -| Google-cloud-pubsub | 45-days | No | 2.31.1 | 2.31.1 | Yes | 2025-07-28 | 2025-07-28 | 0 day/s | Yes | -| Google-cloud-storage | 45-days | No | 3.4.0 | 3.4.0 | Yes | 2025-09-15 | 2025-09-15 | 0 day/s | Yes | -| Gevent | On demand | No | 25.9.1 | 25.9.1 | Yes | 2025-09-17 | 2025-09-17 | 0 day/s | No | -| Celery | 45-days | No | 5.5.3 | 5.5.3 | Yes | 2025-06-01 | 2025-06-01 | 0 day/s | No | diff --git a/.tekton/.currency/resources/requirements.txt b/.tekton/.currency/resources/requirements.txt deleted file mode 100644 index e254e8b7..00000000 --- a/.tekton/.currency/resources/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -requests -pandas -beautifulsoup4 -tabulate -kubernetes -packaging diff --git a/.tekton/.currency/resources/table.json b/.tekton/.currency/resources/table.json deleted file mode 100644 index f8e11fd1..00000000 --- a/.tekton/.currency/resources/table.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "table": [ - { - "Package name": "ASGI", - "Support Policy": "45-days", - "Beta version": "No", - "Last Supported Version": "3.0", - "Cloud Native": "No" - }, - { - "Package name": "WSGI", - "Support Policy": "0-day", - "Beta version": "Yes", - "Last Supported Version": "1.0.1", - "Cloud Native": "No" - }, - { - "Package name": "Django", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "FastAPI", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Flask", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Pyramid", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Sanic", - "Support Policy": "On demand", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Starlette", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Tornado", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Werkzeug", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Aiohttp", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Httpx", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Requests", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Urllib3", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Grpcio", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "Cassandra-driver", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Mysqlclient", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "PyMySQL", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "Pymongo", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "Psycopg2", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Redis", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "SQLAlchemy", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "Aioamqp", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Aio-pika", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Confluent-kafka", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Kafka-python-ng", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Pika", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Boto3", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "Google-cloud-pubsub", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "Google-cloud-storage", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "Yes" - }, - { - "Package name": "Gevent", - "Support Policy": "On demand", - "Beta version": "No", - "Cloud Native": "No" - }, - { - "Package name": "Celery", - "Support Policy": "45-days", - "Beta version": "No", - "Cloud Native": "No" - } - ] -} \ No newline at end of file diff --git a/.tekton/.currency/scripts/generate_report.py b/.tekton/.currency/scripts/generate_report.py deleted file mode 100644 index 21186298..00000000 --- a/.tekton/.currency/scripts/generate_report.py +++ /dev/null @@ -1,298 +0,0 @@ -# Standard Libraries -import json -import re -from datetime import datetime - -import pandas as pd - -# Third Party -import requests -from bs4 import BeautifulSoup -from kubernetes import client, config -from packaging.version import Version - -JSON_FILE = "resources/table.json" -REPORT_FILE = "docs/report.md" -PIP_INDEX_URL = "https://pypi.org/pypi" -PEP_BASE_URL = "https://peps.python.org/" - -SPEC_MAP = { - "ASGI": "https://asgi.readthedocs.io/en/latest/specs/main.html", - "WSGI": "https://peps.python.org/numerical", -} - - -def estimate_days_behind(release_date): - return (datetime.today().date() - datetime.strptime(release_date, "%Y-%m-%d").date()).days - - -def get_upstream_version(dependency, last_supported_version): - """Get the latest version available upstream""" - last_supported_version_release_date = "Not found" - if dependency in SPEC_MAP: - # webscrape info from official website - version_pattern = r"(\d+\.\d+\.?\d*)" - latest_version_release_date = "" - - url = SPEC_MAP[dependency] - page = requests.get(url) - soup = BeautifulSoup(page.text, "html.parser") - # ASGI - if "asgi" in url: - all_versions = soup.find(id="version-history").find_all("li") - pattern = re.compile(r"([\d.]+) \((\d{4}-\d{2}-\d{2})\)") - latest_version, latest_version_release_date = pattern.search( - all_versions[0].text - ).groups() - for li in all_versions: - match = pattern.search(li.text) - if match: - version, date = match.groups() - if version == last_supported_version: - last_supported_version_release_date = date - break - # WSGI - else: - all_versions = soup.find(id="numerical-index").find_all( - "a", string=re.compile("Web Server Gateway Interface") - ) - latest_version = re.search(version_pattern, all_versions[-1].text).group() - - for a in all_versions: - pep_link = PEP_BASE_URL + a.get("href").split("..")[1] - response = requests.get(pep_link) - soup = BeautifulSoup(response.text, "html.parser") - version = re.search(version_pattern, a.text).group() - pep_page_metadata = soup.find("dl") - - if pep_page_metadata and version in [ - latest_version, - last_supported_version, - ]: - metadata_fields = pep_page_metadata.find_all("dt") - metadata_values = pep_page_metadata.find_all("dd") - - for dt, dd in zip(metadata_fields, metadata_values): - if "Created" in dt.text: - release_date = dd.text.strip() - release_date_as_datetime = datetime.strptime( - release_date, "%d-%b-%Y" - ) - if version == latest_version: - latest_version_release_date = ( - release_date_as_datetime.strftime("%Y-%m-%d") - ) - if version == last_supported_version: - last_supported_version_release_date = ( - release_date_as_datetime.strftime("%Y-%m-%d") - ) - return ( - latest_version, - latest_version_release_date, - last_supported_version_release_date, - ) - - else: - # get info using PYPI API - response = requests.get(f"{PIP_INDEX_URL}/{dependency}/json") - response_json = response.json() - - latest_version = response_json["info"]["version"] - release_info_latest = response_json["releases"][latest_version] - release_time_latest = release_info_latest[-1]["upload_time_iso_8601"] - release_date_latest = re.search(r"([\d-]+)T", release_time_latest)[1] - - release_info_last_supported = response_json["releases"][last_supported_version] - release_time_last_supported = release_info_last_supported[-1]["upload_time_iso_8601"] - release_date_last_supported = re.search(r"([\d-]+)T", release_time_last_supported)[1] - - return ( - latest_version, - release_date_latest, - release_date_last_supported, - ) - - -def get_last_supported_version(tekton_ci_output, dependency): - """Get up-to-date supported version""" - if dependency == "Psycopg2": - dependency = "psycopg2-binary" - - # either start with a space or in a new line - pattern = r"(?:^|\s)" + dependency + r"-([^\s]+)" - - last_supported_version = re.search( - pattern, tekton_ci_output, flags=re.I | re.M - ) - - return last_supported_version[1] - - -def is_up_to_date( - last_supported_version, latest_version, last_supported_version_release_date -): - """Check if the supported package is up-to-date""" - if Version(last_supported_version) >= Version(latest_version): - up_to_date = "Yes" - days_behind = 0 - else: - up_to_date = "No" - days_behind = estimate_days_behind(last_supported_version_release_date) - - return up_to_date, days_behind - -def taskrun_filter(taskrun): - return any( - condition["type"] == "Succeeded" and condition["status"] == "True" - for condition in taskrun["status"]["conditions"] - ) - -def get_taskruns(namespace, task_name): - """Get sorted taskruns filtered based on label_selector""" - group = "tekton.dev" - version = "v1" - plural = "taskruns" - - # access the custom resource from tekton - tektonV1 = client.CustomObjectsApi() - taskruns = tektonV1.list_namespaced_custom_object( - group, - version, - namespace, - plural, - label_selector=f"{group}/task={task_name}, triggers.tekton.dev/trigger=python-tracer-scheduled-pipeline-triggger", - )["items"] - - filtered_taskruns = list(filter(taskrun_filter, taskruns)) - filtered_taskruns.sort( - key=lambda tr: tr["metadata"]["creationTimestamp"], reverse=True - ) - - return filtered_taskruns - - -def process_taskrun_logs( - taskruns, core_v1_client, namespace, task_name, tekton_ci_output -): - """Process taskrun logs""" - for tr in taskruns: - pod_name = tr["status"]["podName"] - taskrun_name = tr["metadata"]["name"] - logs = core_v1_client.read_namespaced_pod_log( - pod_name, namespace, container="step-unittest" - ) - if "Successfully installed" in logs: - print( - f"Retrieving container logs from the successful taskrun pod {pod_name} of taskrun {taskrun_name}.." - ) - if task_name == "python-tracer-unittest-gevent-starlette-task": - match = re.search(r"Successfully installed .*(gevent-[^\s]+) .* (starlette-[^\s]+)", logs) - tekton_ci_output += f"{match[1]}\n{match[2]}\n" - elif task_name == "python-tracer-unittest-kafka-task": - match = re.search(r"Successfully installed .*(confluent-kafka-[^\s]+) .* (kafka-python-ng-[^\s]+)", logs) - tekton_ci_output += f"{match[1]}\n{match[2]}\n" - elif task_name == "python-tracer-unittest-cassandra-task": - match = re.search(r"Successfully installed .*(cassandra-driver-[^\s]+)", logs) - tekton_ci_output += f"{match[1]}\n" - elif task_name == "python-tracer-unittest-default-task": - lines = re.findall(r"^Successfully installed .*", logs, re.M) - tekton_ci_output += "\n".join(lines) - break - else: - print( - f"Unable to retrieve container logs from the successful taskrun pod {pod_name} of taskrun {taskrun_name}." - ) - return tekton_ci_output - - -def get_tekton_ci_output(): - """Get the latest successful scheduled tekton pipeline output""" - try: - config.load_incluster_config() - print("Using in-cluster Kubernetes configuration...") - except config.config_exception.ConfigException: - # Fall back to local config if running locally and not inside cluster - config.load_kube_config() - print("Using local Kubernetes configuration...") - - namespace = "default" - core_v1_client = client.CoreV1Api() - - tasks = [ - "python-tracer-unittest-gevent-starlette-task", - "python-tracer-unittest-kafka-task", - "python-tracer-unittest-cassandra-task", - "python-tracer-unittest-default-task" - ] - - tekton_ci_output = "" - - for task_name in tasks: - try: - taskruns = get_taskruns(namespace, task_name) - - tekton_ci_output = process_taskrun_logs( - taskruns, core_v1_client, namespace, task_name, tekton_ci_output - ) - except Exception as exc: - print(f"Error processing task {task_name}: {str(exc)}") - - return tekton_ci_output - - -def main(): - # Read the JSON file - with open(JSON_FILE) as file: - data = json.load(file) - - items = data["table"] - tekton_ci_output = get_tekton_ci_output() - - for item in items: - package = item["Package name"] - - if "Last Supported Version" not in item: - last_supported_version = get_last_supported_version( - tekton_ci_output, package - ) - item.update({"Last Supported Version": last_supported_version}) - else: - last_supported_version = item["Last Supported Version"] - - latest_version, release_date, last_supported_version_release_date = ( - get_upstream_version(package, last_supported_version) - ) - - up_to_date, days_behind = is_up_to_date( - last_supported_version, latest_version, last_supported_version_release_date - ) - - item.update( - { - "Latest version": latest_version, - "Up-to-date": up_to_date, - "Release date": release_date, - "Latest Version Published At": last_supported_version_release_date, - "Days behind": f"{days_behind} day/s", - } - ) - - # Create a DataFrame from the list of dictionaries - df = pd.DataFrame(items) - df.insert(len(df.columns) - 1, "Cloud Native", df.pop("Cloud Native")) - - # Convert dataframe to markdown - markdown_table = df.to_markdown(index=False) - - disclaimer = "##### This page is auto-generated. Any change will be overwritten after the next sync. Please apply changes directly to the files in the [python tracer](https://github.com/instana/python-sensor) repo." - title = "## Python supported packages and versions" - - # Combine disclaimer, title, and markdown table with line breaks - final_markdown = f"{disclaimer}\n{title}\n{markdown_table}\n" - - with open(REPORT_FILE, "w") as file: - file.write(final_markdown) - - -if __name__ == "__main__": - main() diff --git a/.tekton/README.md b/.tekton/README.md deleted file mode 100644 index 163e866c..00000000 --- a/.tekton/README.md +++ /dev/null @@ -1,297 +0,0 @@ -# Tekton CI for Instana Python Tracer - -## Basic Tekton setup - -### Get a cluster - -What you will need: -* Full administrator access -* Enough RAM and CPU on a cluster node to run all the pods of a single Pipelinerun on a single node. - Multiple nodes increase the number of parallel `PipelineRun` instances. - Currently one `PipelineRun` instance is capable of saturating a 8vCPU - 16GB RAM worker node. - -### Setup Tekton on your cluster - -1. Install latest stable Tekton Pipeline release -```bash - kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml -``` - -2. Install Tekton Dashboard Full (the normal is read only, and doesn't allow for example to re-run). - -````bash - kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/release-full.yaml -```` - -3. Access the dashboard - -```bash -kubectl proxy -``` - -Once the proxy is active, navigate your browser to the [dashboard url]( -http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/) - -### Setup the python-tracer-ci-pipeline - -````bash - kubectl apply --filename task.yaml && kubectl apply --filename pipeline.yaml -```` - -### Run the pipeline manually - -#### From the Dashboard -Navigate your browser to the [pipelineruns section of the dashboard]( -http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/#/pipelineruns) - -1. Click `Create` -2. Select the `Namespace` (where the `Pipeline` resource is created by default it is `default`) -3. Select the `Pipeline` created in the `pipeline.yaml` right now it is `python-tracer-ci-pipeline` -4. Fill in `Params`. The `revision` should be `main` for the `main` branch -4. Select the `ServiceAccount` set to `default` -5. Optionally, enter a `PipelineRun name` for example `my-main-test-pipeline`, - but if you don't then the Dashboard will generate a unique one for you. -6. As long as [the known issue with Tekton Dashboard Workspace binding]( - https://github.com/tektoncd/dashboard/issues/1283), is not resolved. - You have to go to `YAML Mode` and insert the workspace definition at the end of the file, - with the exact same indentation: - -````yaml - workspaces: - - name: python-tracer-ci-pipeline-pvc-$(params.revision) - volumeClaimTemplate: - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi - -```` -7. Click `Create` at the bottom of the page - - -#### From kubectl CLI -As an alternative to using the Dashboard, you can manually edit `pipelinerun.yaml` and create it with: -````bash - kubectl apply --filename pipelinerun.yaml -```` - -### Clanup PipelineRun and associated PV resources - -`PipelineRuns` and workspace `PersistentVolume` resources by default are kept indefinitely, -and repeated runs might exhaust the available resources, therefore they need to be cleaned up either -automatically or manually. - -#### Manully from the Dashboard - -Navigate to `PipelineRuns` and check the checkbox next to the pipelinerun -and then click `Delete` in the upper right corner. - -#### Manually from the CLI - -You can use either `kubectl` -````bash -kubectl get pipelinerun -kubectl delete pipelinerun -```` - -or `tkn` cli -````bash -tkn pipelinerun list -tkn pipelinerun delete -```` - -#### Automatic cleanup with a cronjob - -Install and configure resources from https://github.com/3scale-ops/tekton-pipelinerun-cleaner - -#### Preventing image pull failures with a prepuller - -Maintain, and install the list of used images in the `python-tracer-prepuller.yaml`: -````bash - kubectl apply --filename python-tracer-prepuller.yaml -```` - -## Integrate with GitHub - -### GitHub PR Trigger & PR Check API integration - -The GitHub integration requires further Tekton Triggers and Interceptors to be installed -````bash -kubectl apply --filename \ -https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml -kubectl apply --filename \ -https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml -```` -#### Create a ServiceAccount - -Our future GitHub PR Event listener needs a service account, -`tekton-triggers-eventlistener-serviceaccount` which authorizes it to -perform operations specified in eventlistener `Role` and `ClusteRole`. -Create the service account with the needed role bindings: - -````bash - kubectl apply --filename tekton-triggers-eventlistener-serviceaccount.yaml -```` - -#### Create the Secret for the GitHub repository webhook - -In order to authorize the incoming webhooks into our cluster, we need to share -a secret between our webhook listener, and the GitHub repo. -This resource can be shared across multiple tekton Tri -Generate a long, strong and random generated token, put it into `github-interceptor-secret.yaml`. -Create the secret resource: -````bash - kubectl apply --filename github-interceptor-secret.yaml -```` - -#### Create the Task and token to report PR Check status to GitHub - -The GitHub PR specific Tekton pipeline will want to send data to report the `PR Check Status`. -That [GitHub API](https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status -) requires authentication, and therefore we need a token. -The user which generates the token has to have `Write` access in the target repo, -as part of the organisation. Check the repo access for this repo under -https://github.com/instana/python-sensor/settings/access. - -With the proper user: -1. Navigate to https://github.com/settings/tokens -2. Click on `Generate new token` dropdown `Generate new token (classic)`. -3. Fill in `Note` with for example `Tekton commit status`, -4. Make sure if you set an expiration, than you remember to renew the token after expiry. -5. Under `Select scopes` find `repo` and below that only select the checkbox next to `repo:status` - `Access commit status`. - click `Generate token` -6. Create the kubernetes secret with the token: - -````bash - kubectl create secret generic githubtoken --from-literal token="MY_TOKEN" -```` - -And we also make an HTTP POST with the status update data to GitHub. -This is done in a `Task` called `github-set-status`, create it as such: -````bash - kubectl apply -f github-set-status-task.yaml -```` - -#### Create the GitHub PR pipeline - -Create the new pipeline, which executes the previously created `python-tracer-ci-pipeline`, -wrapped around with GitHub Check status reporting tasks. As long as [Pipelines in Pipelines]( -https://tekton.dev/docs/pipelines/pipelines-in-pipelines/), remains an -unimplemented `alpha` feature in Tekton, -we will need the [yq](https://github.com/mikefarah/yq) (at least `4.0`) -to pull the tasks from our previous `python-tracer-ci-pipeline` into the -new pipeline `github-pr-python-tracer-ci-pipeline`. - -````bash - (cat github-pr-pipeline.yaml.part && yq '{"a": {"b": .spec.tasks}}' pipeline.yaml| tail --lines=+3) | kubectl apply -f - -```` - -#### Create the GitHub PR Event Listener, TriggerTemplate and TriggerBinding - -Once the new GitHub specific pipeline is created, we need a listener which starts -a new `PipelineRun` based on GitHub events. - -````bash - kubectl apply --filename github-pr-eventlistener.yaml -```` - -After this ensure that there is a pod and a service created: - -````bash - kubectl get pod | grep -i el-github-pr-python-eventlistener - kubectl get svc | grep -i el-github-pr-python-eventlistener -```` - -Do not continue if any of these missing. - -#### Create the Ingress for the GitHub Webhook to come through - -You will need an ingress controller for this. -On IKS you might want to read these resources: -* [managed ingress](https://cloud.ibm.com/docs/containers?topic=containers-managed-ingress-about) -* Or unmanaged [ingress controller howto]( -https://github.com/IBM-Cloud/iks-ingress-controller/blob/master/docs/installation.md -). - -1. Check the available `ingressclass` resources on your cluster - -````bash - kubectl get ingressclass -```` - -* On `IKS` it will be `public-iks-k8s-nginx`. -* On `EKS` with the `ALB` ingress controller, it might be just `alb` -* On self hosted [nginx controller](https://kubernetes.github.io/ingress-nginx/deploy/) - this might just be `nginx`. - -Edit and save the value of `ingressClassName:` in `github-webhook-ingress.yaml`. - -2. Find out your Ingress domain or subdomain name. - -* On `IKS`, go to `Clusters` select your cluster and then click `Overview`. - The domain name is listed under `Ingress subdomain`. - -and create the resource: - -````bash - kubectl apply --filename github-webhook-ingress.yaml -```` - -Make sure that you can use the ingress with the `/hooks` path via `https`: -````bash - curl https:///hooks -```` - -At this point this should respond this: -```json - { - "eventListener":"github-pr-eventlistener", - "namespace":"default", - "eventListenerUID":"", - "errorMessage":"Invalid event body format : unexpected end of JSON input" - } -``` - -#### Setup the webhook on GitHub - -In the GitHub repo go to `Settings` -> `Webhooks` and click `Add Webhook`. -The fields we need to set are: -* `Payload URL`: `https:///hooks` -* `Content type`: application/json -* `Secret`: XXXXXXX (the secret token from github-interceptor-secret.yaml) - -Under `SSL verification` select the radio button for `Enable SSL verification`. -Under `Which events would you like to trigger this webhook?` select -the radio button for `Let me select individual events.` and thick the checkbox next to -`Pull requests` and ensure that the rest are unthicked. - -Click `Add webhook`. - -If the webhook has been set up correctly, then GitHub sends a ping message. -Ensure that the ping is received from GitHub, and that it is filtered out so -a simple ping event does not trigger any `PipelineRun` unnecessarily. - -````bash -eventlistener_pod=$(kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep el-github-pr-python-eventlistener-) -kubectl logs -f "${eventlistener_pod}" | grep 'event type ping is not allowed' -```` - -## Setup Scheduled PipelineRuns - -PipelineRuns can be scheduled with a Kubernetes `CronJob` resource, -which calls a Tekton `EventListener`, that triggers -an appropriate PipelineRun. The needed resources can be created -with the following command: - -````bash - kubectl apply --filename scheduled-eventlistener.yaml -```` - -The current schedule is `"5 0 * * Mon-Fri`, -whic means every weekday 00:05 in the pod's timezone. -This can be adjusted by editing the `schedule` attribute. -Currently this triggers the `github-pr-python-tracer-ci-pipeline` -on the head of the `main` branch. -These can also be changed on demand. diff --git a/.tekton/github-interceptor-secret.yaml b/.tekton/github-interceptor-secret.yaml deleted file mode 100644 index a774f812..00000000 --- a/.tekton/github-interceptor-secret.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: github-interceptor-secret -type: Opaque -stringData: - # Always use a long, strong and random generated token - secretToken: "<--- TOKEN GOES HERE --->" diff --git a/.tekton/github-pr-eventlistener.yaml b/.tekton/github-pr-eventlistener.yaml deleted file mode 100644 index 71b7a066..00000000 --- a/.tekton/github-pr-eventlistener.yaml +++ /dev/null @@ -1,102 +0,0 @@ -apiVersion: triggers.tekton.dev/v1beta1 -kind: TriggerTemplate -metadata: - name: github-pr-python-tracer-pipeline-template -spec: - params: - - description: The git branch name - name: git-branch - - description: The git branch name shortened and converted to RFC 1123 subdomain names - name: git-branch-normalized - - description: The full sha of the git commit - name: git-commit-sha - - description: The short 7 digit sha of the git commit - name: git-commit-short-sha - resourcetemplates: - - apiVersion: tekton.dev/v1 - kind: PipelineRun - metadata: - # After variable resolution, this has to be maximum 63 character long, - # lower case, RFC 1123 subdomain name. The regex used for validation is - # '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' - name: python-tracer-pr-$(tt.params.git-branch-normalized)-$(tt.params.git-commit-short-sha) - spec: - params: - - name: revision - value: $(tt.params.git-branch) - - name: git-commit-sha - value: $(tt.params.git-commit-sha) - pipelineRef: - name: github-pr-python-tracer-ci-pipeline - workspaces: - - name: python-tracer-ci-pipeline-pvc - volumeClaimTemplate: - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: triggers.tekton.dev/v1beta1 -kind: TriggerBinding -metadata: - name: github-pr-python-tracer-binding -spec: - params: - - name: git-branch - value: $(body.pull_request.head.ref) - - name: git-branch-normalized - value: $(extensions.git_branch_normalized) - - name: git-commit-sha - value: $(body.pull_request.head.sha) - - name: git-commit-short-sha - value: $(extensions.truncated_sha) ---- -apiVersion: triggers.tekton.dev/v1beta1 -kind: EventListener -metadata: - name: github-pr-python-eventlistener -spec: - serviceAccountName: tekton-triggers-eventlistener-serviceaccount - triggers: - - name: github-pr-trigger - interceptors: - - name: receive-github-event - ref: - name: "github" - params: - - name: "secretRef" - value: - secretName: github-interceptor-secret - secretKey: secretToken - - name: "eventTypes" - value: ["pull_request"] - - name: filter-irrelevant-events - ref: - name: "cel" - params: - - name: "filter" - # We should not trigger on 'closed', 'assigned', 'unassigned', 'converted_to_draft' - value: "body.action in ['opened', 'synchronize', 'reopened']" - - name: add-truncated-sha - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: truncated_sha - expression: "body.pull_request.head.sha.truncate(7)" - - name: add-normalized-branch-name - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: git_branch_normalized - # The git branch name shortened and converted to RFC 1123 subdomain names - expression: 'body.pull_request.head.ref.truncate(38).lowerAscii().translate("_", "-")' - bindings: - - ref: github-pr-python-tracer-binding - template: - ref: github-pr-python-tracer-pipeline-template diff --git a/.tekton/github-pr-pipeline.yaml.part b/.tekton/github-pr-pipeline.yaml.part deleted file mode 100644 index db2319ab..00000000 --- a/.tekton/github-pr-pipeline.yaml.part +++ /dev/null @@ -1,61 +0,0 @@ -apiVersion: tekton.dev/v1 -kind: Pipeline -metadata: - name: github-pr-python-tracer-ci-pipeline -spec: - params: - - name: revision - type: string - - name: git-commit-sha - type: string - - name: py-39-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.9-trixie - - name: py-310-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.10-trixie - - name: py-311-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.11-trixie - - name: py-312-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.12-trixie - - name: py-313-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.13-trixie - - name: py-314-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.14-trixie - workspaces: - - name: python-tracer-ci-pipeline-pvc - tasks: - - name: github-set-check-status-to-pending - taskRef: - kind: Task - name: github-set-status - params: - - name: SHA - value: $(params.git-commit-sha) - - name: STATE - value: pending - - name: REPO - value: instana/python-sensor - - name: github-set-check-status-to-success-or-failure - runAfter: - - github-set-check-status-to-pending - - unittest-default - - unittest-cassandra - - unittest-gevent-starlette - - unittest-aws - - unittest-kafka -# - unittest-python-next - taskRef: - kind: Task - name: github-set-status - params: - - name: SHA - value: $(params.git-commit-sha) - - name: STATE - value: success - - name: REPO - value: instana/python-sensor diff --git a/.tekton/github-set-status-task.yaml b/.tekton/github-set-status-task.yaml deleted file mode 100644 index f7ea7b4a..00000000 --- a/.tekton/github-set-status-task.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: github-set-status -spec: - params: - - name: SHA - - name: STATE - - name: REPO - volumes: - - name: githubtoken - secret: - secretName: githubtoken - steps: - - name: set-status - image: quay.io/curl/curl:latest - env: - - name: SHA - value: $(params.SHA) - - name: STATE - value: $(params.STATE) - - name: REPO - value: $(params.REPO) - volumeMounts: - - name: githubtoken - mountPath: /etc/github-set-status - script: | - #!/bin/sh - curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $(cat /etc/github-set-status/token)" \ - -H "Content-Type: application/json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/${REPO}/statuses/${SHA}" \ - -d '{ - "state":"'${STATE}'", - "target_url":"http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/#/namespaces/default/pipelineruns/", - "description":"Tekton build is in state: '${STATE}'", - "context":"Tekton" - }' diff --git a/.tekton/github-webhook-ingress.yaml b/.tekton/github-webhook-ingress.yaml deleted file mode 100644 index 3aa674bc..00000000 --- a/.tekton/github-webhook-ingress.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: github-pr-python-webhook-ingress -spec: - ingressClassName: public-iks-k8s-nginx - tls: - - hosts: - - - rules: - - host: - http: - paths: - - path: /github-pr-python-hooks - pathType: Exact - backend: - service: - name: el-github-pr-python-eventlistener - port: - number: 8080 diff --git a/.tekton/pipeline.yaml b/.tekton/pipeline.yaml deleted file mode 100644 index a74ef6be..00000000 --- a/.tekton/pipeline.yaml +++ /dev/null @@ -1,78 +0,0 @@ -apiVersion: tekton.dev/v1 -kind: Pipeline -metadata: - name: python-tracer-ci-pipeline -spec: - params: - - name: revision - type: string - - name: py-312-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.12-trixie - - name: py-313-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.13-trixie - - name: py-314-imageDigest - type: string - default: public.ecr.aws/docker/library/python:3.14-trixie - workspaces: - - name: python-tracer-ci-pipeline-pvc - tasks: - - name: clone - displayName: "clone $(params.revision)" - params: - - name: revision - value: $(params.revision) - taskRef: - name: python-tracer-clone-task - workspaces: - - name: task-pvc - workspace: python-tracer-ci-pipeline-pvc - - name: unittest-default - displayName: "Python $(params.imageDigest)" - runAfter: - - clone - matrix: - params: - - name: imageDigest - value: - - $(params.py-313-imageDigest) - - $(params.py-314-imageDigest) - taskRef: - name: python-tracer-unittest-default-task - workspaces: - - name: task-pvc - workspace: python-tracer-ci-pipeline-pvc - - name: unittest-cassandra - runAfter: - - clone - params: - - name: imageDigest - value: $(params.py-312-imageDigest) - taskRef: - name: python-tracer-unittest-cassandra-task - workspaces: - - name: task-pvc - workspace: python-tracer-ci-pipeline-pvc - - name: unittest-gevent-starlette - runAfter: - - clone - params: - - name: imageDigest - value: $(params.py-313-imageDigest) - taskRef: - name: python-tracer-unittest-gevent-starlette-task - workspaces: - - name: task-pvc - workspace: python-tracer-ci-pipeline-pvc - - name: unittest-kafka - runAfter: - - clone - params: - - name: imageDigest - value: $(params.py-313-imageDigest) - taskRef: - name: python-tracer-unittest-kafka-task - workspaces: - - name: task-pvc - workspace: python-tracer-ci-pipeline-pvc diff --git a/.tekton/pipelinerun.yaml b/.tekton/pipelinerun.yaml deleted file mode 100644 index c77b6520..00000000 --- a/.tekton/pipelinerun.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: tekton.dev/v1 -kind: PipelineRun -metadata: - name: python-tracer-ci-pipeline-run -spec: - params: - - name: revision - value: "tekton" - pipelineRef: - name: python-tracer-ci-pipeline - workspaces: - - name: python-tracer-ci-pipeline-pvc - volumeClaimTemplate: - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi diff --git a/.tekton/python-tracer-prepuller.yaml b/.tekton/python-tracer-prepuller.yaml deleted file mode 100644 index 3d711dab..00000000 --- a/.tekton/python-tracer-prepuller.yaml +++ /dev/null @@ -1,73 +0,0 @@ -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: python-tracer-prepuller -spec: - selector: - matchLabels: - name: python-tracer-prepuller - template: - metadata: - labels: - name: python-tracer-prepuller - spec: - # Configure an init container for each image you want to pull - initContainers: - - name: prepuller-git - image: public.ecr.aws/docker/library/alpine:latest - command: ["sh", "-c", "'true'"] - - name: prepuller-google-cloud-pubsub - image: quay.io/thekevjames/gcloud-pubsub-emulator:501.0.0 - command: ["sh", "-c", "'true'"] - - name: prepuller-cassandra - image: public.ecr.aws/docker/library/cassandra:3.11.16-jammy - command: ["sh", "-c", "'true'"] - - name: prepuller-rabbitmq - image: public.ecr.aws/docker/library/rabbitmq:3.13.0 - command: ["sh", "-c", "'true'"] - - name: prepuller-redis - image: public.ecr.aws/docker/library/redis:7.2.4-bookworm - command: ["sh", "-c", "'true'"] - - name: prepuller-mongo - image: public.ecr.aws/docker/library/mongo:7.0.6 - command: ["sh", "-c", "'true'"] - - name: prepuller-mariadb - image: public.ecr.aws/docker/library/mariadb:11.3.2 - command: ["sh", "-c", "'true'"] - - name: prepuller-postgres - image: public.ecr.aws/docker/library/postgres:16.10-trixie - command: ["sh", "-c", "'true'"] - - name: prepuller-kafka - image: public.ecr.aws/bitnami/kafka:3.9.0 - command: ["sh", "-c", "'true'"] - - name: prepuller-39 - image: public.ecr.aws/docker/library/python:3.9-trixie - command: ["sh", "-c", "'true'"] - - name: prepuller-310 - image: public.ecr.aws/docker/library/python:3.10-trixie - command: ["sh", "-c", "'true'"] - - name: prepuller-311 - image: public.ecr.aws/docker/library/python:3.11-trixie - command: ["sh", "-c", "'true'"] - - name: prepuller-312 - image: public.ecr.aws/docker/library/python:3.12-trixie - command: ["sh", "-c", "'true'"] - - name: prepuller-313 - image: public.ecr.aws/docker/library/python:3.13-trixie - command: ["sh", "-c", "'true'"] - - name: prepuller-314 - image: public.ecr.aws/docker/library/python:3.14-trixie - command: ["sh", "-c", "'true'"] - - # Use the pause container to ensure the Pod goes into a `Running` phase - # but doesn't take up resource on the cluster - containers: - - name: pause - image: gcr.io/google_containers/pause:3.2 - resources: - limits: - cpu: 1m - memory: 8Mi - requests: - cpu: 1m - memory: 8Mi diff --git a/.tekton/run_unittests.sh b/.tekton/run_unittests.sh deleted file mode 100755 index d4e5103d..00000000 --- a/.tekton/run_unittests.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -set -e - -if [[ -z "${TEST_CONFIGURATION}" ]]; then - echo "The TEST_CONFIGURATION environment variable is missing." >&2 - echo "This should have been provided by the Tekton Task or the developer" >&2 - exit 1 -fi - -if [[ -z "${PYTHON_VERSION}" ]]; then - echo "The PYTHON_VERSION environment variable is missing." >&2 - echo "This is a built-in variable in the official python container images" >&2 - exit 2 -fi - -PYTHON_MINOR_VERSION="$(echo "${PYTHON_VERSION}" | cut -d'.' -f 2)" - -case "${TEST_CONFIGURATION}" in -default) - [ "${PYTHON_MINOR_VERSION}" -eq "14" ] && export REQUIREMENTS='requirements-pre314.txt' || export REQUIREMENTS='requirements.txt' - export TESTS=('tests') ;; -cassandra) - export REQUIREMENTS='requirements-cassandra.txt' - export TESTS=('tests/clients/test_cassandra-driver.py') - export CASSANDRA_TEST='true' ;; -gevent_starlette) - export REQUIREMENTS='requirements-gevent-starlette.txt' - # TODO: uncomment once gevent instrumentation is done - # export TESTS=('tests/frameworks/test_gevent.py' 'tests/frameworks/test_starlette.py') - # export GEVENT_STARLETTE_TEST='true' ;; - export TESTS=('tests/frameworks/test_starlette.py');; -aws) - export REQUIREMENTS='requirements.txt' - export TESTS=('tests_aws') ;; -kafka) - export REQUIREMENTS='requirements-kafka.txt' - export TESTS=('tests/clients/kafka') - export KAFKA_TEST='true' ;; -*) - echo "ERROR \$TEST_CONFIGURATION='${TEST_CONFIGURATION}' is unsupported " \ - "not in (default|cassandra|gevent_starlette|aws|kafka)" >&2 - exit 3 ;; -esac - -echo -n "Configuration is '${TEST_CONFIGURATION}' on ${PYTHON_VERSION} " -echo "with dependencies in '${REQUIREMENTS}'" -ls -lah . - -python -m venv /tmp/venv -# shellcheck disable=SC1091 -source /tmp/venv/bin/activate -pip install --upgrade pip -pip install -e . -pip install -r "tests/${REQUIREMENTS}" - -coverage run \ - --source=instana \ - --data-file=".coverage-${PYTHON_VERSION}-${TEST_CONFIGURATION}" \ - --module \ - pytest \ - --verbose --junitxml=test-results "${TESTS[@]}" # pytest options (not coverage options anymore) diff --git a/.tekton/scheduled-eventlistener.yaml b/.tekton/scheduled-eventlistener.yaml deleted file mode 100644 index f9b8e2a6..00000000 --- a/.tekton/scheduled-eventlistener.yaml +++ /dev/null @@ -1,107 +0,0 @@ -apiVersion: triggers.tekton.dev/v1beta1 -kind: TriggerTemplate -metadata: - name: python-tracer-scheduled-ci-pipeline-template -spec: - params: - - description: The ISO-8601 date and time converted to RFC 1123 subdomain names - name: date-time-normalized - - description: The full sha of the git commit - name: git-commit-sha - - description: The short 7 digit sha of the git commit - name: git-commit-short-sha - resourcetemplates: - - apiVersion: tekton.dev/v1 - kind: PipelineRun - metadata: - # After variable resolution, this has to be maximum 63 character long, - # lower case, RFC 1123 subdomain name. The regex used for validation is - # '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' - name: python-tracer-scheduled-ci-pipeline-$(tt.params.date-time-normalized)-$(tt.params.git-commit-short-sha) - spec: - params: - - name: revision - value: main - - name: git-commit-sha - value: $(tt.params.git-commit-sha) - pipelineRef: - name: python-tracer-ci-pipeline - workspaces: - - name: python-tracer-ci-pipeline-pvc - volumeClaimTemplate: - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: triggers.tekton.dev/v1beta1 -kind: TriggerBinding -metadata: - name: python-tracer-scheduled-binding -spec: - params: - - name: date-time-normalized - value: $(extensions.normalized_date_time) - - name: git-commit-sha - value: $(body.git_main_head_commit_sha) - - name: git-commit-short-sha - value: $(extensions.truncated_sha) ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: python-tracer-scheduled-ci-cronjob -spec: - schedule: "5 0 * * Mon-Fri" - jobTemplate: - spec: - template: - spec: - containers: - - name: git - image: public.ecr.aws/docker/library/alpine:latest - script: | - #!/bin/sh - echo "Installing git" - apk fix && apk --no-cache --update add git gpg less openssh patch - wget -O- \ - --header 'Content-Type: application/json' \ - --post-data '{ - "git_main_head_commit_sha":"'"$(git ls-remote https://github.com/instana/python-sensor main | cut -f1)"'", - "date_time":"'"$(date -u -Iminutes )"'" - }' \ - 'http://el-python-tracer-scheduled-pipeline-listener.default.svc.cluster.local:8080' - restartPolicy: OnFailure ---- -apiVersion: triggers.tekton.dev/v1beta1 -kind: EventListener -metadata: - name: python-tracer-scheduled-pipeline-listener -spec: - serviceAccountName: tekton-triggers-eventlistener-serviceaccount - triggers: - - name: python-tracer-scheduled-pipeline-triggger - interceptors: - - name: add-truncated-sha - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: truncated_sha - expression: "body.git_main_head_commit_sha.truncate(7)" - - name: add-normalized-date-time - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: normalized_date_time - # The date-time converted to RFC 1123 subdomain names - expression: 'body.date_time.split("+")[0].lowerAscii().translate(":", "-")' - bindings: - - ref: python-tracer-scheduled-binding - template: - ref: python-tracer-scheduled-ci-pipeline-template diff --git a/.tekton/task.yaml b/.tekton/task.yaml deleted file mode 100644 index f6b21a05..00000000 --- a/.tekton/task.yaml +++ /dev/null @@ -1,284 +0,0 @@ ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: python-tracer-clone-task -spec: - params: - - name: revision - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: clone - image: public.ecr.aws/docker/library/alpine:latest - script: | - #!/bin/sh - echo "Installing git" - apk fix && apk --no-cache --update add git gpg less openssh patch - echo "Cloning repo" - cd /workspace && git clone --depth 1 -b $(params.revision) https://github.com/instana/python-sensor - ls -lah /workspace ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: python-tracer-unittest-cassandra-task -spec: - sidecars: - - name: cassandra - image: public.ecr.aws/docker/library/cassandra:3.11.16-jammy - env: - - name: MAX_HEAP_SIZE - value: 2048m - - name: HEAP_NEWSIZE - value: 512m - readinessProbe: - exec: - command: - - cqlsh - - -e - - 'describe cluster' - initialDelaySeconds: 20 - params: - - name: imageDigest - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: unittest - image: $(params.imageDigest) - env: - - name: TEST_CONFIGURATION - value: cassandra - workingDir: /workspace/python-sensor/ - command: - - /workspace/python-sensor/.tekton/run_unittests.sh ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: python-tracer-unittest-gevent-starlette-task -spec: - params: - - name: imageDigest - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: unittest - image: $(params.imageDigest) - env: - - name: TEST_CONFIGURATION - value: gevent_starlette - workingDir: /workspace/python-sensor/ - command: - - /workspace/python-sensor/.tekton/run_unittests.sh ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: python-tracer-unittest-default-task -spec: - sidecars: - - name: google-cloud-pubsub - image: quay.io/thekevjames/gcloud-pubsub-emulator:latest - env: - - name: PUBSUB_EMULATOR_HOST - value: 0.0.0.0:8681 - - name: PUBSUB_PROJECT1 - value: test-project,test-topic - ports: - - containerPort: 8681 - hostPort: 8681 - - name: mariadb - image: public.ecr.aws/docker/library/mariadb:11.3.2 - env: - - name: MYSQL_ROOT_PASSWORD # or MARIADB_ROOT_PASSWORD - value: passw0rd - - name: MYSQL_DATABASE # or MARIADB_DATABASE - value: instana_test_db - - name: mongo - image: public.ecr.aws/docker/library/mongo:7.0.6 - - name: postgres - image: public.ecr.aws/docker/library/postgres:16.10-trixie - env: - - name: POSTGRES_USER - value: root - - name: POSTGRES_PASSWORD - value: passw0rd - - name: POSTGRES_DB - value: instana_test_db - readinessProbe: - exec: - command: - - sh - - -c - - pg_isready --host 127.0.0.1 --port 5432 --dbname=${POSTGRES_DB} - timeoutSeconds: 10 - - name: redis - image: public.ecr.aws/docker/library/redis:7.2.4-bookworm - - name: rabbitmq - image: public.ecr.aws/docker/library/rabbitmq:3.13.0 - params: - - name: imageDigest - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: unittest - image: $(params.imageDigest) - env: - - name: TEST_CONFIGURATION - value: default - workingDir: /workspace/python-sensor/ - command: - - /workspace/python-sensor/.tekton/run_unittests.sh ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: python-tracer-unittest-aws-task -spec: - params: - - name: imageDigest - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: unittest - image: $(params.imageDigest) - env: - - name: TEST_CONFIGURATION - value: aws - workingDir: /workspace/python-sensor/ - command: - - /workspace/python-sensor/.tekton/run_unittests.sh ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: python-tracer-unittest-kafka-task -spec: - sidecars: - - name: zookeeper - image: public.ecr.aws/ubuntu/zookeeper:3.1-22.04_edge - ports: - - containerPort: 9093 - env: - - name: TZ - value: "UTC" - - name: kafka - image: public.ecr.aws/ubuntu/kafka:3.1-22.04_edge - env: - - name: TZ - value: "UTC" - - name: ZOOKEEPER_HOST - value: localhost - - name: ZOOKEEPER_PORT - value: "2181" - ports: - - containerPort: 9093 - - containerPort: 9094 - command: - - /opt/kafka/bin/kafka-server-start.sh - - /opt/kafka/config/server.properties - - --override - - listeners=INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9094 - - --override - - advertised.listeners=INTERNAL://localhost:9093,EXTERNAL://localhost:9094 - - --override - - listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT - - --override - - inter.broker.listener.name=INTERNAL - - --override - - broker.id=1 - - --override - - offsets.topic.replication.factor=1 - - --override - - transaction.state.log.replication.factor=1 - - --override - - transaction.state.log.min.isr=1 - - --override - - auto.create.topics.enable=true - params: - - name: imageDigest - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: unittest - image: $(params.imageDigest) - env: - - name: TEST_CONFIGURATION - value: kafka - workingDir: /workspace/python-sensor/ - command: - - /workspace/python-sensor/.tekton/run_unittests.sh ---- -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: python-tracer-unittest-python-next-task -spec: - sidecars: - - name: google-cloud-pubsub - image: quay.io/thekevjames/gcloud-pubsub-emulator:latest - env: - - name: PUBSUB_EMULATOR_HOST - value: 0.0.0.0:8681 - - name: PUBSUB_PROJECT1 - value: test-project,test-topic - ports: - - containerPort: 8681 - hostPort: 8681 - - name: mariadb - image: public.ecr.aws/docker/library/mariadb:11.3.2 - env: - - name: MYSQL_ROOT_PASSWORD # or MARIADB_ROOT_PASSWORD - value: passw0rd - - name: MYSQL_DATABASE # or MARIADB_DATABASE - value: instana_test_db - - name: mongo - image: public.ecr.aws/docker/library/mongo:7.0.6 - - name: postgres - image: public.ecr.aws/docker/library/postgres:16.10-trixie - env: - - name: POSTGRES_USER - value: root - - name: POSTGRES_PASSWORD - value: passw0rd - - name: POSTGRES_DB - value: instana_test_db - readinessProbe: - exec: - command: - - sh - - -c - - pg_isready --host 127.0.0.1 --port 5432 --dbname=${POSTGRES_DB} - timeoutSeconds: 10 - - name: redis - image: public.ecr.aws/docker/library/redis:7.2.4-bookworm - - name: rabbitmq - image: public.ecr.aws/docker/library/rabbitmq:3.13.0 - params: - - name: py-version - type: string - workspaces: - - name: task-pvc - mountPath: /workspace - steps: - - name: unittest - image: public.ecr.aws/docker/library/python:$(params.py-version) - env: - - name: TEST_CONFIGURATION - value: default - workingDir: /workspace/python-sensor/ - command: - - /workspace/python-sensor/.tekton/run_unittests.sh diff --git a/.tekton/tekton-triggers-eventlistener-serviceaccount.yaml b/.tekton/tekton-triggers-eventlistener-serviceaccount.yaml deleted file mode 100644 index e4576c3c..00000000 --- a/.tekton/tekton-triggers-eventlistener-serviceaccount.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: tekton-triggers-eventlistener-serviceaccount ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: tekton-triggers-eventlistener-serviceaccount-binding -subjects: -- kind: ServiceAccount - name: tekton-triggers-eventlistener-serviceaccount -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: tekton-triggers-eventlistener-roles ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: tekton-triggers-eventlistener-serviceaccount-clusterbinding -subjects: -- kind: ServiceAccount - name: tekton-triggers-eventlistener-serviceaccount - namespace: default -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: tekton-triggers-eventlistener-clusterroles