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

Allow to override build date with SOURCE_DATE_EPOCH #3009

Merged
merged 1 commit into from
Jul 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hack/get_k8s_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"This package gets the LD flags used to set the version of kubernetes."

import json
import os
import re
import subprocess
import sys
import time
from datetime import datetime

K8S_PACKAGE = 'k8s.io/kubernetes/'
Expand Down Expand Up @@ -63,7 +65,8 @@ def get_tree_state():
return 'gitTreeState=%s' % result

def get_build_date():
return 'buildDate=%s' % datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')
build_date = datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
return 'buildDate=%s' % build_date.strftime('%Y-%m-%dT%H:%M:%SZ')

def main():
if len(sys.argv) > 1 and sys.argv[1] == "--k8s-version-only":
Expand Down