Step: baremetalds-assisted-gather

Log gather from remote packet server.

Container image used for this step: assisted-test-infra

assisted-test-infra resolves to an image built or imported by the ci-operator configuration (documentation).

Environment

In addition to the default environment, the step exposes the following:

Variable Name Type Variable Content
SOSREPORT Parameter[?] Gather sosreport data from each running libvirt VM. (default: true)
MUST_GATHER Parameter[?] Apply 'oc must-gather' on created cluster. (default: true)
GATHER_ALL_CLUSTERS Parameter[?] Gather all clusters from assisted-service. (default: true)

Source Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

echo "************ baremetalds assisted gather command ************"

if [[ ! -e "${SHARED_DIR}/server-ip" ]]; then
  echo "No server IP found; skipping log gathering."
  exit 0
fi

# Fetch packet basic configuration
# shellcheck source=/dev/null
source "${SHARED_DIR}/packet-conf.sh"

function getlogs() {
  echo "### Downloading logs..."

  ssh  "${SSHOPTS[@]}" "root@${IP}" bash - <<EOF
  set -xeuo pipefail
  cd /home/assisted
  cp -v -R ./reports /tmp/artifacts || true
  find -name '*.log' -exec cp -v {} /tmp/artifacts \; || true
EOF

  scp -r "${SSHOPTS[@]}" "root@${IP}:/tmp/artifacts/*" "${ARTIFACT_DIR}"
}

# Gather logs regardless of what happens after this
trap getlogs EXIT

echo "### Gathering logs..."
timeout -s 9 30m ssh "${SSHOPTS[@]}" "root@${IP}" bash - <<EOF |& sed -e 's/.*auths.*/*** PULL_SECRET ***/g'

set -xeuo pipefail
cd /home/assisted
source /root/config

# Get sosreport including sar data
sos report --batch --tmp-dir /tmp/artifacts \
  -o container_log,filesys,kvm,libvirt,logs,networkmanager,networking,podman,processor,rpm,sar,virsh,yum \
  -k podman.all -k podman.logs

# TODO: remove when https://github.com/sosreport/sos/pull/2594 is available
cp -v -r /var/lib/libvirt/dnsmasq /tmp/artifacts/libvirt-dnsmasq

# Get assisted logs
if [ -f "\${HOME}/.kube/config" ]; then
  export LOGS_DEST=/tmp/artifacts
  export KUBECTL="kubectl --kubeconfig=\${HOME}/.kube/config"

  make download_service_logs
fi

export ADDITIONAL_PARAMS=""
if [ "${SOSREPORT}" == "true" ]; then
  ADDITIONAL_PARAMS="\${ADDITIONAL_PARAMS} --sosreport"
fi
if [ "${MUST_GATHER}" == "true" ]; then
  ADDITIONAL_PARAMS="\${ADDITIONAL_PARAMS} --must-gather"
fi
if [ "${GATHER_ALL_CLUSTERS}" == "true" ]; then
  ADDITIONAL_PARAMS="\${ADDITIONAL_PARAMS} --download-all"
fi
make download_cluster_logs

for kubeconfig in \$(find \${KUBECONFIG} -type f); do
  export KUBECTL="kubectl --kubeconfig=\${kubeconfig}"
  name=\$(basename \${kubeconfig})
  export LOGS_DEST=/tmp/artifacts/new_cluster_\${name}
  make download_service_logs
done

EOF

Properties

Property Value Description
Step timeout[?] 2h0m0s Limits the execution time of the step.
Termination grace period[?] 10m0s Period of time until SIGKILL signal is sent to the test pod (after SIGTERM signal is sent).
Resource requests (cpu) 1000m Used in .resources.requests of the pod running this step.
Resource requests (memory) 500Mi Used in .resources.requests of the pod running this step.
Optional on success[?] true Allows the step to be skipped if all steps in pre and test phases succeeded.
Best effort[?] true This step's failure will not cause whole job to fail if the step is run in post phase.

GitHub Link:

https://github.com/openshift/release/blob/master/ci-operator/step-registry/baremetalds/assisted/gather/baremetalds-assisted-gather-ref.yaml

Owners:

Approvers:

Source code for this page located on GitHub