Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit 88918fe

Browse files
authored
Don't check version-constraints when mirroring (#62)
Currently we check version-constraints when creating TUF clients for mirroring. This is not right, and to be honest the version check probably shouldn't even be at the TUF client level -- it's meant for specifying the version-constraints of the _policy_ in the TUF repo. Needed to fix https://github.com/docker/tuf-staging/actions/runs/10998625087/job/30536959822
1 parent 377f63d commit 88918fe

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

cmd/metadata.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/docker/attest/mirror"
1111
"github.com/docker/attest/oci"
1212
"github.com/docker/attest/tuf"
13+
mirrortuf "github.com/docker/go-tuf-mirror/internal/tuf"
1314
"github.com/docker/go-tuf-mirror/internal/util"
1415
"github.com/google/go-containerregistry/pkg/name"
1516
"github.com/spf13/cobra"
@@ -82,7 +83,7 @@ func (o *metadataOptions) run(cmd *cobra.Command, args []string) error {
8283
if err != nil {
8384
return fmt.Errorf("failed to get root bytes: %w", err)
8485
}
85-
m, err := mirror.NewTUFMirror(cmd.Context(), root.Data, tufPath, o.source, o.targets, tuf.NewDefaultVersionChecker())
86+
m, err := mirror.NewTUFMirror(cmd.Context(), root.Data, tufPath, o.source, o.targets, &mirrortuf.NullVersionChecker{})
8687
if err != nil {
8788
return fmt.Errorf("failed to create TUF mirror: %w", err)
8889
}

cmd/targets.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/docker/attest/mirror"
1111
"github.com/docker/attest/oci"
1212
"github.com/docker/attest/tuf"
13+
mirrortuf "github.com/docker/go-tuf-mirror/internal/tuf"
1314
"github.com/docker/go-tuf-mirror/internal/util"
1415
"github.com/google/go-containerregistry/pkg/name"
1516
"github.com/spf13/cobra"
@@ -97,7 +98,7 @@ func (o *targetsOptions) run(cmd *cobra.Command, args []string) error {
9798
if err != nil {
9899
return fmt.Errorf("failed to get root bytes: %w", err)
99100
}
100-
m, err = mirror.NewTUFMirror(cmd.Context(), root.Data, tufPath, o.metadata, o.source, tuf.NewDefaultVersionChecker())
101+
m, err = mirror.NewTUFMirror(cmd.Context(), root.Data, tufPath, o.metadata, o.source, &mirrortuf.NullVersionChecker{})
101102
if err != nil {
102103
return fmt.Errorf("failed to create TUF mirror: %w", err)
103104
}

internal/tuf/nullversionchecker.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package tuf
2+
3+
import (
4+
"github.com/docker/attest/tuf"
5+
)
6+
7+
type NullVersionChecker struct{}
8+
9+
func (*NullVersionChecker) CheckVersion(tuf.Downloader) error {
10+
return nil
11+
}

0 commit comments

Comments
 (0)