Skip to content

Commit 3d90a0b

Browse files
committed
fix: query logs for failed pod explicitly
1 parent 40c44b1 commit 3d90a0b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

k8s/test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ __safe_migration_rollout() {
5555

5656
if [ "$exitcode" != "0" ]; then
5757
echo "::error::Alembic migration failure. See logs for details"
58-
kubectl logs deployment/$deploy -c $deploy-migrate
58+
failed_pod_name=$(kubectl get pod \
59+
--selector app=$deploy \
60+
--field-selector status.phase!=Running \
61+
--output jsonpath='{.items[?(@.metadata.labels.app=="'$deploy'")].metadata.name}')
62+
kubectl logs $failed_pod_name -c $deploy-migrate
5963
if [ "$ENABLE_ALEMBIC_MIGRATIONS" = "true" ]; then
6064
downgrade_alembic_migrations
6165
fi

0 commit comments

Comments
 (0)