[CI] Tolerate errors when collecting k8s logs in CI (#217)
- The log collection failed after a command failed. - tolerate errors
This commit is contained in:
parent
d3e7a7e6c9
commit
dc97bd4ac6
10
.ci/helm.sh
10
.ci/helm.sh
@ -91,12 +91,12 @@ function ci::collect_k8s_logs() {
|
|||||||
echo "Collecting k8s logs to ${K8S_LOGS_DIR}"
|
echo "Collecting k8s logs to ${K8S_LOGS_DIR}"
|
||||||
for k8sobject in $(${KUBECTL} get pods,jobs -n ${NAMESPACE} -l app=pulsar -o=name); do
|
for k8sobject in $(${KUBECTL} get pods,jobs -n ${NAMESPACE} -l app=pulsar -o=name); do
|
||||||
filebase="${k8sobject//\//_}"
|
filebase="${k8sobject//\//_}"
|
||||||
${KUBECTL} logs -n ${NAMESPACE} "$k8sobject" --all-containers=true --ignore-errors=true --prefix=true > "${filebase}.$$.log.txt"
|
${KUBECTL} logs -n ${NAMESPACE} "$k8sobject" --all-containers=true --ignore-errors=true --prefix=true > "${filebase}.$$.log.txt" || true
|
||||||
${KUBECTL} logs -n ${NAMESPACE} "$k8sobject" --all-containers=true --ignore-errors=true --prefix=true --previous=true > "${filebase}.previous.$$.log.txt"
|
${KUBECTL} logs -n ${NAMESPACE} "$k8sobject" --all-containers=true --ignore-errors=true --prefix=true --previous=true > "${filebase}.previous.$$.log.txt" || true
|
||||||
done;
|
done;
|
||||||
${KUBECTL} get events --sort-by=.lastTimestamp -A > events.$$.log.txt
|
${KUBECTL} get events --sort-by=.lastTimestamp -A > events.$$.log.txt || true
|
||||||
${KUBECTL} get events --sort-by=.lastTimestamp -A -o yaml > events.$$.log.yaml
|
${KUBECTL} get events --sort-by=.lastTimestamp -A -o yaml > events.$$.log.yaml || true
|
||||||
${KUBECTL} get -n ${NAMESPACE} all -o yaml > k8s_resources.$$.yaml
|
${KUBECTL} get -n ${NAMESPACE} all -o yaml > k8s_resources.$$.yaml || true
|
||||||
}
|
}
|
||||||
|
|
||||||
function ci::install_pulsar_chart() {
|
function ci::install_pulsar_chart() {
|
||||||
|
|||||||
1
.github/workflows/pulsar.yml
vendored
1
.github/workflows/pulsar.yml
vendored
@ -56,6 +56,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_bk_tls.yml
vendored
1
.github/workflows/pulsar_bk_tls.yml
vendored
@ -55,6 +55,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_broker_tls.yml
vendored
1
.github/workflows/pulsar_broker_tls.yml
vendored
@ -56,6 +56,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_function.yml
vendored
1
.github/workflows/pulsar_function.yml
vendored
@ -58,6 +58,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_image.yml
vendored
1
.github/workflows/pulsar_image.yml
vendored
@ -56,6 +56,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_jwt_asymmetric.yml
vendored
1
.github/workflows/pulsar_jwt_asymmetric.yml
vendored
@ -58,6 +58,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_jwt_symmetric.yml
vendored
1
.github/workflows/pulsar_jwt_symmetric.yml
vendored
@ -58,6 +58,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_tls.yml
vendored
1
.github/workflows/pulsar_tls.yml
vendored
@ -56,6 +56,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_zk_tls.yml
vendored
1
.github/workflows/pulsar_zk_tls.yml
vendored
@ -56,6 +56,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
1
.github/workflows/pulsar_zkbk_tls.yml
vendored
1
.github/workflows/pulsar_zkbk_tls.yml
vendored
@ -56,6 +56,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source .ci/helm.sh
|
source .ci/helm.sh
|
||||||
|
set +e
|
||||||
ci::collect_k8s_logs
|
ci::collect_k8s_logs
|
||||||
|
|
||||||
- name: Upload k8s logs on failure
|
- name: Upload k8s logs on failure
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user