use CLI cache dir to store tuf metadata
Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
parent
98d7bef299
commit
49dfa3f6d5
2 changed files with 8 additions and 0 deletions
|
|
@ -3,7 +3,9 @@ package verification
|
|||
import (
|
||||
_ "embed"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/cli/go-gh/v2/pkg/config"
|
||||
"github.com/sigstore/sigstore-go/pkg/tuf"
|
||||
)
|
||||
|
||||
|
|
@ -23,6 +25,9 @@ func DefaultOptionsWithCacheSetting() *tuf.Options {
|
|||
opts.DisableLocalCache = true
|
||||
}
|
||||
|
||||
// Set the cache path to a directory owned by the CLI
|
||||
opts.CachePath = filepath.Join(config.CacheDir(), ".sigstore", "root")
|
||||
|
||||
return opts
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@ package verification
|
|||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/cli/go-gh/v2/pkg/config"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
|
@ -14,4 +16,5 @@ func TestGitHubTUFOptions(t *testing.T) {
|
|||
require.Equal(t, GitHubTUFMirror, opts.RepositoryBaseURL)
|
||||
require.NotNil(t, opts.Root)
|
||||
require.True(t, opts.DisableLocalCache)
|
||||
require.Equal(t, filepath.Join(config.CacheDir(), ".sigstore", "root"), opts.CachePath)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue