mirror of
https://github.com/project-zot/zot.git
synced 2026-06-19 22:27:58 +08:00
Implement signature-lint cleanup and fix lint formatting
This commit is contained in:
committed by
GitHub
parent
c8ddde1794
commit
83adc3c890
@@ -82,7 +82,6 @@ func containsFiles(root string) bool {
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if walkErr != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ func (linter *Linter) CheckMandatorySignatures(repo string, manifestDigest godig
|
||||
}
|
||||
|
||||
mandatory := false
|
||||
|
||||
for _, mandatoryRepo := range linter.config.MandatorySignatures {
|
||||
if mandatoryRepo == "*" || mandatoryRepo == "**" || repo == mandatoryRepo {
|
||||
mandatory = true
|
||||
@@ -228,7 +229,9 @@ func (linter *Linter) hasTrustedSignature(repo string, manifestDigest godigest.D
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func getSignatureType(descriptor ispec.Descriptor, signatureManifest ispec.Manifest, manifestDigest godigest.Digest) (string, bool) {
|
||||
func getSignatureType(descriptor ispec.Descriptor, signatureManifest ispec.Manifest,
|
||||
manifestDigest godigest.Digest,
|
||||
) (string, bool) {
|
||||
artifactType := zcommon.GetManifestArtifactType(signatureManifest)
|
||||
|
||||
if signatureManifest.Subject != nil && signatureManifest.Subject.Digest == manifestDigest {
|
||||
|
||||
@@ -113,8 +113,6 @@ func TestMandatorySignaturesFunction(t *testing.T) {
|
||||
})
|
||||
|
||||
for _, wildcard := range []string{"*", "**"} {
|
||||
wildcard := wildcard
|
||||
|
||||
Convey("mandatory signatures check rejects unsigned images for wildcard repository list "+wildcard, t, func() {
|
||||
enable := true
|
||||
lintConfig := &extconf.LintConfig{
|
||||
|
||||
Reference in New Issue
Block a user