-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
break up the test tarball #74065
break up the test tarball #74065
Conversation
11762f6
to
ab915e8
Compare
ab915e8
to
2fe408e
Compare
/unassign |
@@ -466,39 +471,99 @@ function kube::release::package_kube_manifests_tarball() { | |||
kube::release::create_tarball "${package_name}" "${release_stage}/.." | |||
} | |||
|
|||
# Builds tarballs for each test platform containing the appropriate binaries. | |||
function kube::release::package_test_platform_tarballs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just marveling at the fact that you can have colons in a function name in BASH. I had no idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gained so much bash expertise on this project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some really amazing bash in this project. And also plenty of horrifying stuff #72956 😛
I'm not sure who to assign here... I feel bad for overburdening the same folks each time. /assign @BenTheElder @cblecker @fejta @spiffxp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/hold
@@ -466,39 +471,99 @@ function kube::release::package_kube_manifests_tarball() { | |||
kube::release::create_tarball "${package_name}" "${release_stage}/.." | |||
} | |||
|
|||
# Builds tarballs for each test platform containing the appropriate binaries. | |||
function kube::release::package_test_platform_tarballs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gained so much bash expertise on this project
local platform_tag=${platform/\//-} # Replace a "/" for a "-" | ||
local release_stage="${RELEASE_STAGE}/test/${platform_tag}/kubernetes" | ||
mkdir -p "${release_stage}/test/bin" | ||
cp "${KUBE_TEST_SERVER_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this #
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fejta,
I mean, it looks like string manipulation, but dang it's nasty.
From https://www.tldp.org/LDP/abs/html/arrays.html:
string=abcABC123ABCabc echo ${string[@]} # abcABC123ABCabc
And from http://tldp.org/LDP/abs/html/parameter-substitution.html:
${var#Pattern}
Remove from $var the shortest part of $Pattern that matches the front end of $var.
I read it as removing the string evaluated from /${LOCAL_OUTPUT_BINPATH}/${platform}/
from all of the elements in ${KUBE_TEST_SERVER_BINARIES}
.
I suppose it makes sense if they're trying to use the cp
command's ability to copy multiple source files into a single destination directory:
cp [FLAGS] source_file ... target_directory
Maybe trying to remove all but the file name for each element of ${KUBE_TEST_SERVER_BINARIES}
in order to copy them into "${release_stage}/test/bin/"
?
That's my best guess without spending more time looking at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fejta,
From the same arrays link as above:
# Substring Removal # Removes shortest match from front of string(s). echo ${arrayZ[@]#f*r} # one two three five five # ^ # Applied to all elements of the array. # Matches "four" and removes it.
This seems to be the same pattern being used and that I sussed out above. Still, with so many variables in play, I haven't traced out what the actual result is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akutz was on the right path, but this is actually a different operator - /#
, not #
.
From the arrays link:
arrayZ=( one two three four five five )
# Substring Replacement
# Replace front-end occurrences of substring.
echo ${arrayZ[@]/#fi/XY} # one two three four XYve XYve
# ^ # Applied to all elements of the array.
Because the match string is empty (there's no string after #
before the next /
), we end up just prepending the following string. (It's extra confusing because we have /
s in the "replacement" string.)
It's documented in a few other places it's used in this file, e.g.
kubernetes/build/lib/release.sh
Lines 137 to 141 in 61b676a
# This fancy expression will expand to prepend a path | |
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the | |
# KUBE_CLIENT_BINARIES array. | |
cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ | |
"${release_stage}/client/bin/" |
I can add a similar comment for this usage.
(Have I mentioned that the bash side of this PR was far more difficult than the bazel side?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ixdy. I didn't realize that /#
behaved differently. I don't tend to use Bash string manipulation at all, let alone Bash arrays. I usually stick with POSIX-compliant rules and defer to sed
for replacements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely a cool trick, though.
#1324 (comment)
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
4a5ea72
to
c5c0e42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
# Loop over only the unique tuples | ||
for TUPLE in $(printf "%s\n" "${TEST_PLATFORM_TUPLES[@]}" | sort -u); do | ||
OS=$(echo "${TUPLE}" | cut -d/ -f1) | ||
ARCH=$(echo "${TUPLE}" | cut -d/ -f2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who says bash can't do sets of tuples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could probably use IFS="/" read
here instead, but I felt this was more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who says indeed? :P
kube::release::create_tarball "${portable_tarball_name}" "${release_stage}/.." | ||
|
||
if [[ "${KUBE_BUILD_MONDO_TEST_TARBALL}" =~ [yY] ]]; then | ||
kube::log::status "Building tarball: test mondo (deprecated by KEP sig-testing/20190118-breaking-apart-the-kubernetes-test-tarball)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, FWIW you can get a sorta short-ish link to the file:
https://git.k8s.io/enhancements/keps/sig-testing/20190118-breaking-apart-the-kubernetes-test-tarball.md
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ixdy, spiffxp The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
What type of PR is this?
/kind cleanup
What this PR does / why we need it: implements sig-testing/20190118-breaking-apart-the-kubernetes-test-tarball:
kubernetes-test-portable.tar.gz
andkubernetes-test-{OS}-{ARCH}.tar.gz
kubernetes-test.tar.gz
with an embeddedDEPRECATION_NOTICE
KUBE_BUILD_MONDO_TEST_TARBALL=n
cluster/get-kube-binaries.sh
to prefer downloading the split test tarballsget-kube-binaries.sh
x-ref kubernetes/enhancements#714
Does this PR introduce a user-facing change?:
/sig testing release
/priority important-soon