Merge pull request #101147 from soltysh/wrong_substring

Limit image spec's hash length
This commit is contained in:
Kubernetes Prow Robot 2021-04-15 10:36:07 -07:00 committed by GitHub
commit e583435ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -306,7 +306,7 @@ func getRepositoryMappedConfig(index int, config Config, repo string) Config {
h := sha256.New()
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 = reDashes.ReplaceAllLiteralString(shortName, "-")

View File

@ -149,7 +149,7 @@ func TestGetMappedImageConfigs(t *testing.T) {
actual[source.GetE2EImage()] = mapping.GetE2EImage()
}
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) {
t.Fatal(diff.ObjectReflectDiff(expected, actual))