Files
cozystack/hack
Aleksei Sviridkin 137b68f07a test(hack): skip request-timeout calls that name a kubeconfig or context (#5406)
## What this PR does

`hack/check-hook-request-timeout.bats` exempts a file only when it names
`KUBECONFIG`. A hook script under `files/` that gets `KUBECONFIG` from
its template's env has no reason to name it, so a call that goes through
that kubeconfig with `--context` is flagged as an in-cluster call. That
is what turned `capi-providers-core/files/upgrade-providers.sh` red on
main; #5398 fixed that script by naming `KUBECONFIG`, and this keeps the
next script written the same way from hitting it again.

The check now skips a line that passes a non-empty `--context` or
`--kubeconfig`. client-go serves such a call from the loaded kubeconfig,
and without one `--context` fails with "context was not found" instead
of falling back to localhost:8080. An empty value (`--context ""`,
`--context=`, `--kubeconfig=`) does fall back, so it is still reported,
and so is a bare call in the same file. The header notes the limits: a
variable that is empty at runtime is not visible to the check, and the
match is per line.

Tested with `bats hack/check-hook-request-timeout.bats`: 11 of 11 pass,
the new cases fail without the change, and each part of the filter is
pinned by a mutation. The empty-value fallback was reproduced with
kubectl v1.37.2.

### Screenshots

<!-- REQUIRED for UI changes: attach screenshots or screen recordings
demonstrating
the visual impact of your changes. PRs with UI changes without
screenshots will not be merged. -->

### Downstream repositories

<!--
Cozystack is upstream for repositories that are NOT kept in sync with it
automatically, and nothing in CI compares the two sides, so a change
here can break them silently.

Which change forces what, and which file to touch, is the trigger map in
docs/agents/contributing.md under "Downstream Repositories". Walk it
before you tick anything.

IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM
TO FILL IN:

1. Walk the trigger map against the actual diff of this PR, file by
file. Do not decide from the PR title or from your memory of what you
changed.
2. For every repository you tick, open the follow-up PR there and link
it on the same line. A ticked box with no link claims work that does not
exist, which is worse than an empty box. Search that repository for an
open PR or issue covering it first, and link that instead of filing a
duplicate.
3. When the follow-up is out of scope, or needs a decision that is not
yours to make, open an issue in that repository instead, link that, and
say so in the PR body. Do not push a speculative PR into another
repository just to fill a line here.
4. Do not tick "No downstream repository is affected" to make the
checklist go away. If you are unsure, leave every box empty and say so
in the PR body, so a human decides.
-->

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
NONE
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Timeout checks now exclude matching lines that specify a non-empty
context or kubeconfig value. Empty option values and bare calls on
separate lines are still reported; files naming `KUBECONFIG` remain
excluded.
* **Documentation**
* Clarified how context and kubeconfig options affect timeout reporting.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-12-02 12:46:11 +03:00
..