Skip to content

build: use VERSION file for setting version#4093

Closed
zalimeni wants to merge 1 commit intomainfrom
zalimeni/shared-version-file
Closed

build: use VERSION file for setting version#4093
zalimeni wants to merge 1 commit intomainfrom
zalimeni/shared-version-file

Conversation

@zalimeni
Copy link
Copy Markdown
Member

@zalimeni zalimeni commented Jun 7, 2024

Adopt consul repo pattern for setting version to simplify management and build scripts.

Follow-up to #4091

This PR will require manual backporting due to differences in versions and potential diffs in build scripts.

Changes proposed in this PR

How I've tested this PR

How I expect reviewers to test this PR

Checklist

@zalimeni zalimeni added pr/no-changelog PR does not need a corresponding .changelog entry pr/no-backport signals that a PR will not contain a backport label labels Jun 7, 2024
@zalimeni zalimeni force-pushed the zalimeni/shared-version-file branch 2 times, most recently from 875e366 to fde96bc Compare June 7, 2024 20:52
Adopt `consul` repo pattern for setting version to simplify management
and build scripts.
@zalimeni zalimeni force-pushed the zalimeni/shared-version-file branch from fde96bc to 766c7c1 Compare June 7, 2024 20:56
Comment on lines -111 to +108
local vfile="${1}/version/version.go"
local vfile="${1:-.}/version/VERSION"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helps when running locally and sourcing scripts

Comment on lines -143 to -151
# try to determine the version if we have build tags
for tag in "$GOTAGS"; do
for vfile in $(find "${1}/version" -name "version_*.go" 2>/dev/null | sort); do
if grep -q "// +build $tag" "${vfile}"; then
version_main=$(awk '$1 == "Version" && $2 == "=" { gsub(/"/, "", $3); print $3 }' <${vfile})
release_main=$(awk '$1 == "VersionPrerelease" && $2 == "=" { gsub(/"/, "", $3); print $3 }' <${vfile})
fi
done
done
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was consul copypasta by Mitchell and never used from what I can see (we don't have any files that match those globs)

Comment on lines -119 to -122
local include_release="$2"
local use_git_env="$3"
local omit_version="$4"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were always true, false, and unset, respectively (2 uses of parse_version, both in 40-publish.sh)

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was never used and is redundant with make version

fi

local rel_ver=""
if is_set "${include_release}"; then
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always true, so removed as outer if

Comment on lines -164 to -168
# When no GIT_DESCRIBE env var is present and no release is in the source then we
# are definitely in dev mode
if test -z "${git_version}" -a -z "${rel_ver}" && is_set "${use_git_env}"; then
rel_ver="dev"
fi
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use_git_env was always false, so removed

@zalimeni zalimeni closed this Nov 4, 2025
@github-actions github-actions bot deleted the zalimeni/shared-version-file branch November 5, 2025 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/no-backport signals that a PR will not contain a backport label pr/no-changelog PR does not need a corresponding .changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant