-
Notifications
You must be signed in to change notification settings - Fork 0
/
showJenkins.sh
executable file
·39 lines (35 loc) · 1.65 KB
/
showJenkins.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
33
34
35
36
37
38
39
#!/bin/bash
DEPLOYMENT=$(cat creds.json | jq -r '.deployment')
JENKINS_USER=$(cat creds.json | jq -r '.jenkinsUser')
JENKINS_PASSWORD=$(cat creds.json | jq -r '.jenkinsPassword')
JENKINS_PORT=$(kubectl get service jenkins -n cicd -o=json | jq -r '.spec.ports[] | select(.name=="http") | .port' )
JENKINS_URL=$(kubectl get service jenkins -n cicd -o=json | jq -r '.status.loadBalancer.ingress[].hostname | select (.!=null)')
#if [ -n "JENKINS_URL" ]
#then
# JENKINS_URL="http://$(kubectl get service jenkins -n cicd -o=json | jq -r '.status.loadBalancer.ingress[].ip')"
#fi
if [ $DEPLOYMENT == "aks" ]
then
RESOURCE_PREFIX=$(cat creds.json | jq -r '.resourcePrefix')
AZURE_LOCATION=$(cat creds.json | jq -r '.azureLocation')
JENKINS_URL="jenkins-$RESOURCE_PREFIX-dt-kube-demo.$AZURE_LOCATION.cloudapp.azure.com"
fi
if [ $DEPLOYMENT == "gke" ]
then
JENKINS_URL=$(kubectl get service jenkins -n cicd -o=json | jq -r '.status.loadBalancer.ingress[].ip | select (.!=null)')
fi
echo "--------------------------------------------------------------------------"
echo "kubectl -n cicd get pods"
echo "--------------------------------------------------------------------------"
kubectl -n cicd get pods
echo ""
echo "--------------------------------------------------------------------------"
echo "Jenkins is running @"
echo "http://$JENKINS_URL:$JENKINS_PORT"
echo "Admin user : $JENKINS_USER"
echo "Admin password : $JENKINS_PASSWORD"
echo ""
echo "NOTE: Credentials are from values in creds.json file "
echo "Password may not be accurate if you adjusted it in Jenkins UI"
echo "--------------------------------------------------------------------------"
echo ""