Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 00bf247

Browse files
committed
Several improvement and fixes: image_tag check for linux- prefix, login procedure for custom registry, --docker-username normalization and --dns aks option documented at usage()
1 parent 7684278 commit 00bf247

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

k8s/helm/deploy-all.sh

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Parameters:
1414
The resource group for the AKS cluster. Required when the registry (using the -r parameter) is set to "aks".
1515
-b | --build-solution
1616
Force a solution build before deployment (default: false).
17-
-d | --dns <dns or ip address>
18-
Specifies the external DNS/ IP address of the Kubernetes cluster.
17+
-d | --dns <dns or ip address> | --dns aks
18+
Specifies the external DNS/ IP address of the Kubernetes cluster.
19+
If 'aks' is set as value, the DNS value is retrieved from the AKS. --aks-name and --aks-rg are needed.
1920
When --use-local-k8s is specified the external DNS is automatically set to localhost.
2021
-h | --help
2122
Displays this help text and exits the script.
@@ -37,7 +38,7 @@ Parameters:
3738
This is useful for production environments where infrastructure is hosted outside the Kubernetes cluster.
3839
-t | --tag <docker image tag>
3940
The tag used for the newly created docker images. Default: newly created, date-based timestamp, with 1-minute resolution.
40-
-u | --docker-username <docker username>
41+
-u | --docker-user <docker username>
4142
The Docker username used to logon to the custom registry, supplied using the -r parameter.
4243
--use-local-k8s
4344
Deploy to a locally installed Kubernetes (default: false).
@@ -124,13 +125,29 @@ if [[ $build_images ]]; then
124125
docker rmi $(docker images -qf "dangling=true")
125126
fi
126127

128+
use_custom_registry=''
129+
130+
if [[ -n $container_registry ]]; then
131+
echo "################ Log into custom registry $container_registry ##################"
132+
use_custom_registry='yes'
133+
if [[ -z $docker_username ]] || [[ -z $docker_password ]]; then
134+
echo "Error: Must use -u (--docker-username) AND -p (--docker-password) if specifying custom registry"
135+
exit 1
136+
fi
137+
docker login -u $docker_username -p $docker_password $container_registry
138+
fi
139+
140+
127141
if [[ $push_images ]]; then
128142
echo "#################### Pushing images to the container registry ####################"
129143
services=(basket.api catalog.api identity.api ordering.api marketing.api payment.api locations.api webmvc webspa webstatus)
130144

131145
for service in "${services[@]}"
132146
do
133147
echo "Pushing image for service $service..."
148+
if [[ -z "$(docker image ls -q --filter=reference=eshop/$service:$image_tag)" ]]; then
149+
image_tag=linux-$image_tag
150+
fi
134151
docker tag "eshop/$service:$image_tag" "$container_registry/$service:$image_tag"
135152
docker push "$container_registry/$service:$image_tag"
136153
done
@@ -173,16 +190,6 @@ if [[ $clean ]]; then
173190
echo "Previous releases deleted"
174191
fi
175192

176-
use_custom_registry=''
177-
178-
if [[ -n $container_registry ]]; then
179-
use_custom_registry='yes'
180-
if [[ -z $docker_user ]] || [[ -z $docker_password ]]; then
181-
echo "Error: Must use -u (--docker-username) AND -p (--docker-password) if specifying custom registry"
182-
exit 1
183-
fi
184-
fi
185-
186193
echo "#################### Begin $app_name installation using Helm ####################"
187194
infras=(sql-data nosql-data rabbitmq keystore-data basket-data)
188195
charts=(eshop-common apigwmm apigwms apigwwm apigwws basket-api catalog-api identity-api locations-api marketing-api mobileshoppingagg ordering-api ordering-backgroundtasks ordering-signalrhub payment-api webmvc webshoppingagg webspa webstatus webhooks-api webhooks-web)

0 commit comments

Comments
 (0)