Last active
May 31, 2019 15:35
-
-
Save chmouel/00500e704784f455c869458c882f86e5 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
set -e | |
choosef() { | |
type="$1" | |
[[ -n $2 ]] && label="-ltekton.dev/${2}" | |
[[ -n $3 ]] && jqb=$3 || jqb='.items[].metadata.name' | |
kubectl get ${type} ${label} -o json|jq -r $jqb | fzf -1 | |
} | |
PIPELINE=$(choosef pipeline) | |
echo "PIPELINE:${PIPELINE} has been chosen" | |
PIPELINERUN=$(choosef pipelinerun pipeline=${PIPELINE}) | |
echo "PIPELINERUN:${PIPELINERUN} has been chosen" | |
POD=$(choosef pods pipelineRun=${PIPELINERUN}) | |
echo "POD:${POD} has been chosen" | |
CONTAINER=$(kubectl get pod/${POD} -o json|jq -r '.spec.containers[].name'|grep -vw nop|fzf -1) | |
echo "CONTAINER:${CONTAINER} has been chosen" | |
kubectl logs pod/${POD} -c ${CONTAINER} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment