vitess
vitess copied to clipboard
Feature Request: confirm build-time Go version == CI-time version
Feature Description
The feature request is for a CI check to confirm the Golang runtime version used to build binaries is equal (or at least close) to the Go runtime version used to CI the build
This request is triggered by a discovery on our fork that the build-time Go runtime version was newer than what is being unit-tested by CI. This runs the risks of breaking changes between these two Go versions, in this case mainly in crypto/tls
(possibly others)
In order to prevent code that wasn't CI'd on the runtime we expect, I would prefer if the CI fails to pass in this scenario
I believe this can be checked in a GitHub Action by comparing these values:
- https://github.com/vitessio/vitess/blob/main/docker/bootstrap/Dockerfile.common#L1
- The
go-version:
fields for templates in https://github.com/vitessio/vitess/tree/main/test/templates
Any suggestions on the approach is appreciated! I'm happy to implement it if there is agreement :bow:
Psuedo-logic:
#!/bin/bash
UNIQUE_TPL_VERSIONS="$(awk '/go-version: /{print $(NF-0)}' test/templates/*.tpl | sort -u)"
UNIQUE_TPL_VERSIONS_COUNT=$(echo "$UNIQUE_TPL_VERSIONS" | wc -l | tr -d [:space:])
if [ "${UNIQUE_TPL_VERSIONS_COUNT}" -gt 1 ]; then
echo -e "expected a consistent 'go-version:' in test/templates/*.tpl, found ${UNIQUE_TPL_VERSIONS_COUNT} versions:\n${UNIQUE_TPL_VERSIONS}"
exit 1
fi
BOOTSTRAP_GOLANG_VERSION="$(awk -F ':' '/golang:/{print $(NF-0)}' docker/bootstrap/Dockerfile.common | cut -d- -f1)"
if [ "$UNIQUE_TPL_VERSIONS" != "$BOOTSTRAP_GOLANG_VERSION" ]; then
echo "expected equal go versions, '${UNIQUE_TPL_VERSIONS}' != '${BOOTSTRAP_GOLANG_VERSION}'"
exit 1
fi
Use Case(s)
Forks of this repo, or this repo itself if the runtime version is being kept in sync by humans(?)
I think it sounds like a reasonable idea, this can help us ensure the automatic golang upgrades are well made too. To avoid having too many workflows we can add this as a new step to Static Checks Etc.