forked from duglin/knregistry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo
executable file
·68 lines (50 loc) · 1.8 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e
source .demoscript
RETRYONFAIL=1
D="kntest.us-south.containers.appdomain.cloud"
if [[ -z "${USESAVED}" || -n ${DOMAIN} ]]; then
D=$(bx ks cluster-get $(kubectl config current-context) | grep "Ingress Subdomain" | sed "s/^.*: *\([^ ]*\) *$/\1/" )
fi
export DOMAIN=${DOMAIN:-$D}
export PATH=.:$PATH
comment "Talking to cluster at: ${DOMAIN}"
if [[ -z "${USESAVED}" ]]; then
(
set +e
kubectl delete cm/source
kubectl delete -f hub.yaml -f task.yaml -f service.yaml
kubectl delete buildtemplate/kaniko
) &> /dev/null || true
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 a configMap to hold the source code of the 'hello' app"
doit kubectl create cm source --from-file=src
comment "Create the Docker Registry Knative Service"
scroll hub.yaml
doit kubectl apply -f hub.yaml
comment "Wait for the hub to be ready..."
wait curl -fq http://hub-default.$DOMAIN
comment "Create the build 'task' and 'taskrun' - basically, do the build"
scroll task.yaml
doit kapply task.yaml
comment "Wait for the build to finish..."
doit --untilgrep=True kubectl get taskrun/build-image
comment "Delete the build artifacts"
doit kubectl delete cm/source
doit kubectl delete -f task.yaml
# doit --ignorerc "kubectl delete buildtemplate/kaniko &> /dev/null"
comment "Create the 'hello' Knative Service using the image"
scroll service.yaml
doit kapply service.yaml
comment "Wait for the Service to be ready..."
doit --norepaint --pausetime=2 --untilgrep=True kubectl get ksvc/hello
comment "Curl/test it"
doit --norepaint --untilgrep=Hello curl -s http://hello-default.$DOMAIN
comment "Clean up"
doit kubectl delete -f service.yaml -f hub.yaml
rm cmds