Skip to content

Commit

Permalink
examples+recipes(tekton): update tekton (#3054)
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanrahic committed Aug 11, 2023
1 parent 0c492fe commit 43fff43
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 12 deletions.
Expand Up @@ -250,6 +250,10 @@ spec:
emptyDir: {}
```

```bash
kubectl apply -f ./install-and-run-tracetest.yaml
```

Make sure to use the Tracetest service as the endpoint for your `tracetest configure` command. This may vary depending on your installation.

```bash
Expand All @@ -260,7 +264,7 @@ http://tracetest.tracetest.svc.cluster.local:11633/

Finally, to run the test, create a `TaskRun`.

Create a file called `install-and-run-tracetest-run-yaml`.
Create a file called `install-and-run-tracetest-run.yaml`.

```yaml
apiVersion: tekton.dev/v1beta1
Expand All @@ -273,7 +277,7 @@ spec:
```

```bash
kubectl apply -f ./install-and-run-tracetest-run-yaml
kubectl apply -f ./install-and-run-tracetest-run.yaml
```

Here's how to check the logs:
Expand All @@ -290,9 +294,16 @@ tkn task start install-and-run-tracetest

```text title="Expected output"
TaskRun started: install-and-run-tracetest-run-xmhfg
```

In order to track the TaskRun progress run:
tkn taskrun logs install-and-run-tracetest-run-xmhfg -f -n default

```bash
tkn taskrun logs install-and-run-tracetest-run-gccjk -f -n default

[install-and-run-tracetest] ✔ Pokeshop - List (http://tracetest.tracetest.svc.cluster.local:11633/test/RUkKQ_aVR/run/3/test) - trace id: 0549641531d3221ded696f2fd3b20ce6
[install-and-run-tracetest] ✔ Database queries less than 500 ms
[install-and-run-tracetest]
```

To preview which tasks failed or succeeded, use this command:
Expand Down Expand Up @@ -350,11 +361,11 @@ kubectl apply -f install-and-run-tracetest-trigger-template.yaml

### Create an EventListener

```yaml title="install-and-run-tracetest-listener.yaml"
```yaml title="install-and-run-tracetest-event-listener.yaml"
apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
name: install-and-run-tracetest-listener
name: install-and-run-tracetest-event-listener
spec:
serviceAccountName: tekton-robot
triggers:
Expand Down Expand Up @@ -401,13 +412,13 @@ roleRef:

```bash
kubectl apply -f tekton-robot-rbac.yaml
kubectl apply -f install-and-run-tracetest-listener.yaml
kubectl apply -f install-and-run-tracetest-event-listener.yaml
```

Enable port forwarding.

```bash
kubectl port-forward service/el-hello-listener 8080
kubectl port-forward service/el-install-and-run-tracetest-event-listener 8080
```

Hitting the port forwarded endpoint will trigger the task.
Expand All @@ -419,7 +430,7 @@ curl -v \
http://localhost:8080
```

Checking the taskruns will confirm this.
Checking the `taskruns` will confirm this.

```bash
tkn taskrun list
Expand Down
@@ -1,7 +1,7 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
name: install-and-run-tracetest-listener
name: install-and-run-tracetest-event-listener
spec:
serviceAccountName: tekton-robot
triggers:
Expand Down
5 changes: 3 additions & 2 deletions examples/quick-start-tekton/install-and-run-tracetest.yaml
Expand Up @@ -32,11 +32,12 @@ spec:
- name: custom
mountPath: /workspace
- name: install-and-run-tracetest
image: kubeshop/tracetest:v0.11.9 # The official Tracetest image comes with the Tracetest CLI installed
image: kubeshop/tracetest:v0.13.3
# The official Tracetest image comes with the Tracetest CLI installed
script: |
# Configure and Run Tracetest CLI
tracetest configure -g --endpoint http://tracetest.tracetest.svc.cluster.local:11633/
tracetest run test -f /workspace/test-api.yaml
tracetest run test --file /workspace/test-api.yaml --required-gates test-specs --output pretty
volumeMounts:
- name: custom
mountPath: /workspace
Expand Down
2 changes: 2 additions & 0 deletions examples/quick-start-tekton/tekton-dashboard-init.bash
@@ -0,0 +1,2 @@
kubectl apply --filename \
https://storage.googleapis.com/tekton-releases/dashboard/latest/release.yaml
Empty file modified examples/quick-start-tekton/tekton-pipelines-init.bash 100644 → 100755
Empty file.
Empty file modified examples/quick-start-tekton/tekton-triggers-init.bash 100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion examples/quick-start-tekton/tests/test-api.yaml
Expand Up @@ -15,4 +15,4 @@ spec:
- name: Database queries less than 500 ms
selector: span[tracetest.span.type="database"]
assertions:
- attr:tracetest.span.duration < 10ms
- attr:tracetest.span.duration < 500ms
2 changes: 2 additions & 0 deletions go.work.sum
@@ -1,3 +1,4 @@
atomicgo.dev/assert v0.0.2/go.mod h1:ut4NcI3QDdJtlmAxQULOmA13Gz6e2DWbSAS8RUOmNYQ=
cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A=
cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM=
cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I=
Expand Down Expand Up @@ -142,6 +143,7 @@ github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XP
github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/containerd/containerd v1.6.18/go.mod h1:1RdCUu95+gc2v9t3IL+zIlpClSmew7/0YS8O5eQZrOw=
github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8=
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
Expand Down

0 comments on commit 43fff43

Please sign in to comment.