Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ function getlogs() {
# Gather logs regardless of what happens after this
trap getlogs EXIT

echo "### Fetching must-gather image information..."
ssh "${SSHOPTS[@]}" "root@${IP}" bash - << EOF |& sed -e 's/.*auths.*/*** PULL_SECRET ***/g'
cd /root/dev-scripts
source common.sh
source ocp_install_env.sh
source utils.sh
source network.sh

# In releases prior to 4.8, must-gather won't work on disconnected
# without specifying an image to use. This looks at the release payload,
# and generates the pullspec for the must-gather in our mirrored
# registry.
OPENSHIFT_VERSION=\$(openshift_version)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about sourcing ds-var.conf and using DS_OPENSHIFT_VERSION and DS_REGISTRY as in

if printf '%s\n%s' "4.8" "${DS_OPENSHIFT_VERSION}" | sort -C -V; then
? The file should be available at this stage

Copy link
Member Author

@stbenjam stbenjam May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably fine but maybe do it as a follow-up? Let's get 4.7 unblocked today. This gather bash works and we've been using it for more than a year in dev-scripts.

if printf '%s\n4.7\n' "\$OPENSHIFT_VERSION" | sort -V -C; then
if [[ -n "\${MIRROR_IMAGES}" ]]; then
MUST_GATHER_RELEASE_IMAGE=\$(image_for must-gather | cut -d '@' -f2)
LOCAL_REGISTRY_PREFIX="\${LOCAL_REGISTRY_DNS_NAME}:\${LOCAL_REGISTRY_PORT}/localimages/local-release-image"
echo "export MUST_GATHER_IMAGE=\"--image=\${LOCAL_REGISTRY_PREFIX}@\${MUST_GATHER_RELEASE_IMAGE}\"" >> /tmp/must-gather-image.sh
fi
fi
EOF

scp "${SSHOPTS[@]}" "root@${IP}:/tmp/must-gather-image.sh" "${SHARED_DIR}/" || true

echo "### Gathering logs..."
timeout -s 9 15m ssh "${SSHOPTS[@]}" "root@${IP}" bash - <<EOF |& sed -e 's/.*auths.*/*** PULL_SECRET ***/g'
cd dev-scripts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ then
source "${SHARED_DIR}/proxy-conf.sh"
fi

# Allow a job to override the must-gather image, this is needed for
# disconnected environments prior to 4.8.
if test -f "${SHARED_DIR}/must-gather-image.sh"
then
# shellcheck source=/dev/null
source "${SHARED_DIR}/must-gather-image.sh"
else
MUST_GATHER_IMAGE=${MUST_GATHER_IMAGE:-""}
fi

mkdir -p "${ARTIFACT_DIR}/audit-logs"
oc adm must-gather --dest-dir="${ARTIFACT_DIR}/audit-logs" -- /usr/bin/gather_audit_logs
oc adm must-gather $MUST_GATHER_IMAGE --dest-dir="${ARTIFACT_DIR}/audit-logs" -- /usr/bin/gather_audit_logs
tar -czC "${ARTIFACT_DIR}/audit-logs" -f "${ARTIFACT_DIR}/audit-logs.tar.gz" .
rm -rf "${ARTIFACT_DIR}/audit-logs"
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ then
source "${SHARED_DIR}/proxy-conf.sh"
fi

# Allow a job to override the must-gather image, this is needed for
# disconnected environments prior to 4.8.
if test -f "${SHARED_DIR}/must-gather-image.sh"
then
# shellcheck source=/dev/null
source "${SHARED_DIR}/must-gather-image.sh"
else
MUST_GATHER_IMAGE=${MUST_GATHER_IMAGE:-""}
fi

echo "Running must-gather..."
mkdir -p ${ARTIFACT_DIR}/must-gather
oc --insecure-skip-tls-verify adm must-gather --dest-dir ${ARTIFACT_DIR}/must-gather > ${ARTIFACT_DIR}/must-gather/must-gather.log
oc --insecure-skip-tls-verify adm must-gather $MUST_GATHER_IMAGE --dest-dir ${ARTIFACT_DIR}/must-gather > ${ARTIFACT_DIR}/must-gather/must-gather.log
[ -f "${ARTIFACT_DIR}/must-gather/event-filter.html" ] && cp "${ARTIFACT_DIR}/must-gather/event-filter.html" "${ARTIFACT_DIR}/event-filter.html"
tar -czC "${ARTIFACT_DIR}/must-gather" -f "${ARTIFACT_DIR}/must-gather.tar.gz" .
rm -rf "${ARTIFACT_DIR}"/must-gather