-
Notifications
You must be signed in to change notification settings - Fork 83
/
testrepo-integration.yaml
47 lines (46 loc) · 1.57 KB
/
testrepo-integration.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: testrepo-integration-test
spec:
params:
- name: SNAPSHOT
type: string
description: |
For simplicity, we expect a single component inside our snapshot
{
"components": [
{
"containerImage": "quay.io/example/repo:latest"
}
]
}
tasks:
- name: test-hello-world
params:
- name: SNAPSHOT
value: "$(params.SNAPSHOT)"
taskSpec:
params:
- name: SNAPSHOT
type: string
steps:
- name: test-output
image: docker.io/bitnami/kubectl:latest
env:
- name: SNAPSHOT
value: "$(params.SNAPSHOT)"
- name: NAMESPACE
value: "$(context.pipelineRun.namespace)"
script: |
#!/usr/bin/bash
set -euxo pipefail
IMAGE=$(echo "$SNAPSHOT" | jq -r '.components[0].containerImage')
echo "Extracted image: $IMAGE"
kubectl delete job --ignore-not-found test-hello -n $NAMESPACE
kubectl delete pods --ignore-not-found -l job-name=test-hello -n $NAMESPACE
kubectl create job test-hello -n $NAMESPACE --image=$IMAGE
kubectl wait --for=condition=complete job/test-hello --timeout=120s
LOGS=$(kubectl logs -l job-name=test-hello -n $NAMESPACE)
kubectl delete job --ignore-not-found test-hello -n $NAMESPACE
echo $LOGS | grep "hello world"