-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo
executable file
·53 lines (41 loc) · 1.34 KB
/
demo
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
48
49
50
51
52
53
#!/bin/bash
source .demoscript
set -e
[[ -z "${USESAVED}" ]] && (
echo "Cleaning..."
set +e
kubectl delete ksvc/hello ksvc/hub cm/source taskrun/build-image
kubectl delete buildtemplate/kaniko
) &> /dev/null || true
[[ "${1}" != "--clean" ]] || exit 0
export PATH=.:$PATH
export RETRYONFAIL=1
if [[ -z "${USESAVED}" ]]; then
if ! kubectl get ns tekton-pipelines &> /dev/null ; then
comment "Installing Tekton"
doit kubectl apply -f \
https://storage.googleapis.com/tekton-releases/latest/release.yaml
fi
fi
comment "Create the Docker Registry Knative Service"
doit kn service create hub --image docker.io/registry --port 5000 \
--min-scale=1 --max-scale=1
HUB_URL=$(tail -1 out)
export HUB_URL=${HUB_URL:7}
comment "Create a configMap to hold the source code of the 'hello' app"
doit ls -l src
doit kubectl create cm source --from-file=src
comment "Create the build 'task' and 'taskrun' - basically, do the build"
scroll task.yaml
doit kapply task.yaml
comment "Wait for it to finish..."
skip=1 doit --untilgrep=True kubectl get taskrun/build-image
# pod=$(kubectl get pods | grep build-image | sed "s/ .*//")
# doit kubectl log ${pod}
comment "Create the 'hello' Knative Service using the image"
doit kn service create hello --image $HUB_URL:443/hello
URL=$(tail -1 out)
comment "Curl it"
doit curl -s $URL
comment "Clean up"
doit $0 --clean