fix: remove output on log collecting (#1183)
* fix: remove output on log collecting Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/1178/head
parent
a434cc5953
commit
e9dfa2d6a8
|
|
@ -43,6 +43,8 @@ initDefaults() {
|
|||
export DEVWORKSPACE_CONTROLLER_TEST_NAMESPACE=devworkspace-controller-test
|
||||
export DEVWORKSPACE_CHE_OPERATOR_TEST_NAMESPACE=devworkspace-cheoperator-test
|
||||
export IMAGE_PULLER_ENABLE="false"
|
||||
export IS_OPENSHIFT=$(kubectl api-resources --api-group="route.openshift.io" --no-headers=true | head -n1 | wc -l)
|
||||
export IS_KUBERNETES=$(if [[ $IS_OPENSHIFT == 0 ]]; then echo 1; else echo 0; fi)
|
||||
|
||||
# turn off telemetry
|
||||
mkdir -p ${HOME}/.config/chectl
|
||||
|
|
@ -170,9 +172,15 @@ installYq() {
|
|||
collectLogs() {
|
||||
mkdir -p ${ARTIFACTS_DIR}
|
||||
|
||||
set +e
|
||||
collectClusterResources
|
||||
set -e
|
||||
set +ex
|
||||
if [[ $IS_KUBERNETES == 1 ]]; then
|
||||
# Collect logs only for k8s cluster since OpenShift CI already dump all resources
|
||||
collectClusterResources
|
||||
fi
|
||||
|
||||
# additionally grab server logs for fast access
|
||||
chectl server:logs -n $NAMESPACE -d $ARTIFACTS_DIR
|
||||
set -ex
|
||||
}
|
||||
|
||||
RESOURCES_DIR_NAME='resources'
|
||||
|
|
@ -193,12 +201,19 @@ collectNamespacedScopeResources() {
|
|||
namespace="$1"
|
||||
if [[ -z $namespace ]]; then return; fi
|
||||
|
||||
STANDARD_KINDS=("pods" "jobs" "deployments"
|
||||
"services" "ingresses"
|
||||
"configmaps" "secrets"
|
||||
"serviceaccounts" "roles" "rolebindings"
|
||||
STANDARD_KINDS=(
|
||||
"pods"
|
||||
"jobs"
|
||||
"deployments"
|
||||
"services"
|
||||
"ingresses"
|
||||
"configmaps"
|
||||
"secrets"
|
||||
"serviceaccounts"
|
||||
"roles"
|
||||
"rolebindings"
|
||||
"pvc"
|
||||
)
|
||||
)
|
||||
CRDS_KINDS=($(kubectl get crds -o jsonpath="{.items[*].spec.names.plural}"))
|
||||
KINDS=("${STANDARD_KINDS[@]}" "${CRDS_KINDS[@]}")
|
||||
|
||||
|
|
@ -208,8 +223,8 @@ collectNamespacedScopeResources() {
|
|||
|
||||
names=$(kubectl get -n $namespace $kind --no-headers=true -o custom-columns=":metadata.name")
|
||||
for name in $names ; do
|
||||
name=${name//[:<>|*?]/_}
|
||||
kubectl get -n $namespace $kind $name -o yaml > "${dir}/${name}.yaml"
|
||||
filename=${name//[:<>|*?]/_}
|
||||
kubectl get -n $namespace $kind $name -o yaml > "${dir}/${filename}.yaml"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
|
@ -223,11 +238,10 @@ collectNamespacedPodLogs() {
|
|||
|
||||
pods=$(kubectl get -n $namespace pods --no-headers=true -o custom-columns=":metadata.name")
|
||||
for pod in $pods ; do
|
||||
pod=${pod//[:<>|*?]/_}
|
||||
containers=$(kubectl get -n $namespace pod $pod -o jsonpath="{.spec.containers[*].name}")
|
||||
for container in $containers ; do
|
||||
container=${container//[:<>|*?]/_}
|
||||
kubectl logs -n $namespace $pod -c $container > "${dir}/${pod}_${container}.log"
|
||||
filename=${pod//[:<>|*?]/_}_${container//[:<>|*?]/_}
|
||||
kubectl logs -n $namespace $pod -c $container > "${dir}/${filename}.log"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
|
@ -243,9 +257,11 @@ collectNamespacedEvents() {
|
|||
}
|
||||
|
||||
collectClusterScopeResources() {
|
||||
KINDS=("crds"
|
||||
"pv"
|
||||
"clusterroles" "clusterrolebindings"
|
||||
KINDS=(
|
||||
"crds"
|
||||
"pv"
|
||||
"clusterroles"
|
||||
"clusterrolebindings"
|
||||
)
|
||||
for kind in "${KINDS[@]}" ; do
|
||||
dir="${ARTIFACTS_DIR}/${RESOURCES_DIR_NAME}/${CLUSTER_DIR_NAME}/${kind}"
|
||||
|
|
@ -253,8 +269,8 @@ collectClusterScopeResources() {
|
|||
|
||||
names=$(kubectl get -n $namespace $kind --no-headers=true -o custom-columns=":metadata.name")
|
||||
for name in $names ; do
|
||||
name=${name//[:<>|*?]/_}
|
||||
kubectl get -n $namespace $kind $name -o yaml > "${dir}/${name}.yaml"
|
||||
filename=${name//[:<>|*?]/_}
|
||||
kubectl get -n $namespace $kind $name -o yaml > "${dir}/${filename}.yaml"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
#
|
||||
# Copyright (c) 2019-2021 Red Hat, Inc.
|
||||
# This program and the accompanying materials are made
|
||||
# available under the terms of the Eclipse Public License 2.0
|
||||
# which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
#
|
||||
# SPDX-License-Identifier: EPL-2.0
|
||||
#
|
||||
# Contributors:
|
||||
# Red Hat, Inc. - initial API and implementation
|
||||
#
|
||||
|
||||
# Add Web IDE link on PRs
|
||||
name: Try in Web IDE
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue