mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #101147 from soltysh/wrong_substring
Limit image spec's hash length
This commit is contained in:
commit
e583435ecb
@ -306,7 +306,7 @@ func getRepositoryMappedConfig(index int, config Config, repo string) Config {
|
|||||||
|
|
||||||
h := sha256.New()
|
h := sha256.New()
|
||||||
h.Write([]byte(pullSpec))
|
h.Write([]byte(pullSpec))
|
||||||
hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil)[:16])
|
hash := base64.RawURLEncoding.EncodeToString(h.Sum(nil))[:16]
|
||||||
|
|
||||||
shortName := reCharSafe.ReplaceAllLiteralString(pullSpec, "-")
|
shortName := reCharSafe.ReplaceAllLiteralString(pullSpec, "-")
|
||||||
shortName = reDashes.ReplaceAllLiteralString(shortName, "-")
|
shortName = reDashes.ReplaceAllLiteralString(shortName, "-")
|
||||||
|
@ -149,7 +149,7 @@ func TestGetMappedImageConfigs(t *testing.T) {
|
|||||||
actual[source.GetE2EImage()] = mapping.GetE2EImage()
|
actual[source.GetE2EImage()] = mapping.GetE2EImage()
|
||||||
}
|
}
|
||||||
expected := map[string]string{
|
expected := map[string]string{
|
||||||
"docker.io/source/repo:1.0": "quay.io/repo/for-test:e2e-0-docker-io-source-repo-1-0-72R4aXm7YnxQ4_ekf1DrFA",
|
"docker.io/source/repo:1.0": "quay.io/repo/for-test:e2e-0-docker-io-source-repo-1-0-72R4aXm7YnxQ4_ek",
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(expected, actual) {
|
if !reflect.DeepEqual(expected, actual) {
|
||||||
t.Fatal(diff.ObjectReflectDiff(expected, actual))
|
t.Fatal(diff.ObjectReflectDiff(expected, actual))
|
||||||
|
Loading…
Reference in New Issue
Block a user