flatcar-scripts/jenkins/kola/gce.sh
Mathieu Tortuyaux ae73d66a07
kola/gce: shrink hostname to be lower than 63 char
GCP Pro is failing because hostname is > 63 char:
```
Apr  5 19:52:27.522820 kubelet[1762]: E0405 19:52:27.522513    1762 kubelet_node_status.go:93] "Unable to register node with API server" err="Node \"jenkins-gce-pro-5-91a967ef5450cb932bc5.c.flatcar-212911.internal\" is invalid: metadata.labels: Invalid value: \"jenkins-gce-pro-5-91a967ef5450cb932bc5.c.flatcar-212911.internal\": must be no more than 63 characters" node="jenkins-gce-pro-5-91a967ef5450cb932bc5.c.flatcar-212911.internal"
```

Let's remove `jenkins` and `gce` from the hostname, these
information are not critical for debugging purposes.

Hostname should now looks like
"basic-5-91a967ef5450cb932bc5.c.flatcar-212911.internal" or
"pro-5-91a967ef5450cb932bc5.c.flatcar-212911.internal"

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2022-04-06 16:45:31 +02:00

53 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -ex
rm -rf *.tap _kola_temp*
# If the OFFER is empty, it should be treated as the basic offering.
if [[ "${OFFER}" == "" ]]; then
OFFER="basic"
fi
# Append the offer as oem suffix.
if [[ "${OFFER}" != "basic" ]]; then
OEM_SUFFIX="_${OFFER}"
fi
# Create a name that includes the OFFER,
# but replace _ with -, as gcloud doesn't like it otherwise.
OEMNAME="${OFFER}-${BUILD_NUMBER}"
NAME=${OEMNAME//_/-}
bin/ore gcloud create-image \
--board="${BOARD}" \
--family="${NAME}" \
--json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
--source-root="${DOWNLOAD_ROOT}/boards" \
--source-name=flatcar_production_gce${OEM_SUFFIX}.tar.gz \
--version="${FLATCAR_VERSION}"
GCE_NAME="${NAME//[+.]/-}-${FLATCAR_VERSION//[+.]/-}"
trap 'bin/ore gcloud delete-images \
--json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
"${GCE_NAME}"' EXIT
if [[ "${KOLA_TESTS}" == "" ]]; then
KOLA_TESTS="*"
fi
# Do not expand the kola test patterns globs
set -o noglob
timeout --signal=SIGQUIT 6h bin/kola run \
--basename="${NAME}" \
--gce-image="${GCE_NAME}" \
--gce-json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
--gce-machinetype="${GCE_MACHINE_TYPE}" \
--parallel=4 \
--platform=gce \
--channel="${GROUP}" \
--tapfile="${JOB_NAME##*/}.tap" \
--torcx-manifest=torcx_manifest.json \
${KOLA_TESTS}
set +o noglob