Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 try to actually trap on ERR to debug #375

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/actions/install-tackle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ runs:
make install-tackle
working-directory: ${{ github.action_path }}/../../..
shell: bash
- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: debug-output
path: /tmp/konveyor-debug
1 change: 1 addition & 0 deletions hack/install-konveyor.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

set -E
set -e
set -x
set -o pipefail
Expand Down
41 changes: 41 additions & 0 deletions hack/install-tackle.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

set -E
set -e
set -x

Expand Down Expand Up @@ -45,6 +46,46 @@ if ! command -v operator-sdk1 >/dev/null 2>&1; then
chmod +x "${operator_sdk_bin}"
fi

debug() {
set +e
echo "Install Konveyor FAILED!!!"
echo "What follows is some info that may be useful in debugging the failure"

if [ "${CI}" == "true" ]; then
debug_output="/tmp/konveyor-debug"
mkdir -p "${debug_output}"
namespace="${debug_output}/namespace.yaml"
all="${debug_output}/all_resources.yaml"
operator="${debug_output}/operator_resources.yaml"
tackle="${debug_output}/tackle.yaml"
pods="${debug_output}/pod_descriptions.yaml"

kubectl get namespace "${NAMESPACE}" -o yaml | tee "${namespace}"
kubectl get --namespace "${NAMESPACE}" all | tee "${all}"
kubectl get --namespace "${NAMESPACE}" -o yaml \
subscriptions.operators.coreos.com,catalogsources.operators.coreos.com,installplans.operators.coreos.com,clusterserviceversions.operators.coreos.com | tee "${operator}"
kubectl get --namespace "${NAMESPACE}" -o yaml tackles.tackle.konveyor.io/tackle | tee "${tackle}"

for pod in $(kubectl get pods -n "${NAMESPACE}" -o jsonpath='{.items[*].metadata.name}'); do
kubectl --namespace "${NAMESPACE}" describe pod "${pod}" | tee -a "${pods}"
kubectl --namespace "${NAMESPACE}" logs "${pod}" | tee "${debug_output}/${pod}.log"
done
else
kubectl get namespace "${NAMESPACE}" -o yaml
kubectl get --namespace "${NAMESPACE}" all
kubectl get --namespace "${NAMESPACE}" -o yaml \
subscriptions.operators.coreos.com,catalogsources.operators.coreos.com,installplans.operators.coreos.com,clusterserviceversions.operators.coreos.com
kubectl get --namespace "${NAMESPACE}" -o yaml tackles.tackle.konveyor.io/tackle

for pod in $(kubectl get pods -n "${NAMESPACE}" -o jsonpath='{.items[*].metadata.name}'); do
kubectl --namespace "${NAMESPACE}" describe pod "${pod}"
done
fi

exit 1
}
trap 'debug' ERR

install_operator() {
kubectl auth can-i create namespace --all-namespaces
kubectl create namespace ${NAMESPACE} || true
Expand Down
Loading