Repository navigation
CNTRLPLANE-3944: Regenerate requirements.txt files with pinned --hash entries #9135
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bf6dd1b
chore(ci): pin hypershift-ci-python requirements with sha256 hashes
mgencur b50d602
chore(docs): pin and hash docs/requirements.txt dependencies
mgencur b883c48
chore(contrib): pin and hash contrib/oidc/requirements.txt dependencies
mgencur 4cf1161
docs: document how to add/update requirements.txt with sha256 hashes
mgencur 469e072
chore(ci): bump httplib2 and pyasn1 hashes; fix regen instructions
mgencur 7f76328
chore(ci): bump protobuf to 5.29.6 in hypershift-ci-python requirements
mgencur 176022f
chore(ci): enforce pip hash-checking in docs and CI python image builds
mgencur 3272d22
ci: replace dead pip-install input with explicit pip install step
mgencur acf25af
chore(ci): enforce pip hash-checking in docs-build-reusable workflow
mgencur ced2fca
fix(ci): move PIP_CACHE_DIR to the actual pip install step
mgencur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,35 @@ | ||
| boto3>=1.26.0 | ||
| botocore>=1.29.0 | ||
| # This file was autogenerated by uv via the following command: | ||
| # uv pip compile --generate-hashes contrib/oidc/requirements.txt -o /tmp/requirements.txt.new && mv /tmp/requirements.txt.new contrib/oidc/requirements.txt | ||
| boto3==1.43.57 \ | ||
| --hash=sha256:115ed9cac409d9b57e2437b52fdb4286660d12a2bd44a0f48d530e68623d09a7 \ | ||
| --hash=sha256:549c95e45f9b04cf0c69727632dbdda23b84dcd3d0ed7981c6aaff72ef9cb5af | ||
| # via -r contrib/oidc/requirements.txt | ||
| botocore==1.43.57 \ | ||
| --hash=sha256:001a5653bebc03b862bde2da63bad4adb0b30072a3f247aba4daae5aa097b546 \ | ||
| --hash=sha256:319c6d79f66c3f3f2b538f7dcdc90e410a15a7bfced1db06479134947e629482 | ||
| # via | ||
| # -r contrib/oidc/requirements.txt | ||
| # boto3 | ||
| # s3transfer | ||
| jmespath==1.1.0 \ | ||
| --hash=sha256:472c87d80f36026ae83c6ddd0f1d05d4e510134ed462851fd5f754c8c3cbb88d \ | ||
| --hash=sha256:a5663118de4908c91729bea0acadca56526eb2698e83de10cd116ae0f4e97c64 | ||
| # via | ||
| # boto3 | ||
| # botocore | ||
| python-dateutil==2.9.0.post0 \ | ||
| --hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \ | ||
| --hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427 | ||
| # via botocore | ||
| s3transfer==0.19.2 \ | ||
| --hash=sha256:ba0309fd86be3c27dbf78cdd813c13c5e1df16e5874b99d2535ebbdfb9892993 \ | ||
| --hash=sha256:d8168eccca828cbb2cd573675333f3bddd254313a9c42494b84c76b539e8ba25 | ||
| # via boto3 | ||
| six==1.17.0 \ | ||
| --hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \ | ||
| --hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81 | ||
| # via python-dateutil | ||
| urllib3==2.7.0 \ | ||
| --hash=sha256:231e0ec3b63ceb14667c67be60f2f2c40a518cb38b03af60abc813da26505f4c \ | ||
| --hash=sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897 | ||
| # via botocore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,50 @@ | ||
| Any changes to the docs in this directory can be tested locally before pushing changes to GitHub. Just follow these | ||
| Any changes to the docs in this directory can be tested locally before pushing changes to GitHub. Just follow these | ||
| steps: | ||
|
|
||
| 1. cd to this directory | ||
| 2. Run `make image` to build the image | ||
| 3. Run `make build-containerized` to build the containerized version of the image | ||
| 4. Run `make serve-containerized` to serve up the docs website locally | ||
|
|
||
| Any changes you make while the docs are served locally, will be updated in the local docs website. | ||
| Any changes you make while the docs are served locally, will be updated in the local docs website. | ||
|
|
||
| ## Managing Python dependencies | ||
|
|
||
| `requirements.txt` pins every Python dependency needed to build the docs | ||
| (mkdocs and its plugins) to an exact version and includes | ||
| `--hash=sha256:...` entries for each published artifact, enabling pip's | ||
| hash-checking mode (`pip install --require-hashes`). This is what | ||
| `.github/workflows/docs-build-reusable.yaml` installs before running | ||
| `mkdocs build --strict`. | ||
|
|
||
| Because hash-checking mode requires every installed package — including | ||
| transitive dependencies of mkdocs-material, mkdocs-mermaid2-plugin, and | ||
| mkdocs-glightbox — to be pinned and hashed, the file lists the full resolved | ||
| dependency closure, not just the three plugins imported directly. | ||
|
|
||
| ### Adding or updating a dependency | ||
|
|
||
| 1. Add or update the package's version constraint in `requirements.txt` | ||
| (e.g. `newplugin>=1.0.0`, or bump an existing `==` pin). | ||
| 2. Regenerate the file with [`uv`](https://docs.astral.sh/uv/), compiling to | ||
| a new temporary path rather than overwriting `requirements.txt` directly, | ||
| then move it into place: | ||
|
|
||
| ```bash | ||
| uv pip compile --generate-hashes docs/requirements.txt -o /tmp/requirements.txt.new | ||
| mv /tmp/requirements.txt.new docs/requirements.txt | ||
| ``` | ||
|
|
||
| This resolves the full dependency graph, pins every package (direct and | ||
| transitive) to an exact version, and adds `--hash=sha256:...` entries for | ||
| all of its published wheel/sdist artifacts. Don't edit hashes by hand — | ||
| always regenerate so they're guaranteed to match the published artifact. | ||
| 3. Validate the result, forcing pip to actually verify every package's hash | ||
| rather than skipping ones already present locally: | ||
|
|
||
| ```bash | ||
| pip install --dry-run --ignore-installed --require-hashes -r docs/requirements.txt | ||
| ``` | ||
|
|
||
| 4. Confirm the docs still build: `cd docs && mkdocs build --strict` | ||
| (after installing the regenerated requirements into your environment). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| BEGIN { FS = " |==="}; /mkdocs-material/{print $2} | ||
| BEGIN { FS = "==" }; /^mkdocs-material==/{split($2, p, " "); print p[1]} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.