-
Notifications
You must be signed in to change notification settings - Fork 1
feat(devcontainer): derive the base-image pin instead of bumping it #225
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 all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
089b930
feat(devcontainer): derive the base-image pin instead of bumping it
Syndic 4736ebb
build(pre-commit): rewrite the base-image pin from a hook, not just a…
Syndic e6c3e74
fix(ci): publish the base image when .bazelversion moves, not just de…
Syndic a13fce2
ci(devcontainer): verify the registry serves what main pins
Syndic 3ee498c
docs: name the hook as the path our own edits take
Syndic 7f54594
ci: back the two derived-file hooks that had no CI check
Syndic 8e7e87a
fix(devcontainer): address review on the derived pin and the backstops
Syndic 8cfd0bc
ci(devcontainer): keep imagetools stderr, and finish a reflow
Syndic 88bafb5
ci(devcontainer): drop the sleep after the final publish-check attempt
Syndic 1a63bf4
ci(devcontainer): report the exit status of the last publish-check at…
Syndic bbc7ea4
ci(devcontainer): only name the timeout when it was one
Syndic 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
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,45 @@ | ||
| """Asserts the Dockerfile pins the base image this tree actually builds. | ||
|
|
||
| The pin is derived, not depended on: the digest is a pure function of `meta/devcontainer-base/` | ||
| plus the upstream base in `MODULE.bazel`, so a change to either restales it in the same commit. | ||
| The `base-image-pin` pre-commit hook rewrites it, exactly as `bazel mod tidy` does for | ||
| `MODULE.bazel.lock`. This is the backstop under that hook: hooks don't run for `--no-verify`, a | ||
| web edit, or the helper app's API commits, and don't re-run when a branch rebases onto someone | ||
| else's base change — two individually-fresh pins can be jointly stale. It can be a plain test | ||
| rather than a CI job because the digest falls out of an already-built artifact and needs no | ||
| daemon. | ||
|
|
||
| Without it, a stale pin is invisible: the devcontainer still builds, from the previous image, and | ||
| the difference only shows up as plumbing that mysteriously predates your change. | ||
| """ | ||
|
|
||
| import sys | ||
| import unittest | ||
| from pathlib import Path | ||
|
|
||
| from meta.scripts.sync_base_image_pin import index_digest, pinned_digest | ||
|
|
||
| # Not .resolve(): the image is a generated cross-package data dep, so it lives in the runfiles | ||
| # tree beside this file rather than in the source tree a resolved symlink leads back to. | ||
| _HERE = Path(__file__).parent | ||
| _DOCKERFILE = _HERE / "Dockerfile" | ||
| _LAYOUT_INDEX = _HERE.parent / "meta" / "devcontainer-base" / "image" / "index.json" | ||
|
|
||
|
|
||
| class TestBaseImagePinIsFresh(unittest.TestCase): | ||
| def test_pin_matches_the_built_image(self): | ||
| built = index_digest(_LAYOUT_INDEX.read_text(encoding="utf-8")) | ||
| current = pinned_digest(_DOCKERFILE.read_text(encoding="utf-8")) | ||
| self.assertEqual( | ||
| current, | ||
| built, | ||
| "The devcontainer's base-image pin is stale. Run:\n" | ||
| " bazel build //meta/devcontainer-base:image && " | ||
| "python3 meta/scripts/sync_base_image_pin.py\n" | ||
| "and commit .devcontainer/Dockerfile. The digest is reproducible, so this is the " | ||
| "one a merge will publish.", | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(0 if unittest.main(exit=False).result.wasSuccessful() else 1) |
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
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
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.