Skip to content

Commit

Permalink
Add documentation around SOURCE_DATE_EPOCH
Browse files Browse the repository at this point in the history
  • Loading branch information
ixdy committed Apr 7, 2018
1 parent 489178d commit 67b6970
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,23 @@ In addition, there are some other tar files that are created:

When building final release tars, they are first staged into `_output/release-stage` before being tar'd up and put into `_output/release-tars`.

## Reproducibility
`make release`, its variant `make quick-release`, and Bazel all provide a
hermetic build environment which should provide some level of reproducibility
for builds. `make` itself is **not** hermetic.

The Kubernetes build environment supports the [`SOURCE_DATE_EPOCH` environment
variable](https://reproducible-builds.org/specs/source-date-epoch/) specified by
the Reproducible Builds project, which can be set to a UNIX epoch timestamp.
This will be used for the build timestamps embedded in compiled Go binaries,
and maybe someday also Docker images.

One reasonable setting for this variable is to use the commit timestamp from the
tip of the tree being built; this is what the Kubernetes CI system uses. For
example, you could use the following one-liner:

```bash
SOURCE_DATE_EPOCH=$(git show -s --format=format:%ct HEAD)
```

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/build/README.md?pixel)]()

0 comments on commit 67b6970

Please sign in to comment.