buildflags: fix ref only format for command line and bake

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
Jonathan A. Sternberg
2025-01-22 13:18:38 -06:00
parent b2bbb337e4
commit 11c84973ef
7 changed files with 72 additions and 53 deletions

View File

@ -37,7 +37,7 @@ func TestCacheOptions_DerivedVars(t *testing.T) {
"session_token": "not_a_mitm_attack",
},
},
}, cacheFrom)
}, cacheFrom.ToPB())
}
func TestCacheOptions(t *testing.T) {
@ -109,3 +109,12 @@ func TestCacheOptions(t *testing.T) {
require.True(t, result.True())
})
}
func TestCacheOptions_RefOnlyFormat(t *testing.T) {
opts, err := ParseCacheEntry([]string{"ref1", "ref2"})
require.NoError(t, err)
require.Equal(t, CacheOptions{
{Type: "registry", Attrs: map[string]string{"ref": "ref1"}},
{Type: "registry", Attrs: map[string]string{"ref": "ref2"}},
}, opts)
}