Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward SOURCE_DATE_EPOCH to embedded k8s binaries #3542

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

twz123
Copy link
Member

@twz123 twz123 commented Oct 2, 2023

Description

Make it possible for embedded binaries to pick up the SOURCE_DATE_EPOCH with which k0s is built. If supported, the embedded binaries will display the same build date as the k0s binary.

Currently, only Kubernetes binaries will get the timestamp. It still needs to be checked what other binaries embed the build date.

Also remove some Go build flags that get added by default in the Kubernetes build.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist:

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@twz123 twz123 added the chore label Oct 2, 2023
@twz123 twz123 requested a review from a team as a code owner October 2, 2023 09:05
Make it possible for embedded binaries to pick up the SOURCE_DATE_EPOCH
with which k0s is built. If supported, the embedded binaries will
display the same build date as the k0s binary.

Currently, only Kubernetes binaries will get the timestamp. It still
needs to be checked what other binaries embed the build date.

Also remove some Go build flags that get added by default in the
Kubernetes build.

Signed-off-by: Tom Wieczorek <[email protected]>
@twz123 twz123 force-pushed the embedded-bins-source-date-epoch branch from 615ddc8 to aa15d1e Compare October 2, 2023 09:51
export FORCE_HOST_GO=y; \
export KUBE_VERBOSE=9; \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a deliberate change or is something that you commited accidentally? I'm not against it but I find this line surprising.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this prints out the arguments for the build, which is quite handy and is what I used to verify that the build picks up a custom SOURCE_DATE_EPOCH:

https://github.com/k0sproject/k0s/actions/runs/6378582878/job/17309435491?pr=3542#step:7:11718

Building binaries with GCFLAGS=all=-trimpath=/go/src/github.com/kubernetes/kubernetes/_output/local/go/src/k8s.io/kubernetes ASMFLAGS=all=-trimpath=/go/src/github.com/kubernetes/kubernetes/_output/local/go/src/k8s.io/kubernetes LDFLAGS=all=-X 'k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.buildDate=2023-10-02T09:52:01Z' -X 'k8s.io/kubernetes/vendor/k8s.io/component-base/version.buildDate=2023-10-02T09:52:01Z' -X 'k8s.io/client-go/pkg/version.buildDate=2023-10-02T09:52:01Z' -X 'k8s.io/component-base/version.buildDate=2023-10-02T09:52:01Z' -X 'k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitCommit=89a4ea3e1e4ddd7f7572286090359983e0387b2f' -X 'k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitCommit=89a4ea3e1e4ddd7f7572286090359983e0387b2f' -X 'k8s.io/client-go/pkg/version.gitCommit=89a4ea3e1e4ddd7f7572286090359983e0387b2f' -X 'k8s.io/component-base/version.gitCommit=89a4ea3e1e4ddd7f7572286090359983e0387b2f' -X 'k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitTreeState=clean' -X 'k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitTreeState=clean' -X 'k8s.io/client-go/pkg/version.gitTreeState=clean' -X 'k8s.io/component-base/version.gitTreeState=clean' -X 'k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitVersion=v1.28.2+k0s' -X 'k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitVersion=v1.28.2+k0s' -X 'k8s.io/client-go/pkg/version.gitVersion=v1.28.2+k0s' -X 'k8s.io/component-base/version.gitVersion=v1.28.2+k0s' -X 'k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitMajor=1' -X 'k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitMajor=1' -X 'k8s.io/client-go/pkg/version.gitMajor=1' -X 'k8s.io/component-base/version.gitMajor=1' -X 'k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitMinor=28' -X 'k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitMinor=28' -X 'k8s.io/client-go/pkg/version.gitMinor=28' -X 'k8s.io/component-base/version.gitMinor=28' -extldflags=-static -s -w

@twz123 twz123 merged commit 4b8f099 into k0sproject:main Oct 31, 2023
73 checks passed
@twz123 twz123 deleted the embedded-bins-source-date-epoch branch October 31, 2023 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants