Skip to content

Reproducible builds #70131

@dims

Description

@dims
Member

From @dims on September 21, 2018 21:4

Please see https://reproducible-builds.org/ specifically https://reproducible-builds.org/docs/ on ideas about how to do deterministic builds. When we get a chance, we should try to examine how far away we are from this goal and what our blockers are.

Thanks,
Dims

Copied from original issue: kubernetes/release#637

Activity

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

From @ixdy on September 21, 2018 21:54

@bmwiedemann has done some work on this already in #48710.

For more increased reproducibility, we should probably be setting SOURCE_DATE_EPOCH in release builds (we already do this in CI), though there are still a few other bits missing.

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor
dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

@bmwiedemann i can't seem to tell if the results are from the latest k8s releases. if not is there a way to trigger these for say the v1.12-rc1 please?

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

From @bmwiedemann on September 22, 2018 20:2

openSUSE's diff is from 1.11.1 (and we do have SOURCE_DATE_EPOCH set)

Going to 1.12 is not that easy, because my reproducibility-test tools are designed around building of packages and there are usually so many changes and build is so slow (~20 minutes per try) that it can take hours to get right.

However, IMHO it would be a good start to find out if and how the two known issues in 1.11.1 have been addressed. If there are patches, I could apply them to 1.11.1 and see if anything remains there.

I'd prefer to not have to chase the master branch.

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

gotcha thanks @bmwiedemann

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

@bmwiedemann please see #68983 to see if it fixes the man page issue

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

On the buildid problem, looks like we may have to wait for next versions of golang:
golang/go#16860

See for example how others are trying to think about the same problem:

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

We need to update k/release anago scripts to set SOURCE_DATE_EPOCH and save the information somewhere (in generated tarballs? release notes?)

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

From @bmwiedemann on September 26, 2018 4:30

regarding random build-ids:
https://blog.filippo.io/reproducing-go-binaries-byte-by-byte/ seems to imply that it is already possible to generate reproducible go binaries and indeed our openSUSE "docker" package is already reproducible (we always build in the same path)

strace showed me

execve("/usr/lib64/go/1.10/pkg/tool/linux_amd64/compile", ["/usr/lib64/go/1.10/pkg/tool/linux_amd64/compile", "-o", "/tmp/go-build336594203/b073/pkg.a", "-trimpath", "/tmp/go-build336594203/b073", "-p", "k8s.io/kubernetes/vendor/k8s.io/gengo/examples/set-gen/sets", "-complete", "-buildid", "SUvgWqVQmIZMGMbPSYtX/SUvgWqVQmIZMGMbPSYtX", "-goversion", "go1.10.3", "-D", "", "-importcfg", "/tmp/go-build336594203/b073/importcfg", "-pack", "-c=4", "/home/abuild/rpmbuild/BUILD/kubernetes-1.11.1/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/gengo/examples/set-gen/sets/byte.go", "/home/abuild/rpmbuild/BUILD/kubernetes-1.11.1/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/gengo/examples/set-gen/sets/doc.go", "/home/abuild/rpmbuild/BUILD/kubernetes-1.11.1/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/gengo/examples/set-gen/sets/empty.go", "/home/abuild/rpmbuild/BUILD/kubernetes-1.11.1/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/gengo/examples/set-gen/sets/int.go", "/home/abuild/rpmbuild/BUILD/kubernetes-1.11.1/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/gengo/examples/set-gen/sets/int64.go", "/home/abuild/rpmbuild/BUILD/kubernetes-1.11.1/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/gengo/examples/set-gen/sets/string.go"],

so my guess is that a part of the build system generates explicit random buildids instead of using something reproducible (e.g. a constant or the shasum of the source(s))
Maybe go would even do the right thing (like gcc) when no buildid is given?

dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

@bmwiedemann i could get reproducible builds with latest master. PR is here. here's what i had to do.

  • make quick-release builds stuff inside a docker container, so we control a lot of the things including go version, paths etc.

But that was not enough. then i had to add trimpath

And then added -s -w to remove the symbol table

and finally pass the SOURCE_DATE_EPOCH into the container where the builds happen.

Finally tested the build process under my laptop (MacOS) and ubuntu and verified the build id of the kubeadm binary.

added
needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
on Oct 23, 2018
dims

dims commented on Oct 23, 2018

@dims
MemberAuthor

/sig release

added
sig/releaseCategorizes an issue or PR as relevant to SIG Release.
and removed
needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.
on Oct 23, 2018

61 remaining items

BenTheElder

BenTheElder commented on Nov 19, 2020

@BenTheElder
Member

@dims should we stop zero-ing out the buildid now?

dims

dims commented on Nov 19, 2020

@dims
MemberAuthor

possibly @BenTheElder but we have to verify :(

saschagrunert

saschagrunert commented on Apr 22, 2021

@saschagrunert
Member

@dims should we stop zero-ing out the buildid now?

May I ask why?

dims

dims commented on Apr 22, 2021

@dims
MemberAuthor

@saschagrunert apparently there are fixes in golang compiler itself to better compute the buildid, so we should check it out when we have time.

BenTheElder

BenTheElder commented on Apr 22, 2021

@BenTheElder
Member

the buildid is a cache key, and the buildid should be reproducible now I think. but we need to confirm. I thought we'd checked that in KIND but it seems we're still zero-ing it.

saschagrunert

saschagrunert commented on Apr 23, 2021

@saschagrunert
Member

Got it, did some research and proposed the change: #101411

reopened this on Oct 1, 2022
added
needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.
on Oct 1, 2022
k8s-ci-robot

k8s-ci-robot commented on Oct 1, 2022

@k8s-ci-robot
Contributor

@dims: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

dims

dims commented on Jun 12, 2023

@dims
MemberAuthor

/close

please reopen if needed @bmwiedemann

k8s-ci-robot

k8s-ci-robot commented on Jun 12, 2023

@k8s-ci-robot
Contributor

@dims: Closing this issue.

In response to this:

/close

please reopen if needed @bmwiedemann

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.sig/releaseCategorizes an issue or PR as relevant to SIG Release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @praseodym@dims@justaugustus@bmwiedemann@saschagrunert

      Issue actions

        Reproducible builds · Issue #70131 · kubernetes/kubernetes