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

break up the test tarball #74065

Merged
merged 5 commits into from
Feb 23, 2019
Merged

Conversation

ixdy
Copy link
Member

@ixdy ixdy commented Feb 14, 2019

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:

  • produce kubernetes-test-portable.tar.gz and kubernetes-test-{OS}-{ARCH}.tar.gz
  • continue to produce kubernetes-test.tar.gz with an embedded DEPRECATION_NOTICE
    • this can be disabled in the make-based build system by setting KUBE_BUILD_MONDO_TEST_TARBALL=n
  • update cluster/get-kube-binaries.sh to prefer downloading the split test tarballs
  • also clean up some dead code in get-kube-binaries.sh

x-ref kubernetes/enhancements#714

Does this PR introduce a user-facing change?:

Split up the mondo `kubernetes-test` tarball into `kubernetes-test-portable` and `kubernetes-test-{OS}-{ARCH}` tarballs.

/sig testing release
/priority important-soon

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 14, 2019
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 14, 2019
@ixdy ixdy changed the title WIP: break up the test tarball break up the test tarball Feb 14, 2019
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Feb 14, 2019
@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. sig/release Categorizes an issue or PR as relevant to SIG Release. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 14, 2019
@ixdy
Copy link
Member Author

ixdy commented Feb 14, 2019

I think this is basically ready for review now. The bazel stuff somewhat conflicts with #73930, so I'll clean up the mess in whichever PR loses the race.

cc @spiffxp @tpepper @kubernetes/bash-firefighters @akutz @amwat

@ixdy
Copy link
Member Author

ixdy commented Feb 14, 2019

/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() {
Copy link
Member

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.

Copy link
Contributor

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

Copy link
Member

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 😛

@ixdy
Copy link
Member Author

ixdy commented Feb 20, 2019

I'm not sure who to assign here... I feel bad for overburdening the same folks each time.

/assign @BenTheElder @cblecker @fejta @spiffxp

Copy link
Contributor

@fejta fejta left a 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() {
Copy link
Contributor

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}/}" \
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this # mean?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

@ixdy ixdy Feb 20, 2019

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.

# 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?)

Copy link
Member

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.

maxresdefault

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I blame @jbeda :) #1324

Copy link
Member Author

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)

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Feb 20, 2019
@ixdy
Copy link
Member Author

ixdy commented Feb 21, 2019

/retest

Copy link
Contributor

@fejta fejta left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2019
build/lib/release.sh Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2019
Copy link
Member

@spiffxp spiffxp left a 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)
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

who says indeed? :P

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2019
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)"
Copy link
Member

Choose a reason for hiding this comment

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

@spiffxp
Copy link
Member

spiffxp commented Feb 22, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 22, 2019
@ixdy
Copy link
Member Author

ixdy commented Feb 22, 2019

/hold cancel
:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/release Categorizes an issue or PR as relevant to SIG Release. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants