Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Fixed issue of deployment not updating due to same image tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzlamateen committed Apr 13, 2023
1 parent 7699542 commit 64067a9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
19 changes: 12 additions & 7 deletions assets/scripts/check-engine-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CONFIGS_FOLDER=$3
CLUSTER_ID=$4
CLUSTER_TYPE=$5
OPS_FOLDER=$6
TAG=$7

#=======================
# Verify Ethereal Engine
Expand Down Expand Up @@ -53,7 +54,7 @@ export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0

if [[ $CLUSTER_TYPE == 'microk8s' ]]; then
bash ./scripts/build_microk8s.sh
bash ./scripts/build_microk8s.sh "$TAG" true
elif [[ $CLUSTER_TYPE == 'microk8sWindows' ]]; then
export REGISTRY_HOST=microk8s.registry
export MYSQL_HOST=kubernetes.docker.internal
Expand All @@ -63,7 +64,7 @@ elif [[ $CLUSTER_TYPE == 'microk8sWindows' ]]; then
while [ "$retry" -le 6 ]; do
echo "Trying: $retry"

bash ./scripts/build_microk8s.sh
bash ./scripts/build_microk8s.sh "$TAG" true

exit_status=$?
if [ $exit_status -eq 0 ]; then
Expand Down Expand Up @@ -98,7 +99,7 @@ echo "Force DB refresh is $FORCE_DB_REFRESH"
if [[ $ENGINE_INSTALLED == true ]] && [[ $DB_EXISTS == false || $FORCE_DB_REFRESH == 'true' ]]; then
echo "Updating Ethereal Engine deployment to configure database"

helm upgrade --reuse-values -f "$OPS_FOLDER/configs/db-refresh-true.values.yaml" local etherealengine/etherealengine
helm upgrade --reuse-values -f "$OPS_FOLDER/configs/db-refresh-true.values.yaml" --set taskserver.image.tag="$TAG",api.image.tag="$TAG",instanceserver.image.tag="$TAG",testbot.image.tag="$TAG",client.image.tag="$TAG",testbot.image.tag="$TAG" local etherealengine/etherealengine

# Added this wait to ensure previous pod is deleted.
sleep 60
Expand All @@ -121,11 +122,15 @@ if [[ $ENGINE_INSTALLED == true ]] && [[ $DB_EXISTS == false || $FORCE_DB_REFRES
echo "Waiting for API pod to be ready. API ready count: $apiCount"
done

helm upgrade --reuse-values -f "$OPS_FOLDER/configs/db-refresh-false.values.yaml" local etherealengine/etherealengine
helm upgrade --reuse-values -f "$OPS_FOLDER/configs/db-refresh-false.values.yaml" --set taskserver.image.tag="$TAG",api.image.tag="$TAG",instanceserver.image.tag="$TAG",testbot.image.tag="$TAG",client.image.tag="$TAG",testbot.image.tag="$TAG" local etherealengine/etherealengine
elif [[ $ENGINE_INSTALLED == true ]] && [[ $DB_EXISTS == true ]]; then
echo "Updating Ethereal Engine deployment without populating database"

helm upgrade --reuse-values --set taskserver.image.tag="$TAG",api.image.tag="$TAG",instanceserver.image.tag="$TAG",testbot.image.tag="$TAG",client.image.tag="$TAG",testbot.image.tag="$TAG" local etherealengine/etherealengine
elif [[ $ENGINE_INSTALLED == false ]] && [[ $DB_EXISTS == false || $FORCE_DB_REFRESH == 'true' ]]; then
echo "Installing Ethereal Engine deployment with populating database"

helm install -f "$CONFIGS_FOLDER/$CLUSTER_ID-engine.values.yaml" -f "$OPS_FOLDER/configs/db-refresh-true.values.yaml" local etherealengine/etherealengine
helm install -f "$CONFIGS_FOLDER/$CLUSTER_ID-engine.values.yaml" -f "$OPS_FOLDER/configs/db-refresh-true.values.yaml" --set taskserver.image.tag="$TAG",api.image.tag="$TAG",instanceserver.image.tag="$TAG",testbot.image.tag="$TAG",client.image.tag="$TAG",testbot.image.tag="$TAG" local etherealengine/etherealengine

apiCount=$(kubectl get deploy local-etherealengine-api -o jsonpath='{.status.availableReplicas}')
if [ -z "$apiCount" ]; then
Expand All @@ -144,11 +149,11 @@ elif [[ $ENGINE_INSTALLED == false ]] && [[ $DB_EXISTS == false || $FORCE_DB_REF
echo "Waiting for API pod to be ready. API ready count: $apiCount"
done

helm upgrade --reuse-values -f "$OPS_FOLDER/configs/db-refresh-false.values.yaml" local etherealengine/etherealengine
helm upgrade --reuse-values -f "$OPS_FOLDER/configs/db-refresh-false.values.yaml" --set taskserver.image.tag="$TAG",api.image.tag="$TAG",instanceserver.image.tag="$TAG",testbot.image.tag="$TAG",client.image.tag="$TAG",testbot.image.tag="$TAG" local etherealengine/etherealengine
elif [[ $ENGINE_INSTALLED == false ]] && [[ $DB_EXISTS == true ]]; then
echo "Installing Ethereal Engine deployment without populating database"

helm install -f "$CONFIGS_FOLDER/$CLUSTER_ID-engine.values.yaml" local etherealengine/etherealengine
helm install -f "$CONFIGS_FOLDER/$CLUSTER_ID-engine.values.yaml" --set taskserver.image.tag="$TAG",api.image.tag="$TAG",instanceserver.image.tag="$TAG",testbot.image.tag="$TAG",client.image.tag="$TAG",testbot.image.tag="$TAG" local etherealengine/etherealengine
fi

export RELEASE_NAME=local
Expand Down
14 changes: 13 additions & 1 deletion assets/scripts/configure-microk8s-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,23 @@ bash "$SCRIPTS_FOLDER/check-ripple.sh" "$ENABLE_RIPPLE_STACK" "$OPS_FOLDER" "$CO

checkExitCode

#=====================
# Get Docker Image Tag
#=====================

echo "$PASSWORD" | sudo -S apt install jq -y

TAG="$(jq -r .version "$ENGINE_FOLDER/packages/server-core/package.json")_$(cd "$ENGINE_FOLDER" && git rev-parse HEAD)__$(date +"%d-%m-%yT%H-%M-%S")"

echo "Tag is $TAG"

checkExitCode

#=======================
# Verify Ethereal Engine
#=======================

bash "$SCRIPTS_FOLDER/check-engine-deployment.sh" "$ENGINE_FOLDER" "$FORCE_DB_REFRESH" "$CONFIGS_FOLDER" "$CLUSTER_ID" "microk8s" "$OPS_FOLDER"
bash "$SCRIPTS_FOLDER/check-engine-deployment.sh" "$ENGINE_FOLDER" "$FORCE_DB_REFRESH" "$CONFIGS_FOLDER" "$CLUSTER_ID" "microk8s" "$OPS_FOLDER" "$TAG"

checkExitCode

Expand Down
18 changes: 15 additions & 3 deletions assets/scripts/configure-microk8s-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ if ($LastExitCode -eq 1) {

if ($hostfileProcess.ExitCode -eq 0) {
Write-Host "Hostfile already up to date";
} elseif ($hostfileProcess.ExitCode -eq 1) {
}
elseif ($hostfileProcess.ExitCode -eq 1) {
Write-Host "Hostfile updated";
} else {
}
else {
Write-Host "Hostfile update exited with:";
Write-Host $hostfileProcess.ExitCode;
Write-host "Failed in check-hostfile"
Expand Down Expand Up @@ -347,11 +349,21 @@ wsl bash "$SCRIPTS_FOLDER/check-ripple.sh" "$ENABLE_RIPPLE_STACK" "$OPS_FOLDER"

checkExitCode;

#=====================
# Get Docker Image Tag
#=====================

wsl bash -c "echo '$PASSWORD' | sudo -S apt install jq -y";

$TAG = wsl bash -c "echo `$(jq -r .version `"$ENGINE_FOLDER/packages/server-core/package.json`")_`$(cd `"$ENGINE_FOLDER`" && git rev-parse HEAD)__`$(date +`"%d-%m-%yT%H-%M-%S`")";

Write-Host "Tag is $TAG";

#=======================
# Verify Ethereal Engine
#=======================

wsl bash "$SCRIPTS_FOLDER/check-engine-deployment.sh" "$ENGINE_FOLDER" "$FORCE_DB_REFRESH" "$CONFIGS_FOLDER" "$CLUSTER_ID" "microk8sWindows" "$OPS_FOLDER";
wsl bash "$SCRIPTS_FOLDER/check-engine-deployment.sh" "$ENGINE_FOLDER" "$FORCE_DB_REFRESH" "$CONFIGS_FOLDER" "$CLUSTER_ID" "microk8sWindows" "$OPS_FOLDER" "$TAG";

checkExitCode;

Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/configure-minikube-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ checkExitCode
# Verify Ethereal Engine
#=======================

bash "$SCRIPTS_FOLDER/check-engine-deployment.sh" "$ENGINE_FOLDER" "$FORCE_DB_REFRESH" "$CONFIGS_FOLDER" "$CLUSTER_ID" "minikube" "$OPS_FOLDER"
bash "$SCRIPTS_FOLDER/check-engine-deployment.sh" "$ENGINE_FOLDER" "$FORCE_DB_REFRESH" "$CONFIGS_FOLDER" "$CLUSTER_ID" "minikube" "$OPS_FOLDER" "latest"

checkExitCode

Expand Down

0 comments on commit 64067a9

Please sign in to comment.