Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 15 additions & 1 deletion hack/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ on_exit() {

# Cleanup VSPHERE_PASSWORD from temporary artifacts directory.
if [[ "${ORIGINAL_ARTIFACTS}" != "" ]]; then
# unpack pod-logs.tar.gz files to replace secrets in them
Copy link
Member

@sbueringer sbueringer Jun 11, 2025

Choose a reason for hiding this comment

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

I think this results in a very deep folder hierarchy. In the interest of future us, can we reduce that a bit?

I get this after extract: ./tmp 2/tmp.BAZS1S16eR/clusters/quick-start-l3rsho/machines/quick-start-l3rsho-cp-5x2qt-wfsf5/pod-logs.tar.gz-unpacked/pods/kube-system_etcd-quick-start-l3-wfsf5_6501f15974bbf5a29b9e36b04db38957/etcd.

Ideally kube-system would be top-level in this archive (but just getting rid of *-unpacked and above would be fine as well)

Copy link
Member Author

Choose a reason for hiding this comment

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

oh 🤔 good one. Let me check how this came. I did not expect that either.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should be good now.

Its now pods/kube-system_etcd-quick-start-l3-wfsf5_6501f15974bbf5a29b9e36b04db38957/etcd

Copy link
Member Author

Choose a reason for hiding this comment

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

(I broke it somewhere?!)

Copy link
Member

Choose a reason for hiding this comment

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

Perfect

find "${ARTIFACTS}" -type f -name pod-logs.tar.gz | while IFS= read -r tarball; do
echo "Unpacking ${tarball} for secrets replacement"
mkdir -p "${tarball}-unpacked"
tar -xzf "${tarball}" -C "${tarball}-unpacked"
rm "${tarball}"
done
# Delete non-text files from artifacts directory to not leak files accidentially
find "${ARTIFACTS}" -type f -exec file --mime-type {} \; | grep -v -E -e "text/plain|text/xml|application/json|inode/x-empty" | while IFS= read -r line
do
Expand All @@ -83,6 +90,13 @@ on_exit() {
sed -i "s/${VSPHERE_PASSWORD_B64}/REDACTED/g" "${file}"
done || true
fi
# re-packing pod-logs.tar.gz-unpacked
find "${ARTIFACTS}" -type d -name pod-logs.tar.gz-unpacked | while IFS= read -r tarballDirectory; do
tarball="${tarballDirectory%-unpacked}"
echo "Packing ${tarballDirectory} to ${tarball} after secrets replacement"
tar -czf "${tarball}" -C . "${tarballDirectory}"
rm -r "${tarballDirectory}"
done
# Move all artifacts to the original artifacts location.
mv "${ARTIFACTS}"/* "${ORIGINAL_ARTIFACTS}/"
fi
Expand All @@ -104,7 +118,7 @@ export VSPHERE_USERNAME="${GOVC_USERNAME:-}"
export VSPHERE_PASSWORD="${GOVC_PASSWORD:-}"
export E2E_CONF_FILE="${REPO_ROOT}/test/e2e/config/vsphere.yaml"
export E2E_CONF_OVERRIDE_FILE=""
export E2E_VM_OPERATOR_VERSION="${VM_OPERATOR_VERSION:-v1.8.6-0-gde75746a}"
export E2E_VM_OPERATOR_VERSION="${VM_OPERATOR_VERSION:-v1.8.6-0-gde75746a-65e87004}"
export DOCKER_IMAGE_TAR="/tmp/images/image.tar"
export GC_KIND="false"

Expand Down
2 changes: 2 additions & 0 deletions test/framework/log/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func (c *MachineLogCollector) CollectMachineLog(ctx context.Context, ctrlClient
"sudo", "cat", "/var/log/cloud-init-output.log"),
captureLogs("kubeadm-service.log",
"sudo", "cat", "/var/log/kubeadm-service.log"),
captureLogs("pod-logs.tar.gz",
"sudo", "tar", "-czf", "-", "-C", "/var/log", "pods"),
)
}

Expand Down
Loading