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:
parent
d4cf49077a
commit
1b59a296a8
|
|
@ -224,7 +224,7 @@ func addKanikoOptionsFlags() {
|
||||||
|
|
||||||
// Default the custom platform flag to our current platform, and validate it.
|
// Default the custom platform flag to our current platform, and validate it.
|
||||||
if opts.CustomPlatform == "" {
|
if opts.CustomPlatform == "" {
|
||||||
opts.CustomPlatform = platforms.DefaultString()
|
opts.CustomPlatform = platforms.Format(platforms.Normalize(platforms.DefaultSpec()))
|
||||||
}
|
}
|
||||||
if _, err := v1.ParsePlatform(opts.CustomPlatform); err != nil {
|
if _, err := v1.ParsePlatform(opts.CustomPlatform); err != nil {
|
||||||
logrus.Fatalf("Invalid platform %q: %v", opts.CustomPlatform, err)
|
logrus.Fatalf("Invalid platform %q: %v", opts.CustomPlatform, err)
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ func addKanikoOptionsFlags() {
|
||||||
|
|
||||||
// Default the custom platform flag to our current platform, and validate it.
|
// Default the custom platform flag to our current platform, and validate it.
|
||||||
if opts.CustomPlatform == "" {
|
if opts.CustomPlatform == "" {
|
||||||
opts.CustomPlatform = platforms.DefaultString()
|
opts.CustomPlatform = platforms.Format(platforms.Normalize(platforms.DefaultSpec()))
|
||||||
}
|
}
|
||||||
if _, err := v1.ParsePlatform(opts.CustomPlatform); err != nil {
|
if _, err := v1.ParsePlatform(opts.CustomPlatform); err != nil {
|
||||||
logrus.Fatalf("Invalid platform %q: %v", opts.CustomPlatform, err)
|
logrus.Fatalf("Invalid platform %q: %v", opts.CustomPlatform, err)
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ COPY --from=second /bar /bat
|
||||||
ioutil.WriteFile(f.Name(), []byte(tt.args.dockerfile), 0755)
|
ioutil.WriteFile(f.Name(), []byte(tt.args.dockerfile), 0755)
|
||||||
opts := &config.KanikoOptions{
|
opts := &config.KanikoOptions{
|
||||||
DockerfilePath: f.Name(),
|
DockerfilePath: f.Name(),
|
||||||
CustomPlatform: platforms.DefaultString(),
|
CustomPlatform: platforms.Format(platforms.Normalize(platforms.DefaultSpec())),
|
||||||
}
|
}
|
||||||
testStages, metaArgs, err := dockerfile.ParseStages(opts)
|
testStages, metaArgs, err := dockerfile.ParseStages(opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue