-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
32 lines (27 loc) · 874 Bytes
/
deploy.sh
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
#!/bin/sh
export KUBECTL_PATH=$HOME/.kube
mkdir -p $KUBECTL_PATH
# Extract kubectl config from KUBECTL_CONFIG and create configure
if [ ! -z "$KUBECTL_CONFIG" ]; then
echo $KUBECTL_CONFIG | base64 -d | gzip -d > $KUBECTL_PATH/config
fi
# Extract cluster context and set to current-context
if [ ! -z "$CLUSTER_CONTEXT" ]; then
kubectl config use-context ${CLUSTER_CONTEXT}
echo "Helm is using ${CLUSTER_CONTEXT} cluster context"
fi
# Extract the bitbucket project url
if [[ ! -z "$BITBUCKET_PROJECT_CLONE_URL" ]]; then
echo "Bitbucket project is downloading..."
git clone ${BITBUCKET_PROJECT_CLONE_URL}
echo "Downloaded successful."
else
echo "Bitbucket project url not provided"
fi
# Run helm command
if [[ ! -z "$HELM_COMMAND" ]]; then
echo "Running ${HELM_COMMAND}"
eval "${HELM_COMMAND}"
else
echo "Helm command not found. Please provide a helm command"
fi