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

build: use VERSION file for setting version #4093

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zalimeni
Copy link
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
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
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
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
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


local version="${version_main}"
# override the version from source with the value of the GIT_DESCRIBE env var if present
if test -n "${git_version}"; then
version="${git_version}"
fi

local rel_ver=""
if is_set "${include_release}"; then
Copy link
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
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

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.

None yet

1 participant