instana 1.214.3 → 1.215.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -10
  3. data/.tekton/.currency/currency-pipeline.yaml +36 -0
  4. data/.tekton/.currency/currency-pipelinerun.yaml +20 -0
  5. data/.tekton/.currency/currency-rbac.yaml +29 -0
  6. data/.tekton/.currency/currency-scheduled-eventlistener.yaml +56 -0
  7. data/.tekton/.currency/currency-tasks.yaml +94 -0
  8. data/.tekton/.currency/docs/report.md +19 -0
  9. data/.tekton/.currency/resources/requirements.txt +5 -0
  10. data/.tekton/.currency/resources/table.json +94 -0
  11. data/.tekton/.currency/scripts/generate_report.py +228 -0
  12. data/.tekton/github-pr-eventlistener.yaml +2 -0
  13. data/.tekton/pipeline.yaml +61 -19
  14. data/.tekton/pipelinerun.yaml +2 -0
  15. data/.tekton/ruby-tracer-prepuller.yaml +83 -0
  16. data/.tekton/scheduled-eventlistener.yaml +2 -0
  17. data/.tekton/task.yaml +3 -26
  18. data/gemfiles/net_http_01.gemfile +1 -0
  19. data/lib/instana/activators/action_view.rb +5 -2
  20. data/lib/instana/config.rb +3 -0
  21. data/lib/instana/instrumentation/action_view.rb +40 -14
  22. data/lib/instana/instrumentation/excon.rb +4 -2
  23. data/lib/instana/instrumentation/net-http.rb +7 -1
  24. data/lib/instana/instrumentation/redis.rb +1 -1
  25. data/lib/instana/tracer.rb +7 -6
  26. data/lib/instana/version.rb +1 -1
  27. data/test/backend/host_agent_test.rb +16 -4
  28. data/test/instrumentation/dalli_test.rb +33 -0
  29. data/test/instrumentation/excon_test.rb +40 -0
  30. data/test/instrumentation/graphql_test.rb +41 -0
  31. data/test/instrumentation/grpc_test.rb +40 -1
  32. data/test/instrumentation/mongo_test.rb +31 -0
  33. data/test/instrumentation/net_http_test.rb +22 -2
  34. data/test/instrumentation/rails_action_mailer_test.rb +18 -0
  35. data/test/instrumentation/rails_action_view_test.rb +0 -41
  36. data/test/instrumentation/redis_test.rb +23 -0
  37. data/test/instrumentation/resque_test.rb +21 -0
  38. data/test/instrumentation/rest_client_test.rb +43 -0
  39. data/test/instrumentation/sidekiq-client_test.rb +37 -3
  40. data/test/instrumentation/sidekiq-worker_test.rb +2 -2
  41. data/test/secrets_test.rb +1 -1
  42. data/test/tracing/tracer_test.rb +2 -2
  43. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e1392f093e37988f8cb349c73f1314d81b4058f896c244382328e636a18bd83
4
- data.tar.gz: 307c18d065c6618c544e6b3bc2f622c184cafdb8c98096e375b84a0018bd6c6b
3
+ metadata.gz: 18251267394e2bad33fbd75aec3a2c9a8c846ae7076ee101dc7aa58cdf4b12d1
4
+ data.tar.gz: 920422e3ad64902191910d428335ec984ff56ece4204a6f53ef709fc07dff166
5
5
  SHA512:
6
- metadata.gz: 1d895f1cc6dc321277f366a11040e6626c31e08b4486e662bdf407ea20e91d7c1927b04f7441a942e7392254a7d491c41c788bd0344109dee524514d31c3a074
7
- data.tar.gz: 52f4e79e404d0ec0efe6f091f57cd09a9cfc8418d229a55324e5cf4e96a381b75a976a352b79c0659f03a805d5aab519df9b8c6a0b9d7e9ec7e99014601896fd
6
+ metadata.gz: bbd2324015660989cfdc10af661fc2416ffa473291affdfe06d0e2aa78a2f0de1accc570962166cd9cf7a6c50e9bd68e91efd483e0a69d68e93816f9fac59705
7
+ data.tar.gz: cfcd4bb472effa2ff81c04eb4b768cd91d70dcf56b59794c00644aacfb36872797e864bb5b60511ff2b1fca2409ce441226b9fe9bf5ff3b8f342da5f3e1762bc
data/.circleci/config.yml CHANGED
@@ -189,15 +189,6 @@ executors:
189
189
  commands:
190
190
  setup:
191
191
  steps:
192
- - run:
193
- name: Install iproute2
194
- command: |
195
- sudo apt-get update
196
- sudo apt-get install iproute2
197
- - run:
198
- name: Install Java
199
- command: |
200
- sudo apt-get install openjdk-11-jdk
201
192
  - run:
202
193
  name: Update RubyGems
203
194
  command: |
@@ -239,7 +230,7 @@ commands:
239
230
  environment:
240
231
  BUNDLE_GEMFILE: './Gemfile'
241
232
  - run:
242
- name: Run SonarQube to capture coverage
233
+ name: Run SonarQube to report the coverage
243
234
  command: |
244
235
  wget -O /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.1.3023.zip
245
236
  unzip -d /tmp /tmp/sonar-scanner-cli.zip
@@ -0,0 +1,36 @@
1
+ apiVersion: tekton.dev/v1beta1
2
+ kind: Pipeline
3
+ metadata:
4
+ name: ruby-currency-pipeline
5
+ spec:
6
+ params:
7
+ - name: revision
8
+ type: string
9
+ workspaces:
10
+ - name: ruby-currency-pvc
11
+ tasks:
12
+ - name: clone-repo
13
+ params:
14
+ - name: revision
15
+ value: $(params.revision)
16
+ taskRef:
17
+ name: ruby-git-clone-task
18
+ workspaces:
19
+ - name: task-pvc
20
+ workspace: ruby-currency-pvc
21
+ - name: generate-currency-report
22
+ runAfter:
23
+ - clone-repo
24
+ taskRef:
25
+ name: ruby-generate-currency-report-task
26
+ workspaces:
27
+ - name: task-pvc
28
+ workspace: ruby-currency-pvc
29
+ - name: upload-currency-report
30
+ runAfter:
31
+ - generate-currency-report
32
+ taskRef:
33
+ name: ruby-upload-currency-report-task
34
+ workspaces:
35
+ - name: task-pvc
36
+ workspace: ruby-currency-pvc
@@ -0,0 +1,20 @@
1
+ apiVersion: tekton.dev/v1beta1
2
+ kind: PipelineRun
3
+ metadata:
4
+ name: ruby-currency-pipelinerun
5
+ spec:
6
+ params:
7
+ - name: revision
8
+ value: "master"
9
+ pipelineRef:
10
+ name: ruby-currency-pipeline
11
+ serviceAccountName: currency-serviceaccount
12
+ workspaces:
13
+ - name: ruby-currency-pvc
14
+ volumeClaimTemplate:
15
+ spec:
16
+ accessModes:
17
+ - ReadWriteOnce
18
+ resources:
19
+ requests:
20
+ storage: 100Mi
@@ -0,0 +1,29 @@
1
+ apiVersion: v1
2
+ kind: ServiceAccount
3
+ metadata:
4
+ name: currency-serviceaccount
5
+ ---
6
+ apiVersion: rbac.authorization.k8s.io/v1
7
+ kind: ClusterRole
8
+ metadata:
9
+ name: currency-clusterrole
10
+ rules:
11
+ - apiGroups: [""]
12
+ resources: ["pods", "pods/log"]
13
+ verbs: ["get", "list"]
14
+ - apiGroups: ["tekton.dev"]
15
+ resources: ["taskruns"]
16
+ verbs: ["get", "list"]
17
+ ---
18
+ apiVersion: rbac.authorization.k8s.io/v1
19
+ kind: ClusterRoleBinding
20
+ metadata:
21
+ name: currency-clusterrolebinding
22
+ subjects:
23
+ - kind: ServiceAccount
24
+ name: currency-serviceaccount
25
+ namespace: default
26
+ roleRef:
27
+ apiGroup: rbac.authorization.k8s.io
28
+ kind: ClusterRole
29
+ name: currency-clusterrole
@@ -0,0 +1,56 @@
1
+ apiVersion: triggers.tekton.dev/v1beta1
2
+ kind: EventListener
3
+ metadata:
4
+ name: ruby-currency-cron-listener
5
+ spec:
6
+ serviceAccountName: tekton-triggers-eventlistener-serviceaccount
7
+ triggers:
8
+ - name: currency-cron-trigger
9
+ template:
10
+ ref: ruby-currency-trigger-template
11
+ ---
12
+ apiVersion: triggers.tekton.dev/v1beta1
13
+ kind: TriggerTemplate
14
+ metadata:
15
+ name: ruby-currency-trigger-template
16
+ spec:
17
+ resourcetemplates:
18
+ - apiVersion: tekton.dev/v1beta1
19
+ kind: PipelineRun
20
+ metadata:
21
+ generateName: ruby-currency-
22
+ spec:
23
+ pipelineRef:
24
+ name: ruby-currency-pipeline
25
+ serviceAccountName: currency-serviceaccount
26
+ params:
27
+ - name: revision
28
+ value: "master"
29
+ workspaces:
30
+ - name: ruby-currency-pvc
31
+ volumeClaimTemplate:
32
+ spec:
33
+ accessModes:
34
+ - ReadWriteOnce
35
+ resources:
36
+ requests:
37
+ storage: 100Mi
38
+ ---
39
+ apiVersion: batch/v1
40
+ kind: CronJob
41
+ metadata:
42
+ name: ruby-currency-cronjob
43
+ spec:
44
+ schedule: "5 3 * * Mon-Fri"
45
+ jobTemplate:
46
+ spec:
47
+ template:
48
+ spec:
49
+ containers:
50
+ - name: http-request-to-el-svc
51
+ # curlimages/curl:8.6.0
52
+ image: curlimages/curl@sha256:f2237028bed58de91f62aea74260bb2a299cf12fbcabc23cfaf125fef276c884
53
+ imagePullPolicy: IfNotPresent
54
+ args: ["curl", "-X", "POST", "--data", "{}", "el-ruby-currency-cron-listener.default.svc.cluster.local:8080"]
55
+ restartPolicy: OnFailure
56
+ ---
@@ -0,0 +1,94 @@
1
+ apiVersion: tekton.dev/v1beta1
2
+ kind: Task
3
+ metadata:
4
+ name: ruby-git-clone-task
5
+ spec:
6
+ params:
7
+ - name: revision
8
+ type: string
9
+ workspaces:
10
+ - name: task-pvc
11
+ mountPath: /workspace
12
+ steps:
13
+ - name: clone-repo
14
+ # alpine/git:2.43.0
15
+ image: alpine/git@sha256:6ff4de047dcc8f0c7d75d2efff63fbc189e87d2f458305f2cc8f165ff83309cf
16
+ script: |
17
+ #!/bin/sh
18
+ echo "Cloning repo"
19
+ cd /workspace && git clone --filter=blob:none --sparse --depth 1 https://github.com/instana/ruby-sensor -b $(params.revision)
20
+ cd ruby-sensor
21
+ git sparse-checkout add .tekton/.currency
22
+ ls -lah /workspace/ruby-sensor
23
+ ---
24
+ apiVersion: tekton.dev/v1beta1
25
+ kind: Task
26
+ metadata:
27
+ name: ruby-generate-currency-report-task
28
+ spec:
29
+ workspaces:
30
+ - name: task-pvc
31
+ mountPath: /workspace
32
+ steps:
33
+ - name: generate-currency-report
34
+ # 3.10.13-bookworm
35
+ image: python@sha256:c970ff53939772f47b0672e380328afb50d8fd1c0568ed4f82c22effc54244fc
36
+ script: |
37
+ #!/usr/bin/env bash
38
+
39
+ cd /workspace/ruby-sensor/.tekton/.currency
40
+
41
+ python -m venv /tmp/venv
42
+ source /tmp/venv/bin/activate
43
+ pip install -r resources/requirements.txt
44
+
45
+ python scripts/generate_report.py
46
+ if [ $? -ne 0 ]; then
47
+ echo "Error occured while generating the ruby tracer currency report." >&2
48
+ exit 1
49
+ fi
50
+ cat docs/report.md
51
+ ---
52
+ apiVersion: tekton.dev/v1beta1
53
+ kind: Task
54
+ metadata:
55
+ name: ruby-upload-currency-report-task
56
+ spec:
57
+ params:
58
+ - name: github-token-secret
59
+ default: instanacd-github-api-token
60
+ workspaces:
61
+ - name: task-pvc
62
+ mountPath: /workspace
63
+ steps:
64
+ - name: upload-currency-report
65
+ # alpine/git:2.43.0
66
+ image: alpine/git@sha256:6ff4de047dcc8f0c7d75d2efff63fbc189e87d2f458305f2cc8f165ff83309cf
67
+ env:
68
+ - name: GH_ENTERPRISE_TOKEN
69
+ valueFrom:
70
+ secretKeyRef:
71
+ name: $(params.github-token-secret)
72
+ key: "GH_ENTERPRISE_TOKEN"
73
+ script: |
74
+ #!/bin/sh
75
+
76
+ cd /workspace
77
+ git clone https://oauth2:$GH_ENTERPRISE_TOKEN@github.ibm.com/instana/tracer-reports.git
78
+
79
+ if [ $? -ne 0 ]; then
80
+ echo "The attempt to clone the tracer-reports repository failed, preventing the upload of ruby tracer currency report." >&2
81
+ exit 1
82
+ fi
83
+
84
+ cd tracer-reports
85
+
86
+ cp ../ruby-sensor/.tekton/.currency/docs/report.md ./automated/currency/ruby/report.md
87
+
88
+ git config user.name "Instanacd PAT for GitHub Enterprise"
89
+ git config user.email instana.ibm.github.enterprise@ibm.com
90
+
91
+ git add .
92
+
93
+ git commit -m "chore: Updated ruby currency report"
94
+ git push origin main
@@ -0,0 +1,19 @@
1
+ ##### This page is auto-generated. Any change will be overwritten after the next sync. Please apply changes directly to the files in the [ruby tracer](https://github.com/instana/ruby-sensor) repo.
2
+ ## Ruby supported packages and versions
3
+ | Package name | Support Policy | Beta version | Last Supported Version | Latest version | Up-to-date | Cloud Native |
4
+ |:---------------|:-----------------|:---------------|:-------------------------|:-----------------|:-------------|:---------------|
5
+ | Cuba | On demand | No | 4.0.3 | 4.0.3 | Yes | No |
6
+ | Rack | 0-day | No | 3.1.3 | 3.1.3 | Yes | No |
7
+ | Rails | 30-days | No | 7.1.3.4 | 7.1.3.4 | Yes | No |
8
+ | Rails::API | 30-days | No | 0.4.1 | 0.4.1 | Yes | No |
9
+ | Rails LTS | On demand | No | 5.2 | 5.2 | Yes | No |
10
+ | Roda | 30-days | No | 3.81.0 | 3.81.0 | Yes | No |
11
+ | Sinatra | 30-days | No | 4.0.0 | 4.0.0 | Yes | No |
12
+ | Excon | 30-days | No | 0.110.0 | 0.110.0 | Yes | Yes |
13
+ | gRPC | 30-days | No | 1.64.0 | 1.64.0 | Yes | No |
14
+ | Net::HTTP | 0-day | No | 0.4.1 | 0.4.1 | Yes | No |
15
+ | Rest-Client | 30-days | No | 2.1.0 | 2.1.0 | Yes | No |
16
+ | Dalli | 30-days | No | 3.2.8 | 3.2.8 | Yes | No |
17
+ | Resque | 30-days | No | 2.6.0 | 2.6.0 | Yes | Yes |
18
+ | Sidekiq | 30-days | No | 7.2.4 | 7.2.4 | Yes | Yes |
19
+ | GraphQL | 30-days | No | 2.3.5 | 2.3.5 | Yes | Yes |
@@ -0,0 +1,5 @@
1
+ requests
2
+ pandas
3
+ beautifulsoup4
4
+ tabulate
5
+ kubernetes
@@ -0,0 +1,94 @@
1
+ {
2
+ "table": [
3
+ {
4
+ "Package name": "Cuba",
5
+ "Support Policy": "On demand",
6
+ "Beta version": "No",
7
+ "Cloud Native": "No"
8
+ },
9
+ {
10
+ "Package name": "Rack",
11
+ "Support Policy": "0-day",
12
+ "Beta version": "No",
13
+ "Cloud Native": "No"
14
+ },
15
+ {
16
+ "Package name": "Rails",
17
+ "Support Policy": "30-days",
18
+ "Beta version": "No",
19
+ "Cloud Native": "No"
20
+ },
21
+ {
22
+ "Package name": "Rails::API",
23
+ "Support Policy": "30-days",
24
+ "Beta version": "No",
25
+ "Cloud Native": "No"
26
+ },
27
+ {
28
+ "Package name": "Rails LTS",
29
+ "Support Policy": "On demand",
30
+ "Beta version": "No",
31
+ "Cloud Native": "No"
32
+ },
33
+ {
34
+ "Package name": "Roda",
35
+ "Support Policy": "30-days",
36
+ "Beta version": "No",
37
+ "Cloud Native": "No"
38
+ },
39
+ {
40
+ "Package name": "Sinatra",
41
+ "Support Policy": "30-days",
42
+ "Beta version": "No",
43
+ "Cloud Native": "No"
44
+ },
45
+ {
46
+ "Package name": "Excon",
47
+ "Support Policy": "30-days",
48
+ "Beta version": "No",
49
+ "Cloud Native": "Yes"
50
+ },
51
+ {
52
+ "Package name": "gRPC",
53
+ "Support Policy": "30-days",
54
+ "Beta version": "No",
55
+ "Cloud Native": "No"
56
+ },
57
+ {
58
+ "Package name": "Net::HTTP",
59
+ "Support Policy": "0-day",
60
+ "Beta version": "No",
61
+ "Cloud Native": "No"
62
+ },
63
+ {
64
+ "Package name": "Rest-Client",
65
+ "Support Policy": "30-days",
66
+ "Beta version": "No",
67
+ "Cloud Native": "No"
68
+ },
69
+ {
70
+ "Package name": "Dalli",
71
+ "Support Policy": "30-days",
72
+ "Beta version": "No",
73
+ "Cloud Native": "No"
74
+ },
75
+ {
76
+ "Package name": "Resque",
77
+ "Support Policy": "30-days",
78
+ "Beta version": "No",
79
+ "Cloud Native": "Yes"
80
+ },
81
+ {
82
+ "Package name": "Sidekiq",
83
+ "Support Policy": "30-days",
84
+ "Beta version": "No",
85
+ "Cloud Native": "Yes"
86
+ },
87
+ {
88
+ "Package name": "GraphQL",
89
+ "Support Policy": "30-days",
90
+ "Beta version": "No",
91
+ "Cloud Native": "Yes"
92
+ }
93
+ ]
94
+ }
@@ -0,0 +1,228 @@
1
+ # Standard Libraries
2
+ import re
3
+ from json import load
4
+
5
+ # Third Party
6
+ from requests import get
7
+ from pandas import DataFrame
8
+ from bs4 import BeautifulSoup
9
+ from kubernetes import client, config
10
+
11
+ JSON_FILE = "resources/table.json"
12
+ REPORT_FILE = "docs/report.md"
13
+ API_V1_ENDPOINT = "https://rubygems.org/api/v1/versions/"
14
+
15
+ def filter_taskruns(taskrun_filter, taskruns):
16
+ filtered_taskruns = list(filter(taskrun_filter, taskruns))
17
+ filtered_taskruns.sort(
18
+ key=lambda tr: tr["metadata"]["creationTimestamp"], reverse=True
19
+ )
20
+
21
+ return filtered_taskruns
22
+
23
+
24
+ def get_taskruns(namespace, task_name):
25
+ group = "tekton.dev"
26
+ version = "v1"
27
+ plural = "taskruns"
28
+
29
+ # access the custom resource from tekton
30
+ tektonV1 = client.CustomObjectsApi()
31
+ taskruns = tektonV1.list_namespaced_custom_object(
32
+ group,
33
+ version,
34
+ namespace,
35
+ plural,
36
+ label_selector=f"{group}/task={task_name}, triggers.tekton.dev/trigger=ruby-tracer-scheduled-pipeline-triggger",
37
+ )["items"]
38
+
39
+ return taskruns
40
+
41
+
42
+ def process_taskrun_logs(
43
+ taskruns, core_v1_client, namespace, library, tekton_ci_output
44
+ ):
45
+ for tr in taskruns:
46
+ pod_name = tr["status"]["podName"]
47
+ taskrun_name = tr["metadata"]["name"]
48
+ logs = core_v1_client.read_namespaced_pod_log(
49
+ pod_name, namespace, container="step-unittest"
50
+ )
51
+ if "Installing" not in logs:
52
+ print(
53
+ f"Unable to retrieve logs from taskrun pod {pod_name} of taskrun {taskrun_name} for gem {library}."
54
+ )
55
+ continue
56
+
57
+ print(
58
+ f"Retrieving logs from taskrun pod {pod_name} of taskrun {taskrun_name} for gem {library}.."
59
+ )
60
+
61
+ match = re.search(f"Installing ({library} [^\s]+)", logs)
62
+ tekton_ci_output += f"{match[1]}\n"
63
+ break
64
+
65
+ return tekton_ci_output
66
+
67
+
68
+ def get_tekton_ci_output():
69
+ config.load_incluster_config()
70
+
71
+ namespace = "default"
72
+ core_v1_client = client.CoreV1Api()
73
+
74
+ ruby_33_prefix = "unittest-default-ruby-33-"
75
+ ruby_31_prefix = "unittest-default-ruby-31-"
76
+
77
+ default_libraries_dict = {
78
+ "cuba": f"{ruby_33_prefix}1",
79
+ "excon": f"{ruby_33_prefix}4",
80
+ "graphql": f"{ruby_33_prefix}6",
81
+ "grpc": f"{ruby_33_prefix}7",
82
+ "rack": f"{ruby_33_prefix}10",
83
+ "rest-client": f"{ruby_33_prefix}11",
84
+ "roda": f"{ruby_33_prefix}13",
85
+ "sinatra": f"{ruby_33_prefix}16",
86
+ "net-http": f"{ruby_31_prefix}8",
87
+ }
88
+
89
+ tekton_ci_output = ""
90
+ task_name = "ruby-tracer-unittest-default-libraries-task"
91
+ default_taskruns = get_taskruns(namespace, task_name)
92
+
93
+ for library, pattern in default_libraries_dict.items():
94
+ taskrun_filter = (
95
+ lambda tr: tr["metadata"]["name"].endswith(pattern)
96
+ and tr["status"]["conditions"][0]["type"] == "Succeeded"
97
+ )
98
+ filtered_default_taskruns = filter_taskruns(taskrun_filter, default_taskruns)
99
+
100
+ tekton_ci_output = process_taskrun_logs(
101
+ filtered_default_taskruns,
102
+ core_v1_client,
103
+ namespace,
104
+ library,
105
+ tekton_ci_output,
106
+ )
107
+
108
+ other_libraries_dict = {
109
+ "rails": {
110
+ "pattern": "rails-postgres-11",
111
+ "task_name": "ruby-tracer-unittest-rails-postgres-task",
112
+ },
113
+ "dalli": {
114
+ "pattern": "memcached-11",
115
+ "task_name": "ruby-tracer-unittest-memcached-libraries-task",
116
+ },
117
+ "resque": {
118
+ "pattern": "unittest-redis-ruby-32-33-9",
119
+ "task_name": "ruby-tracer-unittest-redis-libraries-task",
120
+ },
121
+ "sidekiq": {
122
+ "pattern": "unittest-redis-ruby-32-33-18",
123
+ "task_name": "ruby-tracer-unittest-redis-libraries-task",
124
+ },
125
+ }
126
+
127
+ for library, inner_dict in other_libraries_dict.items():
128
+ pattern = inner_dict["pattern"]
129
+ task_name = inner_dict["task_name"]
130
+ taskrun_filter = (
131
+ lambda tr: tr["metadata"]["name"].endswith(pattern)
132
+ and tr["status"]["conditions"][0]["type"] == "Succeeded"
133
+ )
134
+ other_taskruns = get_taskruns(namespace, task_name)
135
+ filtered_other_taskruns = filter_taskruns(taskrun_filter, other_taskruns)
136
+
137
+ tekton_ci_output = process_taskrun_logs(
138
+ filtered_other_taskruns,
139
+ core_v1_client,
140
+ namespace,
141
+ library,
142
+ tekton_ci_output
143
+ )
144
+
145
+ return tekton_ci_output
146
+
147
+
148
+ def get_upstream_version(dependency):
149
+ """get the latest version available upstream"""
150
+ if dependency != "rails lts":
151
+ response = get(f"{API_V1_ENDPOINT}/{dependency}/latest.json")
152
+ response_json = response.json()
153
+ latest_version = response_json["version"]
154
+ else:
155
+ url = "https://makandracards.com/railslts/16137-installing-rails-lts/read"
156
+ page = get(url)
157
+ soup = BeautifulSoup(page.text, "html.parser")
158
+ text = soup.findAll("li")[-1].text
159
+ pattern = "(\d+\.\d+\.?\d*)"
160
+ latest_version = re.search(pattern, text)[1]
161
+ return latest_version
162
+
163
+
164
+ def get_last_supported_version(tekton_ci_output, dependency):
165
+ """get up-to-date supported version"""
166
+ pattern = r" ([^\s]+)"
167
+
168
+ last_supported_version = re.search(dependency + pattern, tekton_ci_output, flags=re.I | re.M)
169
+
170
+ return last_supported_version[1]
171
+
172
+
173
+ def isUptodate(last_supported_version, latest_version):
174
+ if last_supported_version == latest_version:
175
+ up_to_date = "Yes"
176
+ else:
177
+ up_to_date = "No"
178
+
179
+ return up_to_date
180
+
181
+ def main():
182
+ # Read the JSON file
183
+ with open(JSON_FILE) as file:
184
+ data = load(file)
185
+
186
+ tekton_ci_output = get_tekton_ci_output()
187
+
188
+ items = data["table"]
189
+
190
+ for item in items:
191
+ package = item["Package name"]
192
+ package = package.lower().replace("::", "-")
193
+
194
+ latest_version = get_upstream_version(package)
195
+
196
+ if not package in ["rails lts", "rails-api"]:
197
+ last_supported_version = get_last_supported_version(tekton_ci_output, package)
198
+ else:
199
+ last_supported_version = latest_version
200
+
201
+ up_to_date = isUptodate(last_supported_version, latest_version)
202
+
203
+ item.update(
204
+ {
205
+ "Last Supported Version": last_supported_version,
206
+ "Latest version": latest_version,
207
+ "Up-to-date": up_to_date,
208
+ },
209
+ )
210
+
211
+ # Create a DataFrame from the list of dictionaries
212
+ df = DataFrame(items)
213
+ df.insert(len(df.columns) - 1, "Cloud Native", df.pop("Cloud Native"))
214
+
215
+ # Convert dataframe to markdown
216
+ markdown_table = df.to_markdown(index=False)
217
+
218
+ disclaimer = "##### This page is auto-generated. Any change will be overwritten after the next sync. Please apply changes directly to the files in the [ruby tracer](https://github.com/instana/ruby-sensor) repo."
219
+ title = "## Ruby supported packages and versions"
220
+
221
+ # Combine disclaimer, title, and markdown table with line breaks
222
+ final_markdown = disclaimer + "\n" + title + "\n" + markdown_table
223
+
224
+ with open(REPORT_FILE, "w") as file:
225
+ file.write(final_markdown)
226
+
227
+ if __name__ == "__main__":
228
+ main()
@@ -21,6 +21,8 @@ spec:
21
21
  # '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
22
22
  name: ruby-tracer-pr-$(tt.params.git-branch-normalized)-$(tt.params.git-commit-short-sha)
23
23
  spec:
24
+ timeouts:
25
+ pipeline: "2h"
24
26
  params:
25
27
  - name: revision
26
28
  value: $(tt.params.git-branch)