Skip to content

fix(release): publish patches from git tags - #3338

Open
pratap0007 wants to merge 2 commits into
tektoncd:mainfrom
pratap0007:fix-14364
Open

pratap0007 wants to merge 2 commits into
tektoncd:mainfrom
pratap0007:fix-14364

Conversation

@pratap0007

Copy link
Copy Markdown
Contributor

Stop patch releases from committing VERSION and pushing the protected release-vX.Y.x branch. Tag the branch tip, push release-vX.Y.Z, and choose the next patch from the highest existing tag so an unmerged tag is not reused. make still injects clientVersion from ldflags.

Assisted-by: Grok 4.7 (via Cursor)

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Oct 13, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from pratap0007 after the PR has been reviewed.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 13, 2026
@pratap0007

Copy link
Copy Markdown
Contributor Author

/retest

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Legacy VERSION files still override detected tags, causing Make builds to embed outdated client versions.

1 open finding
What changed in this PR

Moves patch releases toward tag-based versioning without updating protected maintenance branches.

Changes:

  • Stops committing VERSION during releases.
  • Adds git-derived version fallback for Make builds.
  • Selects patch numbers from the highest existing tag and pushes version-specific branches.
File Description
tekton/​release.sh Removes VERSION updates and release commits.
Makefile Adds git-tag fallback for client version injection.
.github/​workflows/​patch-release.yaml Updates patch numbering and tag/branch publication.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Makefile Resolved
@pratap0007

Copy link
Copy Markdown
Contributor Author

/retest

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Release source archives lack Git metadata, so builds can report an outdated version or dev unless an archive-readable version fallback is preserved.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread Makefile
Comment on lines +39 to +40
else ifneq (,$(wildcard ./VERSION))
VERSIONLDFLAG := -X github.com/tektoncd/cli/pkg/cmd/version.clientVersion=$(shell cat VERSION)
@divyansh42

Copy link
Copy Markdown
Member

@pratap0007 can we also delete those VERSION files from the release branches as well? I don't think it is required anymore.
Leaving it as it is might cause confusion in the future.

pratap0007 and others added 2 commits November 2, 2026 11:18
Swap version detection priority in Makefile to check GIT_VERSION
first, falling back to VERSION file only when no git tag exists.

Priority order: GIT_VERSION → VERSION file → RELEASE_VERSION

Signed-off-by: pratap0007 <shverma@redhat.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Release source archives downloaded from GitHub don't contain
.git metadata, causing version detection to fail. Add git's
export-subst mechanism to preserve tag information in archives.

Creates .git_archival.txt with a $Format:%D$ placeholder that
git-archive expands to include tag names. The Makefile now
extracts the version from this file when git commands fail,
ensuring correct version reporting when building from archives.

Fixes: tektoncd#3338 (comment)

Signed-off-by: pratap0007 <shverma@redhat.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The archive version expression can silently select an older release tag when multiple tags share a commit, causing binaries from a newer source archive to report the wrong version.

2 open issues

Review effort: Balanced

Comment thread Makefile

# Extract version from .git_archival.txt (populated by git-archive export-subst)
ARCHIVE_VERSION := $(shell if [ -f .git_archival.txt ]; then \
sed -n 's/^ref-names:.*tag: v\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' .git_archival.txt | head -n1; \
@pratap0007

Copy link
Copy Markdown
Contributor Author

/retest

@pratap0007

Copy link
Copy Markdown
Contributor Author

@pratap0007 can we also delete those VERSION files from the release branches as well? I don't think it is required anymore. Leaving it as it is might cause confusion in the future.

@divyansh42 should we delete later once patch release automation has been fixed?

@divyansh42

Copy link
Copy Markdown
Member

@pratap0007 can we also delete those VERSION files from the release branches as well? I don't think it is required anymore. Leaving it as it is might cause confusion in the future.

@divyansh42 should we delete later once patch release automation has been fixed?

Sure

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread .git_archival.txt
@@ -0,0 +1 @@
ref-names: $Format:%D$
if [ -z "$last_tag" ]; then
echo "::notice::Branch ${branch} has no tags — skipping (initial release handled by branch creation)"
# Latest release tag contained in this branch.
last_tag=$(git describe --tags --abbrev=0 --match "v${major}.${minor}.*" "$ref" 2>/dev/null || echo "")
# Next patch is one above the highest vX.Y.Z tag for this line.
# Tags that were pushed but never merged are invisible to describe,
# so v0.45.2 still advances to v0.45.3.
highest_tag=$(git tag -l "v${major}.${minor}.*" --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1)
git config user.email "tekton-robot@tektoncd.com"
git add VERSION
git commit -sm "New version ${RELEASE_VERSION}" || echo "No VERSION changes"
git tag -a "${RELEASE_VERSION}" -m "Release ${RELEASE_VERSION}"
Comment on lines 155 to +156
git push origin "${RELEASE_VERSION}"
git push origin "HEAD:${{ matrix.release.branch }}"
git push origin "HEAD:release-${RELEASE_VERSION}"
Comment thread Makefile
Comment on lines +31 to +35
GIT_VERSION := $(shell tag=$$(git describe --tags --exact-match --match 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null); \
if [ -z "$$tag" ]; then \
line=$$(git rev-parse --abbrev-ref HEAD 2>/dev/null | sed -n 's/^release-v\([0-9][0-9]*\.[0-9][0-9]*\)\.x$$/\1/p'); \
if [ -n "$$line" ]; then tag=$$(git describe --tags --abbrev=0 --match "v$$line.*" HEAD 2>/dev/null); fi; \
fi; printf '%s' "$$tag" | sed 's/^v//')
Comment thread Makefile

# Extract version from .git_archival.txt (populated by git-archive export-subst)
ARCHIVE_VERSION := $(shell if [ -f .git_archival.txt ]; then \
sed -n 's/^ref-names:.*tag: v\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' .git_archival.txt | head -n1; \
Comment thread tekton/release.sh
Comment on lines 106 to 108
git tag --sign -m \
"New version ${RELEASE_VERSION}" \
-m "${changelog}" --force ${RELEASE_VERSION}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants