talos/hack/test/provision-tests.sh
Florian Klink a50c42980f
fix: use #!/usr/bin/env bash as shebang instead of #!/bin/bash
This will fix running these scripts on distros without /bin/bash, but
where bash is in $PATH, such as NixOS.

Currently, `make fmt` otherwise fails to run:

```
make[3]: Leaving directory '/home/flokli/dev/numtide/manifoldfinance/talos'
sh: ./hack/fix-artifacts.sh: /bin/bash: bad interpreter: No such file or directory
make[2]: *** [Makefile:163: local-fmt-protobuf] Error 126
make[2]: Leaving directory '/home/flokli/dev/numtide/manifoldfinance/talos'
make[1]: *** [Makefile:274: fmt-protobuf] Error 2
make[1]: Leaving directory '/home/flokli/dev/numtide/manifoldfinance/talos'
make: *** [Makefile:277: fmt] Error 2
```

Signed-off-by: Florian Klink <flokli@flokli.de>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-01-25 23:11:39 +03:00

48 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eoux pipefail
case "${CI:-false}" in
true)
mirror_flag=""
for registry in docker.io k8s.gcr.io quay.io gcr.io ghcr.io registry.dev.talos-systems.io; do
service="registry-${registry//./-}.ci.svc"
addr=`python3 -c "import socket; print(socket.gethostbyname('${service}'))"`
if [[ ! -z "${mirror_flag}" ]]; then
mirror_flag="${mirror_flag},"
fi
mirror_flag="${mirror_flag}${registry}=http://${addr}:5000"
done
INTEGRATION_TEST_FLAGS="-talos.provision.target-installer-registry=${REGISTRY} -talos.provision.registry-mirror ${mirror_flag}"
;;
*)
INTEGRATION_TEST_FLAGS=
;;
esac
if [ "${INTEGRATION_TEST_RUN:-undefined}" != "undefined" ]; then
INTEGRATION_TEST_FLAGS="${INTEGRATION_TEST_FLAGS} -test.run ${INTEGRATION_TEST_RUN}"
fi
if [ "${INTEGRATION_TEST_TRACK:-undefined}" != "undefined" ]; then
INTEGRATION_TEST_FLAGS="${INTEGRATION_TEST_FLAGS} -talos.provision.cidr 172.$(( ${INTEGRATION_TEST_TRACK} + 21 )).0.0/24"
fi
case "${CUSTOM_CNI_URL:-false}" in
false)
;;
*)
INTEGRATION_TEST_FLAGS="${INTEGRATION_TEST_FLAGS} -talos.provision.custom-cni-url=${CUSTOM_CNI_URL}"
;;
esac
"${INTEGRATION_TEST}" -test.v \
-talos.talosctlpath "${TALOSCTL}" \
-talos.provision.mtu 1450 \
-talos.provision.cni-bundle-url ${ARTIFACTS}/talosctl-cni-bundle-'${ARCH}'.tar.gz \
${INTEGRATION_TEST_FLAGS}