File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 21
21
kubectl config set-context --current --namespace=$KUBERNETES_NAMESPACE
22
22
echo " Context set to namespace: \" $KUBERNETES_NAMESPACE \" "
23
23
24
+ set +e
25
+ alembic_exitcode=0
26
+ ALEMBIC_CURRENT_REVISION=$( kubectl exec -i deployment/${KUBERNETES_DEPLOYMENT_NAME} -c $KUBERNETES_DEPLOYMENT_NAME -- alembic current 2> /dev/null)
27
+ alembic_exitcode=$?
28
+ set -e
29
+
30
+ echo " ::notice::running test command: kubectl exec -i deployment/${KUBERNETES_DEPLOYMENT_NAME} -c $KUBERNETES_DEPLOYMENT_NAME -- '$TEST_CMD '"
31
+
24
32
KUBERNETES_POD_EXISTING_IMAGE=$( kubectl get pod --output json \
25
33
--selector app=${KUBERNETES_DEPLOYMENT_NAME} \
26
34
| jq -r ' .items[0] | .spec.containers[0].image' )
@@ -40,4 +48,10 @@ set -e
40
48
kubectl set image deployment/${KUBERNETES_DEPLOYMENT_NAME} ${KUBERNETES_DEPLOYMENT_NAME} =${KUBERNETES_POD_EXISTING_IMAGE}
41
49
echo " ::notice::using ${KUBERNETES_POD_EXISTING_IMAGE} "
42
50
51
+ if [ alembic_exitcode -eq 0 ]; then
52
+ ALEMBIC_HEAD=${ALEMBIC_CURRENT_REVISION: 0: 12}
53
+ echo " ::notice::downgrading to alembic revision: $ALEMBIC_HEAD "
54
+ kubectl exec -i deployment/${KUBERNETES_DEPLOYMENT_NAME} -c $KUBERNETES_DEPLOYMENT_NAME -- alembic downgrade $ALEMBIC_HEAD
55
+ fi
56
+
43
57
exit $exitcode
You can’t perform that action at this time.
0 commit comments