-
Notifications
You must be signed in to change notification settings - Fork 566
CNTRLPLANE-3642: ci: add top-level directory drift detection #8773
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| api | ||
| availability-prober | ||
| client | ||
| cmd | ||
| contrib | ||
| control-plane-operator | ||
| control-plane-pki-operator | ||
| dnsresolver | ||
| docs | ||
| etcd-backup | ||
| etcd-defrag | ||
| etcd-recovery | ||
| etcd-upload | ||
| examples | ||
| hack | ||
| hypershift-ci-python | ||
| hypershift-operator | ||
| ignition-server | ||
| karpenter-operator | ||
| kas-bootstrap | ||
| konnectivity-https-proxy | ||
| konnectivity-socks5-proxy | ||
| kubernetes-default-proxy | ||
| kubevirtexternalinfra | ||
| pkg | ||
| product-cli | ||
| shared-ingress | ||
| sharedingress-config-generator | ||
| support | ||
| sync-fg-configmap | ||
| sync-global-pullsecret | ||
| test | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This means:
The error message on line 29 says:
This is misleading for Suggested fix: Add a comment in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. Let me update the text.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. Hopefully. |
||
| token-minter | ||
| vendor | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/usr/bin/env bash | ||
| # Verifies that the tracked top-level directory list stays in sync with | ||
| # the actual git-tracked directories. This prevents the CI skip pattern | ||
| # (pipeline_skip_if_only_changed) from silently going stale when new | ||
| # top-level directories are added to the repo. | ||
| # Directories containing E2E tests directly or indirectly (e.g. test/) | ||
| # must be excluded from the regex. | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| TRACKED="${SCRIPT_DIR}/toplevel-dirs.txt" | ||
|
|
||
| # Collect top-level directories from both committed (HEAD) and staged | ||
| # (index) state, excluding hidden dirs. In CI the PR is already merged | ||
| # into HEAD; the ls-files fallback catches locally staged-but-uncommitted | ||
| # directories during local `make verify`. | ||
| ACTUAL=$( (git ls-tree -d --name-only HEAD 2>/dev/null; \ | ||
| git ls-files --cached | grep '/' | cut -d/ -f1) \ | ||
| | grep -v '^\.' | sort -u) | ||
| EXPECTED=$(sort "${TRACKED}") | ||
|
|
||
| DIFF=$(diff <(echo "${EXPECTED}") <(echo "${ACTUAL}") || true) | ||
|
|
||
| if [[ -n "${DIFF}" ]]; then | ||
| echo "ERROR: Top-level directory list is out of sync." | ||
| echo "" | ||
| echo "Diff (expected vs actual):" | ||
| echo "${DIFF}" | ||
| echo "" | ||
| echo "If you added or removed a top-level directory, update hack/ci/toplevel-dirs.txt." | ||
| echo "Also update the pipeline_skip_if_only_changed regex in the ci-operator config." | ||
| echo "Top-level directories containing E2E tests directly or indirectly (e.g. test/) must be excluded from the regex." | ||
| exit 1 | ||
| fi |
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 file is a plain list with no context. Someone encountering it cold won't know what it's for, why it exists, or what to do when they add a directory. A two-line comment at the top would save confusion:
Uh oh!
There was an error while loading. Please reload this page.
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 file is read by a script so I can't easily add the description. Also, next to this file is verify-toplevel-dirs.sh which has this text:
Isn't it enough? I could possibly add a README.txt to this folder and mention this file but since it's already mentioned in the script that is named very similarly, I thought this would be enough. Please let me know.
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.
Oh sorry, I missed it. I guess it would be fine then :)