Closed ffranr closed 2 months ago
Useful snippets:
Makefile
release:
@$(call print, "Releasing tapd and tapcli binaries.")
$(VERSION_CHECK)
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)"
./scripts/release.sh
#!/bin/bash
REQUIRED_GO_VERSION=$6
if [ -n "$REQUIRED_GO_VERSION" ]; then
# Check the current Golang version
CURRENT_GO_VERSION=$(go version | grep -oP 'go\K[0-9]+\.[0-9]+\.[0-9]+')
if [ "$CURRENT_GO_VERSION" != "$REQUIRED_GO_VERSION" ]; then
echo "Error: Golang version $CURRENT_GO_VERSION found, but $REQUIRED_GO_VERSION is required."
exit 1
fi
fi
# Proceed with the rest of the script
While we're at it, maybe also check for unclean working directory?
Something like:
if output=$(git status --porcelain) && [ -z "$output" ]; then
# Working directory clean
else
# Uncommitted changes
fi
You can have Go download and manage certain versions: https://go.dev/doc/manage-install
There's also this: https://go.dev/doc/toolchain, which lets you add an env variable GOTOOLCHAIN
.
Re coveralls:
cc @jharveyb
You can have Go download and manage certain versions: https://go.dev/doc/manage-install
There's also this: https://go.dev/doc/toolchain, which lets you add an env variable
GOTOOLCHAIN
.
Thanks, that's good to know. I'm keen on adding GOTOOLCHAIN
.
Description:
The overall goal is to be able to reproduce a release manifest file. In order to reproduce the digest hashes in the manifest file of a given release, the correct Golang version must be used when building the binaries. Therefore, the
make release
command needs to assert the correct Golang version. If the Golang version is incorrect, the command should exit with an error message.Considerations and Modifications:
GO_VERSION = 1.22.3
.GO_VERSION
to./scripts/release.sh build-release
inmake release
../scripts/release.sh
to ensure that the correct version of Golang is used../scripts/release.sh
, the script should skip the version check../scripts/release.sh build-release
inmake release
is consistent with the version used in.github/workflows/release.yaml
(this check is already in place and does not require modifications as part of this issue).Acceptance Criteria:
make release
should use Golang version 1.22.3 (current go version stipulated in theMakefile
).