-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Cleanup CI integration scripts #130760
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
Cleanup CI integration scripts #130760
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder 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 |
GOTOOLCHAIN="${hack_tools_gotoolchain}" go -C "./hack/tools" install gotest.tools/gotestsum | ||
|
||
# Disable coverage report | ||
export KUBE_COVER="n" |
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 the default
|
||
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} |
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.
we don't need to do this, just source ./hack/install-etcd.sh
, kube::etcd::install
will update PATH, de-duping the PATH computation
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.
and the gopath bin things?
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.
The CI image already has PATH setup reasonably aside from installing etcd, which is the correct place to handle this. We handle etcd path below.
You can also seem that the CI jobs pass after this change:
https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/130760/pull-kubernetes-integration/1900251659217408000
https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/130760/pull-kubernetes-cmd/1900251658978332672
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.
When Kubernetes installs a tool into GOPATH/bin, it does it inside of a script, and it does it in a temporary GOPATH under _output or similar, while setting PATH inside that script.
the install etcd script is an outlier, it doesn't install from source though, and it's old
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} | ||
|
||
# Set artifacts directory | ||
export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"} |
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 useless, CI always sets ARTIFACTS, and locally you won't have either set. WORKSPACE was a bazel-ism
# Set artifacts directory | ||
export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"} | ||
|
||
cd "${GOPATH}/src/k8s.io/kubernetes" |
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 useless, CI already sets the working directory to the repo clone
worse, it assumes GOPATH for the checkout
if [ -n "${KUBE_HACK_TOOLS_GOTOOLCHAIN:-}" ]; then | ||
hack_tools_gotoolchain="${KUBE_HACK_TOOLS_GOTOOLCHAIN}"; | ||
fi | ||
GOTOOLCHAIN="${hack_tools_gotoolchain}" go -C "./hack/tools" install gotest.tools/gotestsum |
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 should be useless, or if not, we should fix that, make test
automatically handles gotestsum, I think we still have to add that to these (PR is WIP ....)
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.
We ultimately run gotestsum via make test
so we don't need this.
./hack/install-etcd.sh | ||
|
||
make test-integration | ||
make test-integration KUBE_KEEP_VERBOSE_TEST_OUTPUT=y LOG_LEVEL=4 |
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.
passing env this way makes it a pasteable command to produce the same output locally
@@ -27,4 +27,4 @@ source "${KUBE_ROOT}/hack/lib/init.sh" | |||
|
|||
FOUND="$(echo "${PATH}" | sed 's/:/\n/g' | grep -q "^${KUBE_ROOT}/third_party/etcd$" || true)" | |||
kube::etcd::install | |||
test -n "${FOUND}" || echo " PATH=\"\$PATH:${KUBE_ROOT}/third_party/etcd\"" | |||
test -n "${FOUND}" || echo "export PATH=\"\${PATH}:${KUBE_ROOT}/third_party/etcd\"" |
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 more useful when pasted by the user, and it also hints that we've exported it if you've sourced the script.
- stop setting ARTIFACTS from WORKSPACE, CI handles setting ARTIFACTS and WORKSPACE isn't used anymore (bazel?) - stop cd-ing GOPATH, CI sets the working dir already and local users won't necessarily have GOPATH - sop clobbering PATH with hardcoded assumptions, source install-etcd.sh instead (which updates PATH) - don't redundantly set KUBE_COVER to the default - pass logging env inline so the command can be pasted locally - set -x so the command is visible - add TODO about needing a wrapper script just to call install-etcd
this is handled centrally by make test which is called by make test-integration which this script calls only make test's implementation actually calls gotestsum, and it also handles installing if needed
a8b7670
to
1ddfc7b
Compare
/cc @aojea @pohly They continue to pass, I had to push a spelling fix, and there are some unrelated flakes in other jobs incl #130018 (comment) |
/lgtm |
LGTM label has been added. Git tree hash: 2291c313b61371f81ccef96fc23b3c85228148c0
|
That's twice in a row now with this garbage colletor test, filing a bug |
No it's not, the retest didn't take, that's the same run. Ok. Triage shows it has only failed once more in recent history https://storage.googleapis.com/k8s-triage/index.html?pr=1&text=Garbage%20collector%20should%20support%20orphan%20deletion%20of%20custom%20resources |
/sig testing |
/triage accepted |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Most of what these scripts do at this point is redundant or bad practice
I've done:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
builds on top of #130758 because I'd prioritize merging that smaller change first.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: