mirror of https://github.com/k3s-io/k3s
Merge pull request #1237 from filbranden/release_docs
Document Kubernetes Release Processpull/6/head
commit
ffcfdd0e2d
|
@ -0,0 +1,113 @@
|
|||
// Build it with:
|
||||
// $ dot -Tsvg releasing.dot >releasing.svg
|
||||
|
||||
digraph tagged_release {
|
||||
size = "5,5"
|
||||
// Arrows go up.
|
||||
rankdir = BT
|
||||
subgraph left {
|
||||
// Group the left nodes together.
|
||||
ci012abc -> pr101 -> ci345cde -> pr102
|
||||
style = invis
|
||||
}
|
||||
subgraph right {
|
||||
// Group the right nodes together.
|
||||
version_commit -> dev_commit
|
||||
style = invis
|
||||
}
|
||||
{ // Align the version commit and the info about it.
|
||||
rank = same
|
||||
// Align them with pr101
|
||||
pr101
|
||||
version_commit
|
||||
// release_info shows the change in the commit.
|
||||
release_info
|
||||
}
|
||||
{ // Align the dev commit and the info about it.
|
||||
rank = same
|
||||
// Align them with 345cde
|
||||
ci345cde
|
||||
dev_commit
|
||||
dev_info
|
||||
}
|
||||
// Join the nodes from subgraph left.
|
||||
pr99 -> ci012abc
|
||||
pr102 -> pr100
|
||||
// Do the version node.
|
||||
pr99 -> version_commit
|
||||
dev_commit -> pr100
|
||||
tag -> version_commit
|
||||
pr99 [
|
||||
label = "Merge PR #99"
|
||||
shape = box
|
||||
fillcolor = "#ccccff"
|
||||
style = "filled"
|
||||
fontname = "Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"
|
||||
];
|
||||
ci012abc [
|
||||
label = "012abc"
|
||||
shape = circle
|
||||
fillcolor = "#ffffcc"
|
||||
style = "filled"
|
||||
fontname = "Consolas, Liberation Mono, Menlo, Courier, monospace"
|
||||
];
|
||||
pr101 [
|
||||
label = "Merge PR #101"
|
||||
shape = box
|
||||
fillcolor = "#ccccff"
|
||||
style = "filled"
|
||||
fontname = "Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"
|
||||
];
|
||||
ci345cde [
|
||||
label = "345cde"
|
||||
shape = circle
|
||||
fillcolor = "#ffffcc"
|
||||
style = "filled"
|
||||
fontname = "Consolas, Liberation Mono, Menlo, Courier, monospace"
|
||||
];
|
||||
pr102 [
|
||||
label = "Merge PR #102"
|
||||
shape = box
|
||||
fillcolor = "#ccccff"
|
||||
style = "filled"
|
||||
fontname = "Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"
|
||||
];
|
||||
version_commit [
|
||||
label = "678fed"
|
||||
shape = circle
|
||||
fillcolor = "#ccffcc"
|
||||
style = "filled"
|
||||
fontname = "Consolas, Liberation Mono, Menlo, Courier, monospace"
|
||||
];
|
||||
dev_commit [
|
||||
label = "456dcb"
|
||||
shape = circle
|
||||
fillcolor = "#ffffcc"
|
||||
style = "filled"
|
||||
fontname = "Consolas, Liberation Mono, Menlo, Courier, monospace"
|
||||
];
|
||||
pr100 [
|
||||
label = "Merge PR #100"
|
||||
shape = box
|
||||
fillcolor = "#ccccff"
|
||||
style = "filled"
|
||||
fontname = "Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"
|
||||
];
|
||||
release_info [
|
||||
label = "pkg/version/base.go:\ngitVersion = \"v0.5\";"
|
||||
shape = none
|
||||
fontname = "Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"
|
||||
];
|
||||
dev_info [
|
||||
label = "pkg/version/base.go:\ngitVersion = \"v0.5-dev\";"
|
||||
shape = none
|
||||
fontname = "Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"
|
||||
];
|
||||
tag [
|
||||
label = "$ git tag -a v0.5"
|
||||
fillcolor = "#ffcccc"
|
||||
style = "filled"
|
||||
fontname = "Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif"
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
# Releasing Kubernetes
|
||||
|
||||
This document explains how to create a Kubernetes release (as in version) and
|
||||
how the version information gets embedded into the built binaries.
|
||||
|
||||
## Origin of the Sources
|
||||
|
||||
Kubernetes may be built from either a git tree (using `hack/build-go.sh`) or
|
||||
from a tarball (using either `hack/build-go.sh` or `go install`) or directly by
|
||||
the Go native build system (using `go get`).
|
||||
|
||||
When building from git, we want to be able to insert specific information about
|
||||
the build tree at build time. In particular, we want to use the output of `git
|
||||
describe` to generate the version of Kubernetes and the status of the build
|
||||
tree (add a `-dirty` prefix if the tree was modified.)
|
||||
|
||||
When building from a tarball or using the Go build system, we will not have
|
||||
access to the information about the git tree, but we still want to be able to
|
||||
tell whether this build corresponds to an exact release (e.g. v0.3) or is
|
||||
between releases (e.g. at some point in development between v0.3 and v0.4).
|
||||
|
||||
## Version Number Format
|
||||
|
||||
In order to account for these use cases, there are some specific formats that
|
||||
may end up representing the Kubernetes version. Here are a few examples:
|
||||
|
||||
- **v0.5**: This is official version 0.5 and this version will only be used
|
||||
when building from a clean git tree at the v0.5 git tag, or from a tree
|
||||
extracted from the tarball corresponding to that specific release.
|
||||
- **v0.5-15-g0123abcd4567**: This is the `git describe` output and it indicates
|
||||
that we are 15 commits past the v0.5 release and that the SHA1 of the commit
|
||||
where the binaries were built was `0123abcd4567`. It is only possible to have
|
||||
this level of detail in the version information when building from git, not
|
||||
when building from a tarball.
|
||||
- **v0.5-15-g0123abcd4567-dirty** or **v0.5-dirty**: The extra `-dirty` prefix
|
||||
means that the tree had local modifications or untracked files at the time of
|
||||
the build, so there's no guarantee that the source code matches exactly the
|
||||
state of the tree at the `0123abcd4567` commit or at the `v0.5` git tag
|
||||
(resp.)
|
||||
- **v0.5-dev**: This means we are building from a tarball or using `go get` or,
|
||||
if we have a git tree, we are using `go install` directly, so it is not
|
||||
possible to inject the git version into the build information. Additionally,
|
||||
this is not an official release, so the `-dev` prefix indicates that the
|
||||
version we are building is after `v0.5` but before `v0.6`. (There is actually
|
||||
an exception where a commit with `v0.5-dev` is not present on `v0.6`, see
|
||||
later for details.)
|
||||
|
||||
## Injecting Version into Binaries
|
||||
|
||||
In order to cover the different build cases, we start by providing information
|
||||
that can be used when using only Go build tools or when we do not have the git
|
||||
version information available.
|
||||
|
||||
To be able to provide a meaningful version in those cases, we set the contents
|
||||
of variables in a Go source file that will be used when no overrides are
|
||||
present.
|
||||
|
||||
We are using `pkg/version/base.go` as the source of versioning in absence of
|
||||
information from git. Here is a sample of that file's contents:
|
||||
|
||||
```
|
||||
var (
|
||||
gitVersion string = "v0.4-dev" // version from git, output of $(git describe)
|
||||
gitCommit string = "" // sha1 from git, output of $(git rev-parse HEAD)
|
||||
)
|
||||
```
|
||||
|
||||
This means a build with `go install` or `go get` or a build from a tarball will
|
||||
yield binaries that will identify themselves as `v0.4-dev` and will not be able
|
||||
to provide you with a SHA1.
|
||||
|
||||
To add the extra versioning information when building from git, the
|
||||
`hack/build-go.sh` script will gather that information (using `git describe` and
|
||||
`git rev-parse`) and then create a `-ldflags` string to pass to `go install` and
|
||||
tell the Go linker to override the contents of those variables at build time. It
|
||||
can, for instance, tell it to override `gitVersion` and set it to
|
||||
`v0.4-13-g4567bcdef6789-dirty` and set `gitCommit` to `4567bcdef6789...` which
|
||||
is the complete SHA1 of the (dirty) tree used at build time.
|
||||
|
||||
## Handling Official Versions
|
||||
|
||||
Handling official versions from git is easy, as long as there is an annotated
|
||||
git tag pointing to a specific version then `git describe` will return that tag
|
||||
exactly which will match the idea of an official version (e.g. `v0.5`).
|
||||
|
||||
Handling it on tarballs is a bit harder since the exact version string must be
|
||||
present in `pkg/version/base.go` for it to get embedded into the binaries. But
|
||||
simply creating a commit with `v0.5` on its own would mean that the commits
|
||||
coming after it would also get the `v0.5` version when built from tarball or `go
|
||||
get` while in fact they do not match `v0.5` (the one that was tagged) exactly.
|
||||
|
||||
To handle that case, creating a new release should involve creating two adjacent
|
||||
commits where the first of them will set the version to `v0.5` and the second
|
||||
will set it to `v0.5-dev`. In that case, even in the presence of merges, there
|
||||
will be a single comit where the exact `v0.5` version will be used and all
|
||||
others around it will either have `v0.4-dev` or `v0.5-dev`.
|
||||
|
||||
The diagram below illustrates it.
|
||||
|
||||
![Diagram of git commits involved in the release](releasing.png)
|
||||
|
||||
After working on `v0.4-dev` and merging PR 99 we decide it is time to release
|
||||
`v0.5`. So we start a new branch, create one commit to update
|
||||
`pkg/version/base.go` to include `gitVersion = "v0.5"` and `git commit` it.
|
||||
|
||||
We test it and make sure everything is working as expected.
|
||||
|
||||
Before sending a PR for it, we create a second commit on that same branch,
|
||||
updating `pkg/version/base.go` to include `gitVersion = "v0.5-dev"`. That will
|
||||
ensure that further builds (from tarball or `go install`) on that tree will
|
||||
always include the `-dev` prefix and will not have a `v0.5` version (since they
|
||||
do not match the official `v0.5` exactly.)
|
||||
|
||||
We then send PR 100 with both commits in it.
|
||||
|
||||
Once the PR is accepted, we can use `git tag -a` to create an annotated tag
|
||||
*pointing to the one commit* that has `v0.5` in `pkg/version/base.go` and push
|
||||
it to GitHub. (Unfortunately GitHub tags/releases are not annotated tags, so
|
||||
this needs to be done from a git client and pushed to GitHub using SSH.)
|
||||
|
||||
## Parallel Commits
|
||||
|
||||
While we are working on releasing `v0.5`, other development takes place and
|
||||
other PRs get merged. For instance, in the example above, PRs 101 and 102 get
|
||||
merged to the master branch before the versioning PR gets merged.
|
||||
|
||||
This is not a problem, it is only slightly inaccurate that checking out the tree
|
||||
at commit `012abc` or commit `345cde` or at the commit of the merges of PR 101
|
||||
or 102 will yield a version of `v0.4-dev` *but* those commits are not present in
|
||||
`v0.5`.
|
||||
|
||||
In that sense, there is a small window in which commits will get a
|
||||
`v0.4-dev` or `v0.4-N-gXXX` label and while they're indeed later than `v0.4`
|
||||
but they are not really before `v0.5` in that `v0.5` does not contain those
|
||||
commits.
|
||||
|
||||
Unfortunately, there is not much we can do about it. On the other hand, other
|
||||
projects seem to live with that and it does not really become a large problem.
|
||||
|
||||
As an example, Docker commit a327d9b91edf has a `v1.1.1-N-gXXX` label but it is
|
||||
not present in Docker `v1.2.0`:
|
||||
|
||||
```
|
||||
$ git describe a327d9b91edf
|
||||
v1.1.1-822-ga327d9b91edf
|
||||
|
||||
$ git log --oneline v1.2.0..a327d9b91edf
|
||||
a327d9b91edf Fix data space reporting from Kb/Mb to KB/MB
|
||||
|
||||
(Non-empty output here means the commit is not present on v1.2.0.)
|
||||
```
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.36.0 (20140111.2315)
|
||||
-->
|
||||
<!-- Title: tagged_release Pages: 1 -->
|
||||
<svg width="257pt" height="360pt"
|
||||
viewBox="0.00 0.00 257.33 360.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(0.649819 0.649819) rotate(0) translate(4 550)">
|
||||
<title>tagged_release</title>
|
||||
<polygon fill="white" stroke="none" points="-4,4 -4,-550 392,-550 392,4 -4,4"/>
|
||||
<!-- ci012abc -->
|
||||
<g id="node1" class="node"><title>ci012abc</title>
|
||||
<ellipse fill="#ffffcc" stroke="black" cx="56" cy="-115" rx="42.7926" ry="42.7926"/>
|
||||
<text text-anchor="middle" x="56" y="-111.3" font-family="Consolas, Liberation Mono, Menlo, Courier, monospace" font-size="14.00">012abc</text>
|
||||
</g>
|
||||
<!-- pr101 -->
|
||||
<g id="node2" class="node"><title>pr101</title>
|
||||
<polygon fill="#ccccff" stroke="black" points="112,-255 0,-255 0,-219 112,-219 112,-255"/>
|
||||
<text text-anchor="middle" x="56" y="-233.3" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">Merge PR #101</text>
|
||||
</g>
|
||||
<!-- ci012abc->pr101 -->
|
||||
<g id="edge1" class="edge"><title>ci012abc->pr101</title>
|
||||
<path fill="none" stroke="black" d="M56,-157.97C56,-174.83 56,-193.784 56,-208.789"/>
|
||||
<polygon fill="black" stroke="black" points="52.5001,-208.93 56,-218.93 59.5001,-208.93 52.5001,-208.93"/>
|
||||
</g>
|
||||
<!-- ci345cde -->
|
||||
<g id="node3" class="node"><title>ci345cde</title>
|
||||
<ellipse fill="#ffffcc" stroke="black" cx="62" cy="-359" rx="42.7926" ry="42.7926"/>
|
||||
<text text-anchor="middle" x="62" y="-355.3" font-family="Consolas, Liberation Mono, Menlo, Courier, monospace" font-size="14.00">345cde</text>
|
||||
</g>
|
||||
<!-- pr101->ci345cde -->
|
||||
<g id="edge2" class="edge"><title>pr101->ci345cde</title>
|
||||
<path fill="none" stroke="black" d="M56.8597,-255.193C57.5237,-268.473 58.4796,-287.592 59.3874,-305.748"/>
|
||||
<polygon fill="black" stroke="black" points="55.904,-306.17 59.8991,-315.982 62.8953,-305.82 55.904,-306.17"/>
|
||||
</g>
|
||||
<!-- pr102 -->
|
||||
<g id="node4" class="node"><title>pr102</title>
|
||||
<polygon fill="#ccccff" stroke="black" points="129,-474 17,-474 17,-438 129,-438 129,-474"/>
|
||||
<text text-anchor="middle" x="73" y="-452.3" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">Merge PR #102</text>
|
||||
</g>
|
||||
<!-- ci345cde->pr102 -->
|
||||
<g id="edge3" class="edge"><title>ci345cde->pr102</title>
|
||||
<path fill="none" stroke="black" d="M66.8248,-401.668C67.8523,-410.542 68.9117,-419.692 69.8567,-427.853"/>
|
||||
<polygon fill="black" stroke="black" points="66.3936,-428.375 71.0207,-437.906 73.3472,-427.57 66.3936,-428.375"/>
|
||||
</g>
|
||||
<!-- pr100 -->
|
||||
<g id="node10" class="node"><title>pr100</title>
|
||||
<polygon fill="#ccccff" stroke="black" points="174,-546 62,-546 62,-510 174,-510 174,-546"/>
|
||||
<text text-anchor="middle" x="118" y="-524.3" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">Merge PR #100</text>
|
||||
</g>
|
||||
<!-- pr102->pr100 -->
|
||||
<g id="edge6" class="edge"><title>pr102->pr100</title>
|
||||
<path fill="none" stroke="black" d="M84.1236,-474.303C89.355,-482.441 95.6999,-492.311 101.478,-501.299"/>
|
||||
<polygon fill="black" stroke="black" points="98.6526,-503.377 107.004,-509.896 104.541,-499.591 98.6526,-503.377"/>
|
||||
</g>
|
||||
<!-- version_commit -->
|
||||
<g id="node5" class="node"><title>version_commit</title>
|
||||
<ellipse fill="#ccffcc" stroke="black" cx="173" cy="-237" rx="42.7926" ry="42.7926"/>
|
||||
<text text-anchor="middle" x="173" y="-233.3" font-family="Consolas, Liberation Mono, Menlo, Courier, monospace" font-size="14.00">678fed</text>
|
||||
</g>
|
||||
<!-- dev_commit -->
|
||||
<g id="node6" class="node"><title>dev_commit</title>
|
||||
<ellipse fill="#ffffcc" stroke="black" cx="169" cy="-359" rx="42.7926" ry="42.7926"/>
|
||||
<text text-anchor="middle" x="169" y="-355.3" font-family="Consolas, Liberation Mono, Menlo, Courier, monospace" font-size="14.00">456dcb</text>
|
||||
</g>
|
||||
<!-- version_commit->dev_commit -->
|
||||
<g id="edge4" class="edge"><title>version_commit->dev_commit</title>
|
||||
<path fill="none" stroke="black" d="M171.601,-279.97C171.322,-288.326 171.027,-297.195 170.739,-305.844"/>
|
||||
<polygon fill="black" stroke="black" points="167.24,-305.74 170.405,-315.851 174.236,-305.973 167.24,-305.74"/>
|
||||
</g>
|
||||
<!-- dev_commit->pr100 -->
|
||||
<g id="edge8" class="edge"><title>dev_commit->pr100</title>
|
||||
<path fill="none" stroke="black" d="M158.36,-400.568C152.438,-422.433 144.719,-449.815 137,-474 134.253,-482.606 131.013,-491.906 127.994,-500.278"/>
|
||||
<polygon fill="black" stroke="black" points="124.616,-499.325 124.47,-509.919 131.191,-501.729 124.616,-499.325"/>
|
||||
</g>
|
||||
<!-- release_info -->
|
||||
<g id="node7" class="node"><title>release_info</title>
|
||||
<text text-anchor="middle" x="304" y="-240.8" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">pkg/version/base.go:</text>
|
||||
<text text-anchor="middle" x="304" y="-225.8" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">gitVersion = "v0.5";</text>
|
||||
</g>
|
||||
<!-- dev_info -->
|
||||
<g id="node8" class="node"><title>dev_info</title>
|
||||
<text text-anchor="middle" x="309" y="-362.8" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">pkg/version/base.go:</text>
|
||||
<text text-anchor="middle" x="309" y="-347.8" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">gitVersion = "v0.5-dev";</text>
|
||||
</g>
|
||||
<!-- pr99 -->
|
||||
<g id="node9" class="node"><title>pr99</title>
|
||||
<polygon fill="#ccccff" stroke="black" points="143,-36 39,-36 39,-0 143,-0 143,-36"/>
|
||||
<text text-anchor="middle" x="91" y="-14.3" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">Merge PR #99</text>
|
||||
</g>
|
||||
<!-- pr99->ci012abc -->
|
||||
<g id="edge5" class="edge"><title>pr99->ci012abc</title>
|
||||
<path fill="none" stroke="black" d="M84.5805,-36.4245C81.5586,-44.6267 77.7879,-54.8615 73.9865,-65.1795"/>
|
||||
<polygon fill="black" stroke="black" points="70.6804,-64.0292 70.5075,-74.6226 77.2488,-66.4492 70.6804,-64.0292"/>
|
||||
</g>
|
||||
<!-- pr99->version_commit -->
|
||||
<g id="edge7" class="edge"><title>pr99->version_commit</title>
|
||||
<path fill="none" stroke="black" d="M97.4344,-36.0276C109.585,-68.1826 136.317,-138.924 154.498,-187.038"/>
|
||||
<polygon fill="black" stroke="black" points="151.318,-188.523 158.127,-196.64 157.866,-186.048 151.318,-188.523"/>
|
||||
</g>
|
||||
<!-- tag -->
|
||||
<g id="node11" class="node"><title>tag</title>
|
||||
<ellipse fill="#ffcccc" stroke="black" cx="226" cy="-115" rx="71.4873" ry="18"/>
|
||||
<text text-anchor="middle" x="226" y="-111.3" font-family="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" font-size="14.00">$ git tag -a v0.5</text>
|
||||
</g>
|
||||
<!-- tag->version_commit -->
|
||||
<g id="edge9" class="edge"><title>tag->version_commit</title>
|
||||
<path fill="none" stroke="black" d="M218.519,-132.939C212.168,-147.318 202.736,-168.673 194.103,-188.22"/>
|
||||
<polygon fill="black" stroke="black" points="190.784,-187.071 189.946,-197.632 197.188,-189.899 190.784,-187.071"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 7.1 KiB |
Loading…
Reference in New Issue