Skip to content

Commit

Permalink
Merge pull request #56441 from ixdy/automated-cherry-pick-of-#56249-u…
Browse files Browse the repository at this point in the history
…pstream-release-1.7

Automatic merge from submit-queue.

Automated cherry pick of #56249

Cherry pick of #56249 on release-1.7.

#56249: Use `git archive` to produce kubernetes-src.tar.gz when git tree is clean
  • Loading branch information
Kubernetes Submit Queue authored Dec 2, 2017
2 parents 9b83ff5 + e128b54 commit aa9537e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
27 changes: 16 additions & 11 deletions build/lib/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion hack/lib/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit aa9537e

Please sign in to comment.