mirror of https://github.com/k3s-io/k3s
Merge pull request #56249 from ixdy/git-archive-source-tarballs
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Use `git archive` to produce kubernetes-src.tar.gz when git tree is clean **What this PR does / why we need it**: uses `git archive` to embed version information in the kubernetes source tarball produced in releases. Due to recent changes, the version information was missing from the source tarball, causing builds from these source tarballs to potentially fail. This also includes a fix inspired by #56216, since the ld flags in `hack/lib/version.sh` are not space-safe. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #56246 **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` /assign @david-mcmahon /priority urgent-soon /sig release cc @mruegpull/6/head
commit
84b3dcca08
|
@ -98,18 +98,23 @@ function kube::release::package_tarballs() {
|
|||
|
||||
# Package the source code we built, for compliance/licensing/audit/yadda.
|
||||
function kube::release::package_src_tarball() {
|
||||
local -r src_tarball="${RELEASE_TARS}/kubernetes-src.tar.gz"
|
||||
kube::log::status "Building tarball: src"
|
||||
local source_files=(
|
||||
$(cd "${KUBE_ROOT}" && find . -mindepth 1 -maxdepth 1 \
|
||||
-not \( \
|
||||
\( -path ./_\* -o \
|
||||
-path ./.git\* -o \
|
||||
-path ./.config\* -o \
|
||||
-path ./.gsutil\* \
|
||||
\) -prune \
|
||||
\))
|
||||
)
|
||||
"${TAR}" czf "${RELEASE_TARS}/kubernetes-src.tar.gz" -C "${KUBE_ROOT}" "${source_files[@]}"
|
||||
if [[ "${KUBE_GIT_TREE_STATE-}" == "clean" ]]; then
|
||||
git archive -o "${src_tarball}" HEAD
|
||||
else
|
||||
local source_files=(
|
||||
$(cd "${KUBE_ROOT}" && find . -mindepth 1 -maxdepth 1 \
|
||||
-not \( \
|
||||
\( -path ./_\* -o \
|
||||
-path ./.git\* -o \
|
||||
-path ./.config\* -o \
|
||||
-path ./.gsutil\* \
|
||||
\) -prune \
|
||||
\))
|
||||
)
|
||||
"${TAR}" czf "${src_tarball}" -C "${KUBE_ROOT}" "${source_files[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Package up all of the cross compiled clients. Over time this should grow into
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
# source code.
|
||||
# KUBE_GIT_TREE_STATE - "clean" indicates no changes since the git commit id
|
||||
# "dirty" indicates source code changes after the git commit id
|
||||
# "archive" indicates the tree was produced by 'git archive'
|
||||
# KUBE_GIT_VERSION - "vX.Y" used to indicate the last release version.
|
||||
# KUBE_GIT_MAJOR - The major part of the version
|
||||
# KUBE_GIT_MINOR - The minor component of the version
|
||||
|
@ -40,7 +41,7 @@ kube::version::get_version_vars() {
|
|||
# we likely don't have a git tree, but these magic values may be filled in.
|
||||
if [[ '$Format:%%$' == "%" ]]; then
|
||||
KUBE_GIT_COMMIT='$Format:%H$'
|
||||
KUBE_GIT_TREE_STATE="git archive"
|
||||
KUBE_GIT_TREE_STATE="archive"
|
||||
# When a 'git archive' is exported, the '$Format:%D$' below will look
|
||||
# something like 'HEAD -> release-1.8, tag: v1.8.3' where then 'tag: '
|
||||
# can be extracted from it.
|
||||
|
|
Loading…
Reference in New Issue