Use canonical platform values. Fix 1995. (#2025)

* Use canonical image architectures. Closes #1995.

Prior to this change, Kaniko was not using the platform's canonical value.

* Update platform unit test.
This commit is contained in:
Diego Gonzalez 2022-03-31 21:15:24 +02:00 committed by GitHub
parent d4cf49077a
commit 1b59a296a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -224,7 +224,7 @@ func addKanikoOptionsFlags() {
// Default the custom platform flag to our current platform, and validate it.
if opts.CustomPlatform == "" {
opts.CustomPlatform = platforms.DefaultString()
opts.CustomPlatform = platforms.Format(platforms.Normalize(platforms.DefaultSpec()))
}
if _, err := v1.ParsePlatform(opts.CustomPlatform); err != nil {
logrus.Fatalf("Invalid platform %q: %v", opts.CustomPlatform, err)

View File

@ -90,7 +90,7 @@ func addKanikoOptionsFlags() {
// Default the custom platform flag to our current platform, and validate it.
if opts.CustomPlatform == "" {
opts.CustomPlatform = platforms.DefaultString()
opts.CustomPlatform = platforms.Format(platforms.Normalize(platforms.DefaultSpec()))
}
if _, err := v1.ParsePlatform(opts.CustomPlatform); err != nil {
logrus.Fatalf("Invalid platform %q: %v", opts.CustomPlatform, err)

View File

@ -372,7 +372,7 @@ COPY --from=second /bar /bat
ioutil.WriteFile(f.Name(), []byte(tt.args.dockerfile), 0755)
opts := &config.KanikoOptions{
DockerfilePath: f.Name(),
CustomPlatform: platforms.DefaultString(),
CustomPlatform: platforms.Format(platforms.Normalize(platforms.DefaultSpec())),
}
testStages, metaArgs, err := dockerfile.ParseStages(opts)
if err != nil {