Skip to content

Commit 1355ff7

Browse files
authored
override local pull policy with permissive policy (#2339)
Signed-off-by: grokspawn <[email protected]>
1 parent 12ac242 commit 1355ff7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/shared/util/image/pull_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,15 @@ func buildSourceContextFunc(t *testing.T, ref reference.Named) func(context.Cont
298298
require.NoError(t, enc.Encode(registriesConf))
299299
require.NoError(t, f.Close())
300300

301+
// Create an insecure policy for testing to override any system-level policy
302+
// that might reject unsigned images
303+
policyPath := filepath.Join(configDir, "policy.json")
304+
insecurePolicy := `{"default":[{"type":"insecureAcceptAnything"}]}`
305+
require.NoError(t, os.WriteFile(policyPath, []byte(insecurePolicy), 0600))
306+
301307
return &types.SystemContext{
302308
SystemRegistriesConfPath: registriesConfPath,
309+
SignaturePolicyPath: policyPath,
303310
}, nil
304311
}
305312
}

0 commit comments

Comments
 (0)