-
Notifications
You must be signed in to change notification settings - Fork 356
Gate checkpoint writes on policy support #1541
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
26 commits
Select commit
Hold shift + click to select a range
3ba0901
select checkpoint version from policy
pfleidi 652c278
make checkpoint policy advisory
pfleidi 5173da4
document checkpoint policy fallback
pfleidi b0eed5c
remove stale checkpoint summary repo parameter
pfleidi f4bced8
support unsetting checkpoint policy fields
pfleidi d995bcb
use empty policy flag values to unset
pfleidi 8fb1567
Merge branch 'main' into checkpoint-policy-fixes
pfleidi e5feacd
simplify checkpoint policy pre-push sync
pfleidi fa54b81
document checkpoint policy unset downgrades
pfleidi c3f89a9
surface checkpoint policy fallbacks
pfleidi 65d3736
clarify checkpoint policy satisfaction
pfleidi c553b61
block checkpoint data writers on policy
pfleidi a117171
gate hooks on checkpoint policy
pfleidi 6f06a73
document checkpoint policy enforcement
pfleidi 93b03f9
Merge branch 'main' of entire://aws-us-east-2.entire.io/gh/entireio/c…
pfleidi 9762bcb
fail closed on unreadable checkpoint policy
pfleidi 9994d75
remove checkpoint version fallback helper
pfleidi 39d9209
move checkpoint policy test helpers
pfleidi 450426a
reuse pre-push repo for policy checks
pfleidi 7ed08ed
dedupe checkpoint version policy formatting
pfleidi 88eb877
Merge branch 'main' into checkpoint-policy-fixes
pfleidi 8127cf5
fix hook policy open failures
pfleidi 342c6fd
Merge remote-tracking branch 'origin/checkpoint-policy-fixes' into ch…
pfleidi d958fb7
Merge origin/main into checkpoint-policy-fixes
pfleidi 2842d49
limit hook policy gate to checkpoint writes
pfleidi 623aa66
Merge remote-tracking branch 'origin/main' into checkpoint-policy-fixes
pfleidi 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
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,36 @@ | ||
| package cli | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "github.com/entireio/cli/cmd/entire/cli/checkpoint" | ||
| "github.com/entireio/cli/cmd/entire/cli/checkpointpolicy" | ||
| "github.com/go-git/go-git/v6" | ||
| "github.com/go-git/go-git/v6/plumbing" | ||
| "github.com/go-git/go-git/v6/plumbing/filemode" | ||
| "github.com/go-git/go-git/v6/plumbing/object" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func writeMalformedCheckpointPolicyForCLITest(t *testing.T, repo *git.Repository) { | ||
| t.Helper() | ||
| blobHash, err := checkpoint.CreateBlobFromContent(repo, []byte(`{"checkpoint_version":`)) | ||
| require.NoError(t, err) | ||
| treeHash, err := checkpoint.BuildTreeFromEntries(context.Background(), repo, map[string]object.TreeEntry{ | ||
| checkpointpolicy.PolicyFileName: {Name: checkpointpolicy.PolicyFileName, Mode: filemode.Regular, Hash: blobHash}, | ||
| }) | ||
| require.NoError(t, err) | ||
| commitHash, err := checkpoint.CreateCommit(context.Background(), repo, treeHash, plumbing.ZeroHash, "malformed checkpoint policy", "Test", "test@example.com") | ||
| require.NoError(t, err) | ||
| require.NoError(t, checkpointpolicy.SetRef(repo, checkpointpolicy.RefName, commitHash)) | ||
| } | ||
|
|
||
| func writeUnsupportedCheckpointPolicyForCLITest(t *testing.T, repo *git.Repository) { | ||
| t.Helper() | ||
| _, err := checkpointpolicy.WriteLocal(t.Context(), repo, plumbing.ZeroHash, checkpointpolicy.Policy{ | ||
| CheckpointVersion: "refs-v1", | ||
| CheckpointMinVersion: "branch-v1", | ||
| }) | ||
| require.NoError(t, err) | ||
| } |
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.
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.