diff --git a/.github/workflows/recreate-runners.yml b/.github/workflows/recreate-runners.yml index aed648ce..3b8a7bba 100644 --- a/.github/workflows/recreate-runners.yml +++ b/.github/workflows/recreate-runners.yml @@ -127,6 +127,7 @@ jobs: echo "KUBECONFIG=$KUBECONFIG" >> $GITHUB_ENV - name: 'Configure: deploy actions-runner-controller into stream-apps-gh-runners' shell: bash + timeout-minutes: 30 env: VERBOSE: ${{ inputs.verbose == 'true' && '--verbose' || '' }} DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} @@ -136,3 +137,8 @@ jobs: GH_ARC_PRIVATE_KEY: ${{ secrets.GH_ARC_PRIVATE_KEY }} GH_ARC_PAT: ${{ inputs.github_personal_access_token }} run: ./scripts/deploy-gh-runners-${RUNNER_TYPE}.sh + - name: 'Retrieve: Pod Logs' + if: ${{ failure() }} + shell: bash + run: | + ./scripts/get-logs-pods.sh actions-runner-system | tee ./pods.log diff --git a/scripts/get-logs-pods.sh b/scripts/get-logs-pods.sh new file mode 100755 index 00000000..dd4afa32 --- /dev/null +++ b/scripts/get-logs-pods.sh @@ -0,0 +1,22 @@ +#!/bin/bash +USE_NS=$1 +if [ "$USE_NS" == "" ]; then + if [ "$NS" == "" ]; then + echo "NS not defined" + exit 1 + else + USE_NS=$NS + fi +fi +set +e +PODS=$(kubectl get pods --namespace "$USE_NS" -o=jsonpath='{.items[*].metadata.name}' 2>/dev/null) +for pod in $PODS; do + echo "==================================" + echo "Config for $pod" + POD_JSON=$(kubectl get pod $pod --namespace "$USE_NS" --output=json) + echo "$POD_JSON" + echo "----------------------------------" + CN=$(echo "$POD_JSON" | jq '.spec.containers[0].name' | sed 's/\"//g') + echo "Logs for $pod/$CN" + kubectl logs $pod --container="$CN" --namespace "$USE_NS" --since=30m --timestamps=true +done