instana 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/lib/instana/setup.rb +1 -0
  3. data/lib/instana/span_filtering/condition.rb +134 -0
  4. data/lib/instana/span_filtering/configuration.rb +262 -0
  5. data/lib/instana/span_filtering/filter_rule.rb +31 -0
  6. data/lib/instana/span_filtering.rb +62 -0
  7. data/lib/instana/trace/span.rb +5 -3
  8. data/lib/instana/version.rb +1 -1
  9. metadata +7 -258
  10. data/.circleci/config.yml +0 -361
  11. data/.codeclimate.yml +0 -23
  12. data/.editorconfig +0 -10
  13. data/.fasterer.yml +0 -23
  14. data/.github/ISSUE_TEMPLATE/bug.yml +0 -39
  15. data/.github/ISSUE_TEMPLATE/config.yml +0 -8
  16. data/.github/workflows/pr_commits_signed_off.yml +0 -16
  17. data/.github/workflows/release-notification-on-slack.yml +0 -34
  18. data/.gitignore +0 -19
  19. data/.rubocop.yml +0 -34
  20. data/.rubocop_todo.yml +0 -1140
  21. data/.tekton/.currency/docs/report.md +0 -20
  22. data/.tekton/.currency/resources/requirements.txt +0 -4
  23. data/.tekton/.currency/resources/table.json +0 -100
  24. data/.tekton/.currency/scripts/generate_report.py +0 -308
  25. data/.tekton/README.md +0 -278
  26. data/.tekton/github-interceptor-secret.yaml +0 -8
  27. data/.tekton/github-pr-eventlistener.yaml +0 -104
  28. data/.tekton/github-pr-pipeline.yaml.part +0 -38
  29. data/.tekton/github-set-status-task.yaml +0 -43
  30. data/.tekton/github-webhook-ingress.yaml +0 -20
  31. data/.tekton/pipeline.yaml +0 -484
  32. data/.tekton/pipelinerun.yaml +0 -21
  33. data/.tekton/prepuller-restart-service-account.yaml +0 -31
  34. data/.tekton/ruby-tracer-prepuller-cronjob.yaml +0 -20
  35. data/.tekton/ruby-tracer-prepuller.yaml +0 -88
  36. data/.tekton/run_unittests.sh +0 -87
  37. data/.tekton/scheduled-eventlistener.yaml +0 -108
  38. data/.tekton/task.yaml +0 -453
  39. data/.tekton/tekton-triggers-eventlistener-serviceaccount.yaml +0 -29
  40. data/Appraisals +0 -124
  41. data/CONTRIBUTING.md +0 -86
  42. data/Gemfile +0 -22
  43. data/LICENSE +0 -22
  44. data/MAINTAINERS.md +0 -3
  45. data/Rakefile +0 -49
  46. data/bin/announce_release_on_slack.py +0 -103
  47. data/docker-compose.yml +0 -20
  48. data/download.sh +0 -85
  49. data/examples/otel.rb +0 -98
  50. data/examples/tracing.rb +0 -85
  51. data/extras/license_header.rb +0 -44
  52. data/gemfiles/.bundle/config +0 -2
  53. data/gemfiles/aws_30.gemfile +0 -21
  54. data/gemfiles/aws_60.gemfile +0 -16
  55. data/gemfiles/cuba_30.gemfile +0 -16
  56. data/gemfiles/cuba_40.gemfile +0 -13
  57. data/gemfiles/dalli_20.gemfile +0 -15
  58. data/gemfiles/dalli_30.gemfile +0 -12
  59. data/gemfiles/dalli_32.gemfile +0 -12
  60. data/gemfiles/excon_0100.gemfile +0 -14
  61. data/gemfiles/excon_021.gemfile +0 -17
  62. data/gemfiles/excon_079.gemfile +0 -17
  63. data/gemfiles/excon_100.gemfile +0 -14
  64. data/gemfiles/graphql_10.gemfile +0 -16
  65. data/gemfiles/graphql_20.gemfile +0 -15
  66. data/gemfiles/grpc_10.gemfile +0 -15
  67. data/gemfiles/mongo_216.gemfile +0 -15
  68. data/gemfiles/mongo_219.gemfile +0 -12
  69. data/gemfiles/net_http_01.gemfile +0 -17
  70. data/gemfiles/rack_16.gemfile +0 -15
  71. data/gemfiles/rack_20.gemfile +0 -15
  72. data/gemfiles/rack_30.gemfile +0 -13
  73. data/gemfiles/rails_42.gemfile +0 -18
  74. data/gemfiles/rails_50.gemfile +0 -19
  75. data/gemfiles/rails_52.gemfile +0 -19
  76. data/gemfiles/rails_60.gemfile +0 -19
  77. data/gemfiles/rails_61.gemfile +0 -21
  78. data/gemfiles/rails_70.gemfile +0 -18
  79. data/gemfiles/rails_71.gemfile +0 -17
  80. data/gemfiles/rails_80.gemfile +0 -17
  81. data/gemfiles/redis_40.gemfile +0 -15
  82. data/gemfiles/redis_50.gemfile +0 -13
  83. data/gemfiles/redis_51.gemfile +0 -13
  84. data/gemfiles/resque_122.gemfile +0 -16
  85. data/gemfiles/resque_1274_3scale.gemfile +0 -17
  86. data/gemfiles/resque_20.gemfile +0 -16
  87. data/gemfiles/rest_client_16.gemfile +0 -17
  88. data/gemfiles/rest_client_20.gemfile +0 -17
  89. data/gemfiles/roda_20.gemfile +0 -16
  90. data/gemfiles/roda_30.gemfile +0 -16
  91. data/gemfiles/rubocop_162.gemfile +0 -6
  92. data/gemfiles/sequel_56.gemfile +0 -16
  93. data/gemfiles/sequel_57.gemfile +0 -16
  94. data/gemfiles/sequel_58.gemfile +0 -16
  95. data/gemfiles/shoryuken_50.gemfile +0 -16
  96. data/gemfiles/shoryuken_60.gemfile +0 -13
  97. data/gemfiles/sidekiq_42.gemfile +0 -15
  98. data/gemfiles/sidekiq_50.gemfile +0 -15
  99. data/gemfiles/sidekiq_60.gemfile +0 -12
  100. data/gemfiles/sidekiq_65.gemfile +0 -12
  101. data/gemfiles/sidekiq_70.gemfile +0 -12
  102. data/gemfiles/sinatra_14.gemfile +0 -15
  103. data/gemfiles/sinatra_22.gemfile +0 -12
  104. data/gemfiles/sinatra_30.gemfile +0 -12
  105. data/gemfiles/sinatra_40.gemfile +0 -12
  106. data/instana.gemspec +0 -53
  107. data/log/.keep +0 -0
  108. data/sonar-project.properties +0 -9
  109. data/test/activator_test.rb +0 -50
  110. data/test/backend/agent_test.rb +0 -80
  111. data/test/backend/gc_snapshot_test.rb +0 -11
  112. data/test/backend/host_agent_activation_observer_test.rb +0 -73
  113. data/test/backend/host_agent_lookup_test.rb +0 -78
  114. data/test/backend/host_agent_reporting_observer_test.rb +0 -276
  115. data/test/backend/host_agent_test.rb +0 -89
  116. data/test/backend/process_info_test.rb +0 -83
  117. data/test/backend/request_client_test.rb +0 -39
  118. data/test/backend/serverless_agent_test.rb +0 -83
  119. data/test/benchmarks/bench_id_generation.rb +0 -15
  120. data/test/benchmarks/bench_opentracing.rb +0 -16
  121. data/test/config_test.rb +0 -34
  122. data/test/frameworks/cuba_test.rb +0 -61
  123. data/test/frameworks/roda_test.rb +0 -60
  124. data/test/frameworks/sinatra_test.rb +0 -71
  125. data/test/instana_test.rb +0 -37
  126. data/test/instrumentation/aws_test.rb +0 -241
  127. data/test/instrumentation/dalli_test.rb +0 -325
  128. data/test/instrumentation/excon_test.rb +0 -204
  129. data/test/instrumentation/graphql_test.rb +0 -289
  130. data/test/instrumentation/grpc_test.rb +0 -420
  131. data/test/instrumentation/mongo_test.rb +0 -68
  132. data/test/instrumentation/net_http_test.rb +0 -220
  133. data/test/instrumentation/rack_instrumented_request_test.rb +0 -211
  134. data/test/instrumentation/rack_test.rb +0 -415
  135. data/test/instrumentation/rails_action_cable_test.rb +0 -135
  136. data/test/instrumentation/rails_action_controller_test.rb +0 -218
  137. data/test/instrumentation/rails_action_mailer_test.rb +0 -66
  138. data/test/instrumentation/rails_action_view_test.rb +0 -154
  139. data/test/instrumentation/rails_active_job_test.rb +0 -65
  140. data/test/instrumentation/rails_active_record_database_missing_test.rb +0 -44
  141. data/test/instrumentation/rails_active_record_test.rb +0 -116
  142. data/test/instrumentation/redis_test.rb +0 -152
  143. data/test/instrumentation/resque_test.rb +0 -188
  144. data/test/instrumentation/rest_client_test.rb +0 -106
  145. data/test/instrumentation/sequel_test.rb +0 -111
  146. data/test/instrumentation/shoryuken_test.rb +0 -47
  147. data/test/instrumentation/sidekiq-client_test.rb +0 -169
  148. data/test/instrumentation/sidekiq-worker_test.rb +0 -180
  149. data/test/secrets_test.rb +0 -112
  150. data/test/serverless_test.rb +0 -369
  151. data/test/snapshot/deltable_test.rb +0 -17
  152. data/test/snapshot/docker_container_test.rb +0 -82
  153. data/test/snapshot/fargate_container_test.rb +0 -82
  154. data/test/snapshot/fargate_process_test.rb +0 -35
  155. data/test/snapshot/fargate_task_test.rb +0 -49
  156. data/test/snapshot/google_cloud_run_instance_test.rb +0 -74
  157. data/test/snapshot/google_cloud_run_process_test.rb +0 -33
  158. data/test/snapshot/lambda_function_test.rb +0 -37
  159. data/test/snapshot/ruby_process_test.rb +0 -32
  160. data/test/support/apps/active_record/active_record.rb +0 -24
  161. data/test/support/apps/grpc/boot.rb +0 -23
  162. data/test/support/apps/grpc/grpc_server.rb +0 -84
  163. data/test/support/apps/http_endpoint/boot.rb +0 -28
  164. data/test/support/apps/rails/boot.rb +0 -219
  165. data/test/support/apps/rails/models/block.rb +0 -21
  166. data/test/support/apps/rails/models/block6.rb +0 -21
  167. data/test/support/apps/resque/boot.rb +0 -5
  168. data/test/support/apps/resque/jobs/resque_error_job.rb +0 -22
  169. data/test/support/apps/resque/jobs/resque_fast_job.rb +0 -23
  170. data/test/support/apps/sidekiq/boot.rb +0 -25
  171. data/test/support/apps/sidekiq/jobs/sidekiq_job_1.rb +0 -9
  172. data/test/support/apps/sidekiq/jobs/sidekiq_job_2.rb +0 -10
  173. data/test/support/apps/sidekiq/worker.rb +0 -37
  174. data/test/support/helpers.rb +0 -85
  175. data/test/support/mock_timer.rb +0 -20
  176. data/test/test_helper.rb +0 -69
  177. data/test/trace/custom_test.rb +0 -233
  178. data/test/trace/id_management_test.rb +0 -78
  179. data/test/trace/instrumented_logger_test.rb +0 -39
  180. data/test/trace/processor_test.rb +0 -58
  181. data/test/trace/span_context_test.rb +0 -22
  182. data/test/trace/span_test.rb +0 -179
  183. data/test/trace/tracer_async_test.rb +0 -243
  184. data/test/trace/tracer_provider_test.rb +0 -148
  185. data/test/trace/tracer_test.rb +0 -363
  186. data/test/util_test.rb +0 -10
data/.tekton/README.md DELETED
@@ -1,278 +0,0 @@
1
- # Tekton CI for Instana Ruby Tracer
2
-
3
- ## Basic Tekton setup
4
-
5
- ### Get a cluster
6
-
7
- What you will need:
8
- * Full administrator access
9
- * Enough RAM and CPU on a cluster node to run all the pods of a single Pipelinerun on a single node.
10
- Multiple nodes increase the number of parallel `PipelineRun` instances.
11
- Currently one `PipelineRun` instance is capable of saturating a 8vCPU - 16GB RAM worker node.
12
-
13
- ### Setup Tekton on your cluster
14
-
15
- 1. Install latest stable Tekton Pipeline release
16
- ```bash
17
- kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
18
- ```
19
-
20
- 2. Install Tekton Dashboard Full (the normal is read only, and doesn't allow for example to re-run).
21
-
22
- ````bash
23
- kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/release-full.yaml
24
- ````
25
-
26
- 3. Access the dashboard
27
-
28
- ```bash
29
- kubectl proxy
30
- ```
31
-
32
- Once the proxy is active, navigate your browser to the [dashboard url](
33
- http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/)
34
-
35
- ### Setup the ruby-tracer-ci-pipeline
36
-
37
- ````bash
38
- kubectl apply --filename task.yaml && kubectl apply --filename pipeline.yaml
39
- ````
40
-
41
- ### Run the pipeline manually
42
-
43
- #### From the Dashboard
44
- Navigate your browser to the [pipelineruns section of the dashboard](
45
- http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/#/pipelineruns)
46
-
47
- 1. Click `Create`
48
- 2. Select the `Namespace` (where the `Pipeline` resource is created by default it is `default`)
49
- 3. Select the `Pipeline` created in the `pipeline.yaml` right now it is `ruby-tracer-ci-pipeline`
50
- 4. Fill in `Params`. The `revision` should be `master` for the `master` branch
51
- 4. Select the `ServiceAccount` set to `default`
52
- 5. Optionally, enter a `PipelineRun name` for example `my-master-test-pipeline`,
53
- but if you don't then the Dashboard will generate a unique one for you.
54
- 6. As long as [the known issue with Tekton Dashboard Workspace binding](
55
- https://github.com/tektoncd/dashboard/issues/1283), is not resolved.
56
- You have to go to `YAML Mode` and insert the workspace definition at the end of the file,
57
- with the exact same indentation:
58
-
59
- ````yaml
60
- workspaces:
61
- - name: ruby-tracer-ci-pipeline-pvc-$(params.revision)
62
- volumeClaimTemplate:
63
- spec:
64
- accessModes:
65
- - ReadWriteOnce
66
- resources:
67
- requests:
68
- storage: 200Mi
69
-
70
- ````
71
- 7. Click `Create` at the bottom of the page
72
-
73
-
74
- #### From kubectl CLI
75
- As an alternative to using the Dashboard, you can manually edit `pipelinerun.yaml` and create it with:
76
- ````bash
77
- kubectl apply --filename pipelinerun.yaml
78
- ````
79
-
80
- ### Clanup PipelineRun and associated PV resources
81
-
82
- `PipelineRuns` and workspace `PersistentVolume` resources by default are kept indefinitely,
83
- and repeated runs might exhaust the available resources, therefore they need to be cleaned up either
84
- automatically or manually.
85
-
86
- #### Manully from the Dashboard
87
-
88
- Navigate to `PipelineRuns` and check the checkbox next to the pipelinerun
89
- and then click `Delete` in the upper right corner.
90
-
91
- #### Manually from the CLI
92
-
93
- You can use either `kubectl`
94
- ````bash
95
- kubectl get pipelinerun
96
- kubectl delete pipelinerun <selected-pipelinerun-here>
97
- ````
98
-
99
- or `tkn` cli
100
- ````bash
101
- tkn pipelinerun list
102
- tkn pipelinerun delete <selected-pipelinerun-here>
103
- ````
104
-
105
- #### Automatic cleanup with a cronjob
106
-
107
- Install and configure resources from https://github.com/3scale-ops/tekton-pipelinerun-cleaner
108
-
109
-
110
- ## Integrate with GitHub
111
-
112
- ### GitHub PR Trigger & PR Check API integration
113
-
114
- The GitHub integration requires further Tekton Triggers and Interceptors to be installed
115
- ````bash
116
- kubectl apply --filename \
117
- https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml
118
- kubectl apply --filename \
119
- https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml
120
- ````
121
- #### Create a ServiceAccount
122
-
123
- Our future GitHub PR Event listener needs a service account,
124
- `tekton-triggers-eventlistener-serviceaccount` which authorizes it to
125
- perform operations specified in eventlistener `Role` and `ClusteRole`.
126
- Create the service account with the needed role bindings:
127
-
128
- ````bash
129
- kubectl apply --filename tekton-triggers-eventlistener-serviceaccount.yaml
130
- ````
131
-
132
- #### Create the Secret for the GitHub repository webhook
133
-
134
- In order to authorize the incoming webhooks into our cluster, we need to share
135
- a secret between our webhook listener, and the GitHub repo.
136
- Generate a long, strong and random generated token, put it into `github-interceptor-secret.yaml`.
137
- Create the secret resource:
138
- ````bash
139
- kubectl apply --filename github-interceptor-secret.yaml
140
- ````
141
-
142
- #### Create the Task and token to report PR Check status to GitHub
143
-
144
- The GitHub PR specific Tekton pipeline will want to send data to report the `PR Check Status`.
145
- That [GitHub API](https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status
146
- ) requires authentication, and therefore we need a token.
147
- The user which generates the token has to have `Write` access in the target repo,
148
- as part of the organisation. Check the repo access for this repo under
149
- https://github.com/instana/ruby-sensor/settings/access.
150
-
151
- With the proper user:
152
- 1. Navigate to https://github.com/settings/tokens
153
- 2. Click on `Generate new token` dropdown `Generate new token (classic)`.
154
- 3. Fill in `Note` with for example `Tekton commit status`,
155
- 4. Make sure if you set an expiration, than you remember to renew the token after expiry.
156
- 5. Under `Select scopes` find `repo` and below that only select the checkbox next to `repo:status` - `Access commit status`.
157
- click `Generate token`
158
- 6. Create the kubernetes secret with the token:
159
-
160
- ````bash
161
- kubectl create secret generic githubtoken --from-literal token="MY_TOKEN"
162
- ````
163
-
164
- And we also make an HTTP POST with the status update data to GitHub.
165
- This is done in a `Task` called `github-set-status`, create it as such:
166
- ````bash
167
- kubectl apply -f github-set-status-task.yaml
168
- ````
169
-
170
- #### Create the GitHub PR pipeline
171
-
172
- Create the new pipeline, which executes the previously created `ruby-tracer-ci-pipeline`,
173
- removes the currency report tasks and wraps the unittest jobs with GitHub Check status reporting tasks.
174
- As long as [Pipelines in Pipelines](
175
- https://tekton.dev/docs/pipelines/pipelines-in-pipelines/), remains an
176
- unimplemented `alpha` feature in Tekton,
177
- we will need the [yq](https://github.com/mikefarah/yq) (at least `4.0`)
178
- to pull the tasks from our previous `ruby-tracer-ci-pipeline` into the
179
- new pipeline `github-pr-ruby-tracer-ci-pipeline`.
180
-
181
- ````bash
182
- (cat github-pr-pipeline.yaml.part && yq '{"a": {"b": .spec.tasks}}' pipeline.yaml| tail --lines=+3| head --lines=-16) | kubectl apply -f -
183
- ````
184
-
185
- #### Create the GitHub PR Event Listener, TriggerTemplate and TriggerBinding
186
-
187
- Once the new GitHub specific pipeline is created, we need a listener which starts
188
- a new `PipelineRun` based on GitHub events.
189
- For security reasons the listener will only trigger if the PR owner is a
190
- repo owner. PRs from non-repo owners can be allowed in by owners after an initial review
191
- with a comment on the pull request that contains `/ok-to-test`.
192
- More abou this feature in the [tekton triggers documentsion](
193
- https://github.com/tektoncd/triggers/blob/main/docs/interceptors.md#owners-validation-for-pull-requests).
194
-
195
- ````bash
196
- kubectl apply --filename github-pr-eventlistener.yaml
197
- ````
198
-
199
- After this ensure that there is a pod and a service created:
200
-
201
- ````bash
202
- kubectl get pod | grep -i el-github-pr-ruby-eventlistener
203
- kubectl get svc | grep -i el-github-pr-ruby-eventlistener
204
- ````
205
-
206
- Do not continue if any of these missing.
207
-
208
- #### Create the Ingress for the GitHub Webhook to come through
209
-
210
- You will need an ingress controller for this.
211
- On IKS you might want to read these resources:
212
- * [managed ingress](https://cloud.ibm.com/docs/containers?topic=containers-managed-ingress-about)
213
- * Or unmanaged [ingress controller howto](
214
- https://github.com/IBM-Cloud/iks-ingress-controller/blob/master/docs/installation.md
215
- ).
216
-
217
- 1. Check the available `ingressclass` resources on your cluster
218
-
219
- ````bash
220
- kubectl get ingressclass
221
- ````
222
-
223
- * On `IKS` it will be `public-iks-k8s-nginx`.
224
- * On `EKS` with the `ALB` ingress controller, it might be just `alb`
225
- * On self hosted [nginx controller](https://kubernetes.github.io/ingress-nginx/deploy/)
226
- this might just be `nginx`.
227
-
228
- Edit and save the value of `ingressClassName:` in `github-webhook-ingress.yaml`.
229
-
230
- 2. Find out your Ingress domain or subdomain name.
231
-
232
- * On `IKS`, go to `Clusters` select your cluster and then click `Overview`.
233
- The domain name is listed under `Ingress subdomain`.
234
-
235
- and create the resource:
236
-
237
- ````bash
238
- kubectl apply --filename github-webhook-ingress.yaml
239
- ````
240
-
241
- Make sure that you can use the ingress with the `/hooks` path via `https`:
242
- ````bash
243
- curl https://<INGRESS_DOMAIN_NAME>/hooks
244
- ````
245
-
246
- At this point this should respond this:
247
- ```json
248
- {
249
- "eventListener":"github-pr-eventlistener",
250
- "namespace":"default",
251
- "eventListenerUID":"",
252
- "errorMessage":"Invalid event body format : unexpected end of JSON input"
253
- }
254
- ```
255
-
256
- #### Setup the webhook on GitHub
257
-
258
- In the GitHub repo go to `Settings` -> `Webhooks` and click `Add Webhook`.
259
- The fields we need to set are:
260
- * `Payload URL`: `https://<INGRESS_DOMAIN_NAME>/hooks`
261
- * `Content type`: application/json
262
- * `Secret`: XXXXXXX (the secret token from github-interceptor-secret.yaml)
263
-
264
- Under `SSL verification` select the radio button for `Enable SSL verification`.
265
- Under `Which events would you like to trigger this webhook?` select
266
- the radio button for `Let me select individual events.` and thick the checkbox next to
267
- `Pull requests` and ensure that the rest are unthicked.
268
-
269
- Click `Add webhook`.
270
-
271
- If the webhook has been set up correctly, then GitHub sends a ping message.
272
- Ensure that the ping is received from GitHub, and that it is filtered out so
273
- a simple ping event does not trigger any `PipelineRun` unnecessarily.
274
-
275
- ````bash
276
- eventlistener_pod=$(kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep el-github-pr-ruby)
277
- kubectl logs "${eventlistener_pod}" | grep 'event type ping is not allowed'
278
- ````
@@ -1,8 +0,0 @@
1
- apiVersion: v1
2
- kind: Secret
3
- metadata:
4
- name: github-interceptor-secret
5
- type: Opaque
6
- stringData:
7
- # Always use a long, strong and random generated token
8
- secretToken: "<--- TOKEN GOES HERE --->"
@@ -1,104 +0,0 @@
1
- apiVersion: triggers.tekton.dev/v1beta1
2
- kind: TriggerTemplate
3
- metadata:
4
- name: github-pr-ruby-tracer-pipeline-template
5
- spec:
6
- params:
7
- - description: The git branch name
8
- name: git-branch
9
- - description: The git branch name shortened and converted to RFC 1123 subdomain names
10
- name: git-branch-normalized
11
- - description: The full sha of the git commit
12
- name: git-commit-sha
13
- - description: The short 7 digit sha of the git commit
14
- name: git-commit-short-sha
15
- resourcetemplates:
16
- - apiVersion: tekton.dev/v1
17
- kind: PipelineRun
18
- metadata:
19
- # After variable resolution, this has to be maximum 63 character long,
20
- # lower case, RFC 1123 subdomain name. The regex used for validation is
21
- # '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
22
- name: ruby-tracer-pr-$(tt.params.git-branch-normalized)-$(tt.params.git-commit-short-sha)
23
- spec:
24
- timeouts:
25
- pipeline: "2h"
26
- params:
27
- - name: revision
28
- value: $(tt.params.git-branch)
29
- - name: git-commit-sha
30
- value: $(tt.params.git-commit-sha)
31
- pipelineRef:
32
- name: github-pr-ruby-tracer-ci-pipeline
33
- workspaces:
34
- - name: ruby-tracer-ci-pipeline-pvc
35
- volumeClaimTemplate:
36
- spec:
37
- accessModes:
38
- - ReadWriteOnce
39
- resources:
40
- requests:
41
- storage: 200Mi
42
- ---
43
- apiVersion: triggers.tekton.dev/v1beta1
44
- kind: TriggerBinding
45
- metadata:
46
- name: github-pr-ruby-tracer-binding
47
- spec:
48
- params:
49
- - name: git-branch
50
- value: $(body.pull_request.head.ref)
51
- - name: git-branch-normalized
52
- value: $(extensions.git_branch_normalized)
53
- - name: git-commit-sha
54
- value: $(body.pull_request.head.sha)
55
- - name: git-commit-short-sha
56
- value: $(extensions.truncated_sha)
57
- ---
58
- apiVersion: triggers.tekton.dev/v1beta1
59
- kind: EventListener
60
- metadata:
61
- name: github-pr-ruby-eventlistener
62
- spec:
63
- serviceAccountName: tekton-triggers-eventlistener-serviceaccount
64
- triggers:
65
- - name: github-pr-trigger
66
- interceptors:
67
- - name: receive-github-event
68
- ref:
69
- name: "github"
70
- params:
71
- - name: "secretRef"
72
- value:
73
- secretName: github-interceptor-secret
74
- secretKey: secretToken
75
- - name: "eventTypes"
76
- value: ["pull_request"]
77
- - name: filter-irrelevant-events
78
- ref:
79
- name: "cel"
80
- params:
81
- - name: "filter"
82
- # We should not trigger on 'closed', 'assigned', 'unassigned', 'converted_to_draft'
83
- value: "body.action in ['opened', 'synchronize', 'reopened']"
84
- - name: add-truncated-sha
85
- ref:
86
- name: "cel"
87
- params:
88
- - name: "overlays"
89
- value:
90
- - key: truncated_sha
91
- expression: "body.pull_request.head.sha.truncate(7)"
92
- - name: add-normalized-branch-name
93
- ref:
94
- name: "cel"
95
- params:
96
- - name: "overlays"
97
- value:
98
- - key: git_branch_normalized
99
- # The git branch name shortened and converted to RFC 1123 subdomain names
100
- expression: 'body.pull_request.head.ref.truncate(38).lowerAscii().translate("_", "-")'
101
- bindings:
102
- - ref: github-pr-ruby-tracer-binding
103
- template:
104
- ref: github-pr-ruby-tracer-pipeline-template
@@ -1,38 +0,0 @@
1
- apiVersion: tekton.dev/v1
2
- kind: Pipeline
3
- metadata:
4
- name: github-pr-ruby-tracer-ci-pipeline
5
- spec:
6
- params:
7
- - name: revision
8
- type: string
9
- - name: git-commit-sha
10
- type: string
11
- workspaces:
12
- - name: ruby-tracer-ci-pipeline-pvc
13
- tasks:
14
- - name: github-set-check-status-to-pending
15
- taskRef:
16
- kind: Task
17
- name: github-set-status
18
- params:
19
- - name: SHA
20
- value: $(params.git-commit-sha)
21
- - name: STATE
22
- value: pending
23
- - name: REPO
24
- value: instana/ruby-sensor
25
- - name: github-set-check-status-to-success-or-failure
26
- runAfter:
27
- - github-set-check-status-to-pending
28
- - unittest-rails-postgres
29
- taskRef:
30
- kind: Task
31
- name: github-set-status
32
- params:
33
- - name: SHA
34
- value: $(params.git-commit-sha)
35
- - name: STATE
36
- value: success
37
- - name: REPO
38
- value: instana/ruby-sensor
@@ -1,43 +0,0 @@
1
- ---
2
- apiVersion: tekton.dev/v1
3
- kind: Task
4
- metadata:
5
- name: github-set-status
6
- spec:
7
- params:
8
- - name: SHA
9
- - name: STATE
10
- - name: REPO
11
- volumes:
12
- - name: githubtoken
13
- secret:
14
- secretName: githubtoken
15
- steps:
16
- - name: set-status
17
- # curlimages/curl:8.6.0
18
- image: curlimages/curl@sha256:f2237028bed58de91f62aea74260bb2a299cf12fbcabc23cfaf125fef276c884
19
- env:
20
- - name: SHA
21
- value: $(params.SHA)
22
- - name: STATE
23
- value: $(params.STATE)
24
- - name: REPO
25
- value: $(params.REPO)
26
- volumeMounts:
27
- - name: githubtoken
28
- mountPath: /etc/github-set-status
29
- script: |
30
- #!/bin/sh
31
- curl -L \
32
- -X POST \
33
- -H "Accept: application/vnd.github+json" \
34
- -H "Authorization: Bearer $(cat /etc/github-set-status/token)" \
35
- -H "Content-Type: application/json" \
36
- -H "X-GitHub-Api-Version: 2022-11-28" \
37
- "https://api.github.com/repos/${REPO}/statuses/${SHA}" \
38
- -d '{
39
- "state":"'${STATE}'",
40
- "target_url":"http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/#/namespaces/default/pipelineruns/",
41
- "description":"Tekton build is in state: '${STATE}'",
42
- "context":"Tekton"
43
- }'
@@ -1,20 +0,0 @@
1
- apiVersion: networking.k8s.io/v1
2
- kind: Ingress
3
- metadata:
4
- name: github-pr-ruby-webhook-ingress
5
- spec:
6
- ingressClassName: public-iks-k8s-nginx
7
- tls:
8
- - hosts:
9
- - <ENTER_YOUR_DOMAIN_NAME_HERE>
10
- rules:
11
- - host: <ENTER_YOUR_DOMAIN_NAME_HERE>
12
- http:
13
- paths:
14
- - path: /github-pr-ruby-hooks
15
- pathType: Exact
16
- backend:
17
- service:
18
- name: el-github-pr-ruby-eventlistener
19
- port:
20
- number: 8080