
This patch adds in a tekton zuul job and fixes/adjusts the existing linting and building, which currently does not perform the advertised checks. This is the final patch of the chain of patches in order: 0. https://review.opendev.org/#/c/759865/ : tekton-pipelines 1. https://review.opendev.org/#/c/759598/ : tekton-triggers 2. https://review.opendev.org/#/c/759764/ : tektnon-dashboard Change-Id: Ie7bd9efd42fd13fe8e5e83f290f72ed00ba9dea1 Signed-off-by: Tin Lam <tin@irrational.io>
34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -ux
|
|
|
|
export PARALLELISM_FACTOR=2
|
|
|
|
function get_namespaces {
|
|
kubectl get namespaces -o name | awk -F '/' '{ print $NF }'
|
|
}
|
|
|
|
function get_pods () {
|
|
NAMESPACE=$1
|
|
kubectl get pods -n ${NAMESPACE} -o name | awk -F '/' '{ print $NF }' | xargs -L1 -P${PARALLELISM_FACTOR} -I {} echo ${NAMESPACE} {}
|
|
}
|
|
|
|
export -f get_pods
|
|
|
|
function get_pod_logs () {
|
|
NAMESPACE=${1% *}
|
|
POD=${1#* }
|
|
INIT_CONTAINERS=$(kubectl get pod $POD -n ${NAMESPACE} -o json | jq -r '.spec.initContainers[]?.name')
|
|
CONTAINERS=$(kubectl get pod $POD -n ${NAMESPACE} -o json | jq -r '.spec.containers[].name')
|
|
for CONTAINER in ${INIT_CONTAINERS} ${CONTAINERS}; do
|
|
echo "${NAMESPACE}/${POD}/${CONTAINER}"
|
|
mkdir -p "${LOGDIR}/pod-logs/${NAMESPACE}/${POD}"
|
|
kubectl logs ${POD} -n ${NAMESPACE} -c ${CONTAINER} > "${LOGDIR}/pod-logs/${NAMESPACE}/${POD}/${CONTAINER}.txt"
|
|
done
|
|
}
|
|
|
|
export -f get_pod_logs
|
|
|
|
get_namespaces | \
|
|
xargs -r -n 1 -P ${PARALLELISM_FACTOR} -I {} bash -c 'get_pods "$@"' _ {} | \
|
|
xargs -r -n 2 -P ${PARALLELISM_FACTOR} -I {} bash -c 'get_pod_logs "$@"' _ {}
|