Skip to content

Commit

Permalink
feat: use flag instead of nil to disable tuf
Browse files Browse the repository at this point in the history
  • Loading branch information
kipz committed Aug 28, 2024
1 parent 0fdb133 commit ccf3aa7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func resolvePolicyByID(opts *Options, tufClient tuf.Downloader) (*Policy, error)
return resolveLocalPolicy(opts, policy, "", "")
}
}
if tufClient != nil {
if !opts.DisableTUF {
// must check tuf
tufMappings, err := config.LoadTUFMappings(tufClient, opts.LocalTargetsDir)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func TestRegoEvaluator_Evaluate(t *testing.T) {
LocalTargetsDir: test.CreateTempDir(t, "", "tuf-targets"),
PolicyID: tc.policyID,
LocalPolicyDir: tc.repo,
DisableTUF: true,
}
}
imageName, err := tc.resolver.ImageName(ctx)
Expand All @@ -86,7 +87,6 @@ func TestRegoEvaluator_Evaluate(t *testing.T) {
require.NoError(t, err)
resolver, err := policy.CreateImageDetailsResolver(src)
require.NoError(t, err)
//nil below indicates TUF is disabled
policy, err := policy.ResolvePolicy(ctx, nil, resolver, tc.policy)
if tc.resolveErrorStr != "" {
require.Error(t, err)
Expand Down

0 comments on commit ccf3aa7

Please sign in to comment.