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
Use the same way to create tmp directories at hacks #116044
Conversation
Hi @mhmxs. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/release-note-none |
/triage accepted |
/ok-to-test |
/retest |
3 similar comments
/retest |
/retest |
/retest |
/retest |
@mhmxs If you still need this PR then please rebase, if not, please close the PR. |
/retest |
@mhmxs please, squash your commits. This should help to get rid of do-not-merge/contains-merge-commits label and proceed further with this pr. |
/retest |
@@ -27,7 +27,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh" | |||
|
|||
# create a nice clean place to put our new vendor tree | |||
mkdir -p "${KUBE_ROOT}/_tmp" | |||
_tmpdir="$(mktemp -d "${KUBE_ROOT}/_tmp/kube-vendor.XXXXXX")" | |||
_tmpdir="$(kube::realpath "$(mktemp -d "${KUBE_ROOT}/_tmp/$(basename "$0").XXXXXX")")" |
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.
This is repeated everywhere. Would it make sense to wrap it into a function, e.e. kube::mktemp
or something similar?
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.
Make sense, I just followed @thockin 's instructions.
@@ -27,7 +27,7 @@ if [[ "${KUBERNETES_PROVIDER:-gce}" != "gce" ]]; then | |||
fi | |||
|
|||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../.. | |||
source "${KUBE_ROOT}/hack/lib/util.sh" | |||
source "${KUBE_ROOT}/hack/lib/init.sh" |
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.
How this kind of changes are related to creating tmp directories?
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.
Makes sense to me. Thank you for the explanations!
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.
See above comment - let's not make changes (especially under cluster) unless we REALLY know why.
/assign @pacoxu @SergeyKanzhelev |
@mhmxs: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/cc @thockin |
@bart0sh Seems |
Did you try to rebase on top of the latest master? It might help if the failure is caused by something else. |
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.
Breaking this up would help reviewability a lot. 1 commit, 1 idea.
@@ -24,7 +24,7 @@ KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd) | |||
|
|||
DEFAULT_KUBECONFIG="${HOME:-.}/.kube/config" | |||
|
|||
source "${KUBE_ROOT}/hack/lib/util.sh" | |||
source "${KUBE_ROOT}/hack/lib/init.sh" |
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.
init.sh has a lot of stuff, including changin global vars - I don't think I would make this sort change unless you know why you need to
@@ -27,7 +27,7 @@ if [[ "${KUBERNETES_PROVIDER:-gce}" != "gce" ]]; then | |||
fi | |||
|
|||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../.. | |||
source "${KUBE_ROOT}/hack/lib/util.sh" | |||
source "${KUBE_ROOT}/hack/lib/init.sh" |
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.
See above comment - let's not make changes (especially under cluster) unless we REALLY know why.
# If the master image is not set, we use the latest GCI image. | ||
# Otherwise, we respect whatever is set by the user. | ||
export MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-${GCI_VERSION}} | ||
: "${GCI_VERSION?= required}" |
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.
Even I don't know this syntax. This seems unrelated to the topic of this PR and should at least be in a different commit if not a whole new PR.
Everything under cluster/ is overly brittle and needs extra attention
ETCD_VERSION=${ETCD_VERSION:-3.5.7} | ||
ETCD_HOST=${ETCD_HOST:-127.0.0.1} | ||
ETCD_PORT=${ETCD_PORT:-2379} | ||
ETCD_VERSION="${ETCD_VERSION:-3.5.7}" |
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.
Can you break quoting changes out to a separate commit
TMP_DIR=${TMP_DIR:-$(kube::realpath "$(mktemp -d -t "$(basename "$0").XXXXXX")")} | ||
LOG_SPEC="${LOG_SPEC:-""}" | ||
LOG_DIR="${LOG_DIR:-"/tmp"}" | ||
TMP_DIR="${TMP_DIR:-$(kube::realpath "$(mktemp -d -t "$(basename "$0").XXXXXX")")}" |
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.
Quoting changes to a different commit, please?
@@ -19,7 +19,7 @@ set -o nounset | |||
set -o pipefail | |||
|
|||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../.. | |||
source "${KUBE_ROOT}/hack/lib/util.sh" | |||
source "${KUBE_ROOT}/hack/lib/init.sh" |
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.
As above - I'd like to know why?
@@ -36,7 +36,7 @@ skip=${SKIP-"\[Flaky\]|\[Slow\]|\[Serial\]"} | |||
# Currently, parallelism only affects when REMOTE=true. For local test, | |||
# ginkgo default parallelism (cores - 1) is used. | |||
parallelism=${PARALLELISM:-8} | |||
artifacts="${ARTIFACTS:-"/tmp/_artifacts/$(date +%y%m%dT%H%M%S)"}" | |||
artifacts="${ARTIFACTS:-$(kube::realpath "$(mktemp -d -t "$(basename "$0").XXXXXX")")/_artifacts/$(date +%y%m%dT%H%M%S)}" |
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.
If we are going to repeat the pattern everywhere, why not capture it as
function kube::util::mktemp-dir() {
local script="$0"
if [[ -n "$1" ]]; then
script="$1"
fi
base="$(basename "${script}")"
mktemp -d -t "${base}.XXXXXX"
}
It's also uncclear to me why readlink and realpath are in init and not util (and named as such) |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@mhmxs please address remaining comments to go further with this PR, thanks. |
@bart0sh I haven't forget, but the suggestion is to cut this PR into 2-3 separated ones, which makes sense, because it helps identify which change broke e2e testing. So I think we should close this one, and let me split it. |
What type of PR is this?
This change eliminates different ways to create temp directories in scripts at
hack
/kind cleanup
/sig node
/release-note-none
What this PR does / why we need it:
It makes sense to use the same method for temp folder creation.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: