Step: gather-aws-console

The pre-deprovision artifacts step collects console logs from AWS instances. It gathers console logs for all nodes and machines with a provider ID, as well as any instance IDs listed in ${SHARED_DIR}/aws-instance-ids.txt. aws-instance-ids.txt entries should have a single provider ID per line. Duplicate entries are ok; the step deduplicates before gathering.

Container image used for this step: ocp/4.5:upi-installer

ocp/4.5:upi-installer resolves to an image imported from the specified imagestream tag on the build farm (documentation).

Environment

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

Variable Name Type Variable Content
TMPDIR Parameter[?] A pathname of a directory made available for programs that need a place to create temporary files. (default: /tmp)

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
#!/bin/bash

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

trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM

export AWS_SHARED_CREDENTIALS_FILE="${CLUSTER_PROFILE_DIR}/.awscred"

if test ! -f "${SHARED_DIR}/metadata.json"
then
	echo "No metadata.json, so unknown AWS region, so unable to gathering console logs."
	exit 0
fi

if test -f "${KUBECONFIG}"
then
	oc --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' > "${TMPDIR}/node-provider-IDs.txt" &
	wait "$!"

	oc --request-timeout=5s -n openshift-machine-api get machines -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' >> "${TMPDIR}/node-provider-IDs.txt" &
	wait "$!"
else
	echo "No kubeconfig; skipping providerID extraction."
	exit 0
fi

if test -f "${SHARED_DIR}/aws-instance-ids.txt"
then
	cat "${SHARED_DIR}/aws-instance-ids.txt" >> "${TMPDIR}/node-provider-IDs.txt"
fi

aws --version

REGION="$(jq -r .aws.region "${SHARED_DIR}/metadata.json")"
cat "${TMPDIR}/node-provider-IDs.txt" | sort | grep . | uniq | while read -r INSTANCE_ID
do
	echo "Gathering console logs for ${INSTANCE_ID}"
	LC_ALL=en_US.UTF-8 aws --region "${REGION}" ec2 get-console-output --instance-id "${INSTANCE_ID}" --output text > "${ARTIFACT_DIR}/${INSTANCE_ID}" &
	wait "$!"
done

Properties

Property Value Description
Termination grace period[?] 10m0s Period of time until SIGKILL signal is sent to the test pod (after SIGTERM signal is sent).
Resource requests (cpu) 300m Used in .resources.requests of the pod running this step.
Resource requests (memory) 300Mi 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.

GitHub Link:

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

Owners:

Approvers:

Source code for this page located on GitHub