-
Notifications
You must be signed in to change notification settings - Fork 482
fix(evergreen-tracks): authenticate Hub tag reads — anonymous pagination now blocked past offset 1000 #37027
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
+405
−21
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ac2803f
fix(evergreen-tracks): authenticate Hub tag reads
sfreudenthaler 8a1acbb
fix(evergreen-tracks): address review — test isolation and 403 messag…
sfreudenthaler 71cfdec
test(evergreen-tracks): move creds isolation to conftest so it covers…
sfreudenthaler cd0eb0e
perf(evergreen-tracks): plan promotions from filtered reads instead o…
sfreudenthaler 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
29 changes: 29 additions & 0 deletions
29
.github/actions/core-cicd/evergreen-tracks/tests/conftest.py
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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| """Shared test isolation for the whole suite.""" | ||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from evergreen_tracks.registry import _jwt | ||
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def _no_ambient_hub_creds(monkeypatch): | ||
| """Neutralise DOCKER_USERNAME / DOCKER_TOKEN inherited from the shell. | ||
|
|
||
| `registry.list_tags` reads them to decide whether to authenticate, so a developer or | ||
| runner with Docker creds exported would send the anonymous-path tests through a real | ||
| `hub_login()` POST that `responses` never registered — turning deterministic tests | ||
| into environment-dependent ones. Tests that WANT auth set the vars themselves. | ||
|
|
||
| In conftest rather than one test module so it covers every module, including ones | ||
| not written yet: the trap is invisible until someone's shell happens to have creds. | ||
|
|
||
| Also drops the memoised JWT. `_jwt` is deliberately cached — one Hub login per | ||
| process rather than one per request — but that cache outlives a test, so without | ||
| this a later test using the same credentials silently reuses an earlier test's | ||
| token. Verified: two tests with identical creds and different tokens, and the | ||
| second one saw the first one's JWT. | ||
| """ | ||
| monkeypatch.delenv("DOCKER_USERNAME", raising=False) | ||
| monkeypatch.delenv("DOCKER_TOKEN", raising=False) | ||
| _jwt.cache_clear() |
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.