Skip to content

Instantly share code, notes, and snippets.

@bmoussaud
Created September 1, 2021 15:48
Show Gist options
  • Save bmoussaud/83abdd6393b36bf6ae0233ea39e8a7a0 to your computer and use it in GitHub Desktop.
Save bmoussaud/83abdd6393b36bf6ae0233ea39e8a7a0 to your computer and use it in GitHub Desktop.
KPack Logs script file
#!/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