Skip to content

add --check-tag option#4051

Draft
hatyo wants to merge 1 commit intoFoundationDB:mainfrom
hatyo:check-tag-when-update-version
Draft

add --check-tag option#4051
hatyo wants to merge 1 commit intoFoundationDB:mainfrom
hatyo:check-tag-when-update-version

Conversation

@hatyo
Copy link
Copy Markdown
Contributor

@hatyo hatyo commented Apr 7, 2026

this option can be used to reject version bumps that conflict with existing remote tags. When --check-tag is passed, versionutils now queries remote tags via git ls-remote before proceeding, and aborts if the new version already exists as a tag.

This prevents accidentally re-releasing an existing version.

this option can be used to reject version bumps that conflict with existing remote tags.
When --check-tag is passed, versionutils now queries remote tags via git ls-remote before
proceeding, and aborts if the new version already exists as a tag.

This prevents accidentally re-releasing an existing version.
@hatyo hatyo added the build improvement Improvement to the build system label Apr 7, 2026
@hatyo hatyo changed the title add --check-tag option add --check-tag option Apr 7, 2026
Comment thread build/versionutils.py
if args.increment:
new_version = update_version(args.filename, args.update_type)

if args.check_tag:
Copy link
Copy Markdown
Contributor Author

@hatyo hatyo Apr 7, 2026

Choose a reason for hiding this comment

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

if we think this is ok, we can invoke versionutils.py with the new --check-tag parameter in .github/workflows/release.yml.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, that sounds fine. I left a comment about the actual mechanics, but if that's addressed, modifying the release.yml to do this seems fine. It seems like the worst that happens is that we block some releases that we didn't need to, at which point we just remove the check and retry

Comment thread build/versionutils.py
Comment on lines +92 to +93
# limit search to tags >= 4.x
remote_tags = subprocess.check_output(['git', 'ls-remote', '--tags', 'upstream', 'refs/tags/4.*'], text=True)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why limit the search to 4.x tags? And won't this cause problems when we update the major version?

Could this instead be:

Suggested change
# limit search to tags >= 4.x
remote_tags = subprocess.check_output(['git', 'ls-remote', '--tags', 'upstream', 'refs/tags/4.*'], text=True)
remote_tags = subprocess.check_output(['git', 'ls-remote', '--tags', 'upstream', 'refs/tags/{tag}*'], text=True)

Then I think it would look more precisely for tags with the right contents. I think you could then just base the response on whether the list was empty or not.

But also, I don't think we actually have access to a remote repository called upstream in CI. I think what we may actually want is:

Suggested change
# limit search to tags >= 4.x
remote_tags = subprocess.check_output(['git', 'ls-remote', '--tags', 'upstream', 'refs/tags/4.*'], text=True)
existing_tags = subprocess.check_output(['git', 'tag', '-l', '{tag}*'], text=True)

We need to then double check in the places where we invoke the checkout action that we specify fetch-tags: true so that this check works. See: https://github.com/actions/checkout?tab=readme-ov-file#usage

Comment thread build/versionutils.py
if args.increment:
new_version = update_version(args.filename, args.update_type)

if args.check_tag:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, that sounds fine. I left a comment about the actual mechanics, but if that's addressed, modifying the release.yml to do this seems fine. It seems like the worst that happens is that we block some releases that we didn't need to, at which point we just remove the check and retry

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

Labels

build improvement Improvement to the build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants