forked from IBM/CodeEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·36 lines (26 loc) · 849 Bytes
/
run
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
#!/bin/bash
function clean() {
set +ex
echo Cleaning...
(
ibmcloud ce app delete -n auth-proxy -f
ibmcloud ce app delete -n auth-app -f
rm -f out
) > /dev/null 2>&1
}
clean
[[ "$1" == "clean" ]] && exit 0
set -ex
export REGISTRY=${REGISTRY:-icr.io/codeengine}
# Create our business logic app - don't expose it on the internet
ibmcloud ce app create -n auth-app --image $REGISTRY/auth-app --cluster-local
# Now create our proxy/authorization app, this one is exposed on the internet
ibmcloud ce app create -n auth-proxy --image $REGISTRY/auth-proxy
# Get its URL
URL=$(ibmcloud ce app get -n auth-proxy -o url)
# Now call the proxy app twice, first with proper credentials...
curl -fqu user:please $URL
# Now call again w/o credential, it should fail
curl -fq $URL && echo "It was supposed to fail" && exit 1
# Clean up
clean