2022-10-22 00:25:12 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
source script/lib/deploy-helpers.sh
|
|
|
|
|
2024-02-01 21:54:49 +03:00
|
|
|
if [[ $# != 1 ]]; then
|
2024-01-31 06:11:06 +03:00
|
|
|
echo "Usage: $0 <production|staging>"
|
2022-10-22 00:25:12 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
2024-02-01 21:54:49 +03:00
|
|
|
|
2022-10-22 01:50:14 +03:00
|
|
|
environment=$1
|
2024-02-01 21:54:49 +03:00
|
|
|
url="$(url_for_environment $environment)"
|
|
|
|
tag="$(tag_for_environment $environment)"
|
2022-10-22 00:25:12 +03:00
|
|
|
|
|
|
|
target_zed_kube_cluster
|
|
|
|
|
2022-10-22 01:50:14 +03:00
|
|
|
deployed_image_id=$(
|
|
|
|
kubectl \
|
|
|
|
--namespace=${environment} \
|
|
|
|
get deployment collab \
|
|
|
|
-o 'jsonpath={.spec.template.spec.containers[0].image}' \
|
|
|
|
| cut -d: -f2
|
|
|
|
)
|
2022-10-22 00:25:12 +03:00
|
|
|
|
2024-02-01 21:54:49 +03:00
|
|
|
echo "Deployed image version: $deployed_image_id"
|
2022-10-22 01:50:14 +03:00
|
|
|
|
2024-02-01 21:54:49 +03:00
|
|
|
git fetch >/dev/null
|
|
|
|
if [[ "$(git rev-parse tags/$tag)" != $deployed_image_id ]]; then
|
|
|
|
echo "NOTE: tags/$tag $(git rev-parse tags/$tag) is not yet deployed"
|
|
|
|
fi;
|