zed/script/deploy-migration

32 lines
825 B
Plaintext
Raw Normal View History

#!/bin/bash
set -eu
2022-10-21 23:15:34 +03:00
source script/lib/deploy-helpers.sh
2022-10-21 23:15:34 +03:00
if [[ $# < 2 ]]; then
echo "Usage: $0 <production|staging|preview> <tag-name> (nightly is not yet supported)"
exit 1
fi
2022-10-22 01:50:14 +03:00
environment=$1
version=$2
if [[ ${environment} == "nightly" ]]; then
echo "nightly is not yet supported"
exit 1
fi
2022-10-22 01:50:14 +03:00
export_vars_for_environment ${environment}
image_id=$(image_id_for_version ${version})
export ZED_KUBE_NAMESPACE=${environment}
export ZED_IMAGE_ID=${image_id}
export ZED_MIGRATE_JOB_NAME=zed-migrate-${version}
2022-10-22 01:50:14 +03:00
target_zed_kube_cluster
2022-04-21 20:01:02 +03:00
envsubst < crates/collab/k8s/migrate.template.yml | kubectl apply -f -
2022-10-22 01:50:14 +03:00
pod=$(kubectl --namespace=${environment} get pods --selector=job-name=${ZED_MIGRATE_JOB_NAME} --output=jsonpath='{.items[0].metadata.name}')
echo "Job pod:" $pod
kubectl --namespace=${environment} logs -f ${pod}