Created
September 1, 2021 15:48
-
-
Save bmoussaud/83abdd6393b36bf6ae0233ea39e8a7a0 to your computer and use it in GitHub Desktop.
KPack Logs script file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#set -x | |
IMAGE=$1 | |
NAMESPACE=$2 | |
POD=$(kubectl -n ${NAMESPACE} get image ${IMAGE} -o jsonpath="{.status.latestBuildRef}") | |
echo "${POD}" | |
CONTAINERS=$(kubectl -n ${NAMESPACE} get pod ${POD}-build-pod -o jsonpath="{.spec['initContainers'][*].name}") | |
echo ${CONTAINERS} | |
export IFS=" " | |
for container in $CONTAINERS; do | |
echo "==> $container" | |
kubectl logs ${POD}-build-pod -n ${NAMESPACE} -c $container | |
echo "------" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment