Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0269e2ba
Commit
0269e2ba
authored
Jul 31, 2015
by
Mike Danese
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11941 from GoogleCloudPlatform/enact_version_md
Enacting versioning.md
parents
e58ea24d
4363f14e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
35 deletions
+52
-35
mark-new-version.sh
build/mark-new-version.sh
+15
-21
version.sh
hack/lib/version.sh
+8
-0
.gitattributes
pkg/version/.gitattributes
+1
-0
base.go
pkg/version/base.go
+28
-14
No files found.
build/mark-new-version.sh
View file @
0269e2ba
...
@@ -52,6 +52,7 @@ fi
...
@@ -52,6 +52,7 @@ fi
release_branch
=
"release-
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
"
release_branch
=
"release-
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
"
current_branch
=
$(
git rev-parse
--abbrev-ref
HEAD
)
current_branch
=
$(
git rev-parse
--abbrev-ref
HEAD
)
head_commit
=
$(
git rev-parse
--short
HEAD
)
if
[[
"
${
VERSION_PATCH
}
"
!=
"0"
]]
;
then
if
[[
"
${
VERSION_PATCH
}
"
!=
"0"
]]
;
then
# sorry, no going back in time, pull latest from upstream
# sorry, no going back in time, pull latest from upstream
...
@@ -93,15 +94,13 @@ echo "+++ Running ./versionize-docs"
...
@@ -93,15 +94,13 @@ echo "+++ Running ./versionize-docs"
${
KUBE_ROOT
}
/build/versionize-docs.sh
${
NEW_VERSION
}
${
KUBE_ROOT
}
/build/versionize-docs.sh
${
NEW_VERSION
}
git commit
-am
"Versioning docs and examples for
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
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"
VERSION_FILE
=
"
${
KUBE_ROOT
}
/pkg/version/base.go"
GIT_MINOR
=
"
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
GIT_MINOR
=
"
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
echo
"+++ Updating to
${
NEW_VERSION
}
"
echo
"+++ Updating to
${
NEW_VERSION
}
"
$SED
-ri
-e
"s/gitMajor
\s
+string =
\"
[^
\"
]*
\"
/gitMajor string =
\"
${
VERSION_MAJOR
}
\"
/"
"
${
VERSION_FILE
}
"
$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/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
}
"
gofmt
-s
-w
"
${
VERSION_FILE
}
"
echo
"+++ Committing version change"
echo
"+++ Committing version change"
...
@@ -110,35 +109,30 @@ git commit -m "Kubernetes version $NEW_VERSION"
...
@@ -110,35 +109,30 @@ git commit -m "Kubernetes version $NEW_VERSION"
echo
"+++ Tagging version"
echo
"+++ Tagging version"
git tag
-a
-m
"Kubernetes version
$NEW_VERSION
"
"
${
NEW_VERSION
}
"
git tag
-a
-m
"Kubernetes version
$NEW_VERSION
"
"
${
NEW_VERSION
}
"
newtag
=
$(
git rev-parse
--short
HEAD
)
echo
"+++ Updating to
${
NEW_VERSION
}
-dev"
if
[[
"
${
VERSION_PATCH
}
"
==
"0"
]]
;
then
$SED
-ri
-e
"s/gitMajor
\s
+string =
\"
[^
\"
]*
\"
/gitMajor string =
\"
${
VERSION_MAJOR
}
\"
/"
"
${
VERSION_FILE
}
"
declare
-r
alpha_ver
=
"v
${
VERSION_MAJOR
}
.
$((${
VERSION_MINOR
}
+
1
))
.0-alpha.0"
$SED
-ri
-e
"s/gitMinor
\s
+string =
\"
[^
\"
]*
\"
/gitMinor string =
\"
${
GIT_MINOR
}
\+\"
/"
"
${
VERSION_FILE
}
"
git tag
-a
-m
"Kubernetes pre-release branch
${
alpha
-ver
}
"
"
${
alpha_ver
}
"
"
${
head_commit
}
"
$SED
-ri
-e
"s/gitVersion
\s
+string =
\"
[^
\"
]*
\"
/gitVersion string =
\"
$NEW_VERSION
-dev
\"
/"
"
${
VERSION_FILE
}
"
fi
gofmt
-s
-w
"
${
VERSION_FILE
}
"
echo
"+++ Committing version change"
git add
"
${
VERSION_FILE
}
"
git commit
-m
"Kubernetes version
${
NEW_VERSION
}
-dev"
echo
""
echo
""
echo
"Success you must now:"
echo
"Success you must now:"
echo
""
echo
""
echo
"- Push the tag:"
echo
"- Push the tag:"
echo
" git push
${
push_url
}
v
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_PATCH
}
"
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
if
[[
"
${
VERSION_PATCH
}
"
==
"0"
]]
;
then
echo
"-
Send branch:
${
current_branch
}
as a PR to
${
push_url
}
/master
"
echo
"-
Push the alpha tag:
"
echo
"
For major/minor releases, this gets the branch tag merged and changes the version numbers.
"
echo
"
git push
${
push_url
}
${
alpha_ver
}
"
echo
"- Push the new release branch:"
echo
"- Push the new release branch:"
echo
" git push
${
push_url
}
${
current_branch
}
:
${
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
else
echo
"- Send branch:
${
current_branch
}
as a PR to
${
release_branch
}
<-- NOTE THIS"
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
fi
hack/lib/version.sh
View file @
0269e2ba
...
@@ -50,6 +50,13 @@ kube::version::get_version_vars() {
...
@@ -50,6 +50,13 @@ kube::version::get_version_vars() {
# Use git describe to find the version based on annotated tags.
# Use git describe to find the version based on annotated tags.
if
[[
-n
${
KUBE_GIT_VERSION
-
}
]]
||
KUBE_GIT_VERSION
=
$(
"
${
git
[@]
}
"
describe
--tags
--abbrev
=
14
"
${
KUBE_GIT_COMMIT
}
^{commit}"
2>/dev/null
)
;
then
if
[[
-n
${
KUBE_GIT_VERSION
-
}
]]
||
KUBE_GIT_VERSION
=
$(
"
${
git
[@]
}
"
describe
--tags
--abbrev
=
14
"
${
KUBE_GIT_COMMIT
}
^{commit}"
2>/dev/null
)
;
then
# This translates the "git describe" to an actual semver.org
# compatible semantic version that looks something like this:
# v1.1.0-alpha.0.6+84c76d1142ea4d
#
# TODO: We continue calling this "git version" because so many
# downstream consumers are expecting it there.
KUBE_GIT_VERSION
=
$(
echo
"
${
KUBE_GIT_VERSION
}
"
|
sed
"s/-
\(
[0-9]
\{
1,
\}\)
-g
\(
[0-9a-f]
\{
14
\}\)
$/
.
\1\+\2
/"
)
if
[[
"
${
KUBE_GIT_TREE_STATE
}
"
==
"dirty"
]]
;
then
if
[[
"
${
KUBE_GIT_TREE_STATE
}
"
==
"dirty"
]]
;
then
# git describe --dirty only considers changes to existing files, but
# git describe --dirty only considers changes to existing files, but
# that is problematic since new untracked .go files affect the build,
# that is problematic since new untracked .go files affect the build,
...
@@ -57,6 +64,7 @@ kube::version::get_version_vars() {
...
@@ -57,6 +64,7 @@ kube::version::get_version_vars() {
KUBE_GIT_VERSION+
=
"-dirty"
KUBE_GIT_VERSION+
=
"-dirty"
fi
fi
# Try to match the "git describe" output to a regex to try to extract
# Try to match the "git describe" output to a regex to try to extract
# the "major" and "minor" versions and whether this is the exact tagged
# the "major" and "minor" versions and whether this is the exact tagged
# version or whether the tree is between two tagged versions.
# version or whether the tree is between two tagged versions.
...
...
pkg/version/.gitattributes
0 → 100644
View file @
0269e2ba
base.go export-subst
pkg/version/base.go
View file @
0269e2ba
...
@@ -23,21 +23,35 @@ package version
...
@@ -23,21 +23,35 @@ package version
// version for ad-hoc builds (e.g. `go build`) that cannot get the version
// version for ad-hoc builds (e.g. `go build`) that cannot get the version
// information from git.
// information from git.
//
//
//
The "-dev" suffix in the version info indicates that fact, and it means the
//
If you are looking at these fields in the git tree, they look
//
current build is from a version greater that version. For example, v0.7-dev
//
strange. They are modified on the fly by the build process. The
//
means version > 0.7 and < 0.8. (There's exceptions to this rule, see
//
in-tree values are dummy values used for "git archive", which also
//
docs/releasing.md for more details.)
//
works for GitHub tar downloads.
//
//
// When releasing a new Kubernetes version, this file
should be updated to
// When releasing a new Kubernetes version, this file
is updated by
//
reflect the new version, and then a git annotated tag (using format vX.Y
//
build/mark_new_version.sh to reflect the new version, and then a
//
where X == Major version and Y == Minor version) should be created to point
//
git annotated tag (using format vX.Y where X == Major version and Y
//
to the commit that updates pkg/version/base.go
//
== Minor version) is created to point to the commit that updates
// pkg/version/base.go
var
(
var
(
// TODO: Deprecate gitMajor and gitMinor, use only gitVersion instead.
// TODO: Deprecate gitMajor and gitMinor, use only gitVersion
gitMajor
string
=
"1"
// major version, always numeric
// instead. First step in deprecation, keep the fields but make
gitMinor
string
=
"0.0+"
// minor version, numeric possibly followed by "+"
// them irrelevant. (Next we'll take it out, which may muck with
gitVersion
string
=
"v1.0.0-dev"
// version from git, output of $(git describe)
// scripts consuming the kubectl version output - but most of
gitCommit
string
=
""
// sha1 from git, output of $(git rev-parse HEAD)
// these should be looking at gitVersion already anyways.)
gitMajor
string
=
""
// major version, always numeric
gitMinor
string
=
""
// minor version, numeric possibly followed by "+"
// semantic version, dervied by build scripts (see
// https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/design/versioning.md
// for a detailed discussion of this field)
//
// TODO: This field is still called "gitVersion" for legacy
// reasons. For prerelease versions, the build metadata on the
// semantic version is a git hash, but the version itself is no
// longer the direct output of "git describe", but a slight
// translation to be semver compliant.
gitVersion
string
=
"v0.0.0-master+$Format:%h$"
gitCommit
string
=
"$Format:%H$"
// sha1 from git, output of $(git rev-parse HEAD)
gitTreeState
string
=
"not a git tree"
// state of git tree, either "clean" or "dirty"
gitTreeState
string
=
"not a git tree"
// state of git tree, either "clean" or "dirty"
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment