Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 1b59a29

Browse files
authored
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.
1 parent d4cf490 commit 1b59a29

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

cmd/executor/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func addKanikoOptionsFlags() {
224224

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

cmd/warmer/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func addKanikoOptionsFlags() {
9090

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

pkg/executor/build_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ COPY --from=second /bar /bat
372372
ioutil.WriteFile(f.Name(), []byte(tt.args.dockerfile), 0755)
373373
opts := &config.KanikoOptions{
374374
DockerfilePath: f.Name(),
375-
CustomPlatform: platforms.DefaultString(),
375+
CustomPlatform: platforms.Format(platforms.Normalize(platforms.DefaultSpec())),
376376
}
377377
testStages, metaArgs, err := dockerfile.ParseStages(opts)
378378
if err != nil {

0 commit comments

Comments
 (0)