Enacting versioning.md
This PR changes how we version going forward in the following ways: * mark-new-version.sh is changed to a new policy of just splitting branches, rather than the old backmerge policy, as discussed in vX.Y.0, and a tag for vX.(Y+1).0-alpha.0 back to master. * I eliminated PRs back to master by making the version/base.go gitVersion and gitCommit just be `export-subst`. I testing that this works with GitHub's source export tarballs. There's no reason to bother with forcing the version into `base.go` (especially twice). The tarball versions outside a git tree aren't perfect (master looks like "v0.0.0+hash", and the release branches look more accurate), but our build contract has never allowed that version is perfect in this situation, so I think we can relax this. * That master tag gets picked up by "git describe" on master, so e.g. master would have immediately become v1.1.0-alpha.0 * In order to be more semVer compatible, the gitVersion field for the master branch now looks something like 1.1.0-alpha.0.6+84c76d1142ea4d. This is a tiny translation of the "git describe". I did this because there are a ton of consumers out there of the "gitVersion" field expecting it to be the full version, but it would be nice if this field were actually semver compliant. (1.1.0-alpha.0-6-84c76d1142ea4d is, but it's not *usefully* so.) Fixes #11495
This commit is contained in:
@@ -52,6 +52,7 @@ fi
|
||||
|
||||
release_branch="release-${VERSION_MAJOR}.${VERSION_MINOR}"
|
||||
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
head_commit=$(git rev-parse --short HEAD)
|
||||
|
||||
if [[ "${VERSION_PATCH}" != "0" ]]; then
|
||||
# sorry, no going back in time, pull latest from upstream
|
||||
@@ -93,15 +94,13 @@ echo "+++ Running ./versionize-docs"
|
||||
${KUBE_ROOT}/build/versionize-docs.sh ${NEW_VERSION}
|
||||
git commit -am "Versioning docs and examples for ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
|
||||
|
||||
dochash=$(git log -n1 --format=%H)
|
||||
|
||||
VERSION_FILE="${KUBE_ROOT}/pkg/version/base.go"
|
||||
|
||||
GIT_MINOR="${VERSION_MINOR}.${VERSION_PATCH}"
|
||||
echo "+++ Updating to ${NEW_VERSION}"
|
||||
$SED -ri -e "s/gitMajor\s+string = \"[^\"]*\"/gitMajor string = \"${VERSION_MAJOR}\"/" "${VERSION_FILE}"
|
||||
$SED -ri -e "s/gitMinor\s+string = \"[^\"]*\"/gitMinor string = \"${GIT_MINOR}\"/" "${VERSION_FILE}"
|
||||
$SED -ri -e "s/gitVersion\s+string = \"[^\"]*\"/gitVersion string = \"$NEW_VERSION\"/" "${VERSION_FILE}"
|
||||
$SED -ri -e "s/gitVersion\s+string = \"[^\"]*\"/gitVersion string = \"$NEW_VERSION-${release_branch}+\$Format:%h\$\"/" "${VERSION_FILE}"
|
||||
gofmt -s -w "${VERSION_FILE}"
|
||||
|
||||
echo "+++ Committing version change"
|
||||
@@ -110,35 +109,30 @@ git commit -m "Kubernetes version $NEW_VERSION"
|
||||
|
||||
echo "+++ Tagging version"
|
||||
git tag -a -m "Kubernetes version $NEW_VERSION" "${NEW_VERSION}"
|
||||
newtag=$(git rev-parse --short HEAD)
|
||||
|
||||
echo "+++ Updating to ${NEW_VERSION}-dev"
|
||||
$SED -ri -e "s/gitMajor\s+string = \"[^\"]*\"/gitMajor string = \"${VERSION_MAJOR}\"/" "${VERSION_FILE}"
|
||||
$SED -ri -e "s/gitMinor\s+string = \"[^\"]*\"/gitMinor string = \"${GIT_MINOR}\+\"/" "${VERSION_FILE}"
|
||||
$SED -ri -e "s/gitVersion\s+string = \"[^\"]*\"/gitVersion string = \"$NEW_VERSION-dev\"/" "${VERSION_FILE}"
|
||||
gofmt -s -w "${VERSION_FILE}"
|
||||
|
||||
echo "+++ Committing version change"
|
||||
git add "${VERSION_FILE}"
|
||||
git commit -m "Kubernetes version ${NEW_VERSION}-dev"
|
||||
if [[ "${VERSION_PATCH}" == "0" ]]; then
|
||||
declare -r alpha_ver="v${VERSION_MAJOR}.$((${VERSION_MINOR}+1)).0-alpha.0"
|
||||
git tag -a -m "Kubernetes pre-release branch ${alpha-ver}" "${alpha_ver}" "${head_commit}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Success you must now:"
|
||||
echo ""
|
||||
echo "- Push the tag:"
|
||||
echo " git push ${push_url} v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
|
||||
echo " - Please note you are pushing the tag live BEFORE your PRs."
|
||||
echo " You need this so the builds pick up the right tag info (and so your reviewers can see it)."
|
||||
echo " If something goes wrong further down please fix the tag!"
|
||||
echo " Either delete this tag and give up, fix the tag before your next PR,"
|
||||
echo " or find someone who can help solve the tag problem!"
|
||||
echo ""
|
||||
|
||||
if [[ "${VERSION_PATCH}" == "0" ]]; then
|
||||
echo "- Send branch: ${current_branch} as a PR to ${push_url}/master"
|
||||
echo " For major/minor releases, this gets the branch tag merged and changes the version numbers."
|
||||
echo "- Push the alpha tag:"
|
||||
echo " git push ${push_url} ${alpha_ver}"
|
||||
echo "- Push the new release branch:"
|
||||
echo " git push ${push_url} ${current_branch}:${release_branch}"
|
||||
echo "- DO NOTHING TO MASTER. You were done with master when you pushed the alpha tag."
|
||||
else
|
||||
echo "- Send branch: ${current_branch} as a PR to ${release_branch} <-- NOTE THIS"
|
||||
echo " Get someone to review and merge that PR"
|
||||
echo "- In the contents of the PR, include the PRs in the release:"
|
||||
echo " hack/cherry_pick_list.sh ${current_branch}^1"
|
||||
echo " This helps cross-link PRs to patch releases they're part of in GitHub."
|
||||
echo "- Have someone review the PR. This is a mechanical review to ensure it contains"
|
||||
echo " the ${NEW_VERSION} commit, which was tagged at ${newtag}."
|
||||
fi
|
||||
|
Reference in New Issue
Block a user