Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: confirm build-time Go version == CI-time version #15494

Closed
timvaillancourt opened this issue Mar 14, 2024 · 1 comment · Fixed by #15932
Closed

Feature Request: confirm build-time Go version == CI-time version #15494

timvaillancourt opened this issue Mar 14, 2024 · 1 comment · Fixed by #15932

Comments

@timvaillancourt
Copy link
Contributor

timvaillancourt commented Mar 14, 2024

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:

  1. https://github.com/vitessio/vitess/blob/main/docker/bootstrap/Dockerfile.common#L1
  2. 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 🙇

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(?)

@timvaillancourt timvaillancourt added Type: Feature Request Needs Triage This issue needs to be correctly labelled and triaged labels Mar 14, 2024
@timvaillancourt timvaillancourt self-assigned this Mar 14, 2024
@mattlord mattlord added Component: Build/CI Type: CI/Build and removed Needs Triage This issue needs to be correctly labelled and triaged labels Mar 15, 2024
@frouioui
Copy link
Member

frouioui commented Mar 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants