Skip to content

Commit 1412145

Browse files
authored
Merge pull request #1562 from sbueringer/pr-sync-e2e-script
Sync e2e.sh with CAPV
2 parents bc9094c + 01eb75d commit 1412145

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

hack/e2e.sh

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ on_exit() {
5050
find "${ARTIFACTS}" -type f -name pod-logs.tar.gz | while IFS= read -r tarball; do
5151
echo "Unpacking ${tarball} for secrets replacement"
5252
mkdir -p "${tarball}-unpacked"
53-
tar -xzf "${tarball}" -C "${tarball}-unpacked"
53+
# on_exit should not fail due to broken tarballs
54+
tar -xzf "${tarball}" -C "${tarball}-unpacked" || true
5455
rm "${tarball}"
5556
done
5657
# Delete non-text files from artifacts directory to not leak files accidentially
@@ -79,7 +80,7 @@ on_exit() {
7980
find "${ARTIFACTS}" -type d -name pod-logs.tar.gz-unpacked | while IFS= read -r tarballDirectory; do
8081
tarball="${tarballDirectory%-unpacked}"
8182
echo "Packing ${tarballDirectory} to ${tarball} after secrets replacement"
82-
tar -czf "${tarball}" -C . "${tarballDirectory}"
83+
tar -czf "${tarball}" -C "${tarballDirectory}" .
8384
rm -r "${tarballDirectory}"
8485
done
8586
# Move all artifacts to the original artifacts location.
@@ -108,6 +109,32 @@ ssh-keygen -t ed25519 -f "${VSPHERE_SSH_PRIVATE_KEY}" -N ""
108109
export VSPHERE_SSH_AUTHORIZED_KEY
109110
VSPHERE_SSH_AUTHORIZED_KEY="$(cat "${VSPHERE_SSH_PRIVATE_KEY}.pub")"
110111

112+
# Ensure vSphere is reachable
113+
function wait_for_vsphere_reachable() {
114+
local n=0
115+
until [ $n -ge 300 ]; do
116+
curl -s -v "https://${VSPHERE_SERVER}/sdk" --connect-timeout 2 -k && RET=$? || RET=$?
117+
if [[ "$RET" -eq 0 ]]; then
118+
break
119+
fi
120+
n=$((n + 1))
121+
echo "Failed to reach https://${VSPHERE_SERVER}/sdk. Retrying in 1s ($n/30)"
122+
sleep 1
123+
done
124+
if [ "$RET" -ne 0 ]; then
125+
# Output some debug information in case of failing connectivity.
126+
echo "$ ip link"
127+
ip link
128+
echo "# installing tcptraceroute to check route"
129+
apt-get update && apt-get install -y tcptraceroute
130+
echo "$ tcptraceroute ${VSPHERE_SERVER} 443"
131+
tcptraceroute "${VSPHERE_SERVER}" 443
132+
fi
133+
return "$RET"
134+
}
135+
136+
wait_for_vsphere_reachable
137+
111138
# If BOSKOS_HOST is set then acquire a vsphere-project from Boskos.
112139
if [ -n "${BOSKOS_HOST:-}" ]; then
113140
# Check out the account from Boskos and store the produced environment

0 commit comments

Comments
 (0)