Skip to content

Commit

Permalink
test bool
Browse files Browse the repository at this point in the history
Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa committed May 26, 2022
1 parent 9b337a5 commit b16f38d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions pkg/cosign/tuf/client.go
Expand Up @@ -29,7 +29,6 @@ import (
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -213,7 +212,7 @@ func getRoot(meta map[string]json.RawMessage, ed fs.FS) (json.RawMessage, error)
if !ok {
return nil, errors.New("fs.ReadFileFS unimplemented for embedded repo")
}
trustedRoot, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", "root.json")))
trustedRoot, err := rd.ReadFile(filepath.Join("repository", "root.json"))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -513,11 +512,11 @@ func rootCacheDir() string {
}

func cachedRemote(cacheRoot string) string {
return filepath.FromSlash(filepath.Join(cacheRoot, "remote.json"))
return filepath.Join(cacheRoot, "remote.json")
}

func cachedTargetsDir(cacheRoot string) string {
return filepath.FromSlash(filepath.Join(cacheRoot, "targets"))
return filepath.Join(cacheRoot, "targets")
}

// Local store implementations
Expand Down Expand Up @@ -563,7 +562,7 @@ func (e embeddedLocalStore) GetMeta() (map[string]json.RawMessage, error) {
// Skip the target directory or other strange files.
continue
}
b, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", entry.Name())))
b, err := rd.ReadFile(filepath.Join("repository", entry.Name()))
if err != nil {
return nil, fmt.Errorf("reading embedded file: %w", err)
}
Expand Down Expand Up @@ -703,7 +702,7 @@ func (e *embeddedWrapper) Get(p string) ([]byte, error) {
if !ok {
return nil, errors.New("fs.ReadFileFS unimplemented for embedded repo")
}
b, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", "targets", p)))
b, err := rd.ReadFile(filepath.Join("repository", "targets", p))
if err != nil {
return nil, err
}
Expand All @@ -723,7 +722,7 @@ func (e *embeddedWrapper) Set(name string, b []byte) error {
if !ok {
return errors.New("fs.ReadFileFS unimplemented for embedded repo")
}
entries, err := ed.ReadDir(filepath.FromSlash(filepath.Join("repository", "targets")))
entries, err := ed.ReadDir(filepath.Join("repository", "targets"))
if err != nil {
return err
}
Expand All @@ -733,7 +732,7 @@ func (e *embeddedWrapper) Set(name string, b []byte) error {
}
// Copy targets to the writeable store so we can find all of them later.
for _, entry := range entries {
b, err := rd.ReadFile(filepath.FromSlash(filepath.Join("repository", "targets", entry.Name())))
b, err := rd.ReadFile(filepath.Join("repository", "targets", entry.Name()))
if err != nil {
return fmt.Errorf("reading embedded file: %w", err)
}
Expand Down Expand Up @@ -792,11 +791,15 @@ func (d *diskCache) Set(p string, b []byte) error {
}

func noCache() bool {
b, err := strconv.ParseBool(os.Getenv(SigstoreNoCache))
if err != nil {
return false
}
return b
// TODO: Remove!
return true
/*
b, err := strconv.ParseBool(os.Getenv(SigstoreNoCache))
if err != nil {
return false
}
return b
*/
}

func remoteFromMirror(ctx context.Context, mirror string) (client.RemoteStore, error) {
Expand Down

0 comments on commit b16f38d

Please sign in to comment.