GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
15.03k stars 1.62k forks source link

downloading buildpack - does not match the specified platform: wanted linux/amd64, actual: linux #8945

Open dkirrane opened 1 year ago

dkirrane commented 1 year ago

Expected behavior

Actual behavior

Information

apiVersion: skaffold/v4beta6
kind: Config
build:
  tagPolicy:
    gitCommit: {}
  artifacts:
  - image: buildpack-java-demo
    buildpacks:
      builder: "paketobuildpacks/builder-jammy-base"
      buildpacks:
        - paketo-buildpacks/azul-zulu
        - paketo-buildpacks/java

Steps to reproduce the behavior

  1. A very basic springboot app
  2. skaffold build
  3. 85c088e68808f61b2486c39a7e12a0033995970c97e95408069 was found but does not match the specified platform: wanted linux/amd64, actual: linux
skaffold build -vdebug
DEBU[0000] skaffold API not starting as it's not requested  subtask=-1 task=DevLoop
INFO[0000] Skaffold &{Version:v2.6.1 ConfigVersion:skaffold/v4beta6 GitVersion: GitCommit:ae5cd52bc27103f11232bf2dd6635681d1dad2c2 BuildDate:2023-07-05T09:39:02Z GoVersion:go1.19.10 Compiler:gc Platform:linux/amd64 User:}  subtask=-1 task=DevLoop
INFO[0000] Loaded Skaffold defaults from "/home/me/.skaffold/config"  subtask=-1 task=DevLoop
DEBU[0000] parsed 1 configs from configuration file /mnt/c/dev/GitHub/buildpack-java/skaffold.yaml  subtask=-1 task=DevLoop
DEBU[0000] Defaulting build type to local build          subtask=-1 task=DevLoop
DEBU[0000] Defaulting deploy type to kubectl             subtask=-1 task=DevLoop
INFO[0000] map entry found when executing locate for &{buildpack-java-demo . 0xc000958690 {<nil> <nil> <nil> <nil> <nil> 0xc00075be60 <nil>} [] {[] []} [] } of type *latest.Artifact and pointer: 824643440080  subtask=-1 task=DevLoop
INFO[0000] Using kubectl context: ixcc-dev-cj-aks-admin  subtask=-1 task=DevLoop
INFO[0000] Using insecure-registries=[myrepo.mycompany.com] from config  subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `my-aks`  subtask=-1 task=DevLoop
DEBU[0001] Running command: [minikube version --output=json]  subtask=-1 task=DevLoop
DEBU[0001] setting Docker user agent to skaffold-v2.6.1  subtask=-1 task=DevLoop
INFO[0001] no kpt renderer or deployer found, skipping hydrated-dir creation  subtask=-1 task=DevLoop
DEBU[0001] Running command: [kubectl config view --minify -o jsonpath='{..namespace}']  subtask=-1 task=DevLoop
DEBU[0001] Command output: ['']                          subtask=-1 task=DevLoop
DEBU[0001] CLI platforms provided: ""                    subtask=-1 task=DevLoop
DEBU[0001] platform detection from active kubernetes cluster is not enabled  subtask=-1 task=DevLoop
DEBU[0001] platforms selected for artifact "buildpack-java-demo": ""  subtask=-1 task=DevLoop
DEBU[0001] Using builder: local                          subtask=-1 task=DevLoop
DEBU[0001] push value not present in NewBuilder, defaulting to true because cluster.PushImages is true  subtask=-1 task=DevLoop
INFO[0001] build concurrency first set to 1 parsed from *local.Builder[0]  subtask=-1 task=DevLoop
INFO[0001] final build concurrency value is 1            subtask=-1 task=DevLoop
Generating tags...
 - buildpack-java-demo -> DEBU[0001] Running command: [git describe --tags --always]  subtask=-1 task=Build
DEBU[0001] Command output: [b6e90f9
]                    subtask=-1 task=Build
DEBU[0001] Running command: [git status . --porcelain]   subtask=-1 task=Build
DEBU[0002] Command output: [ M skaffold.yaml
?? skaffold.1.yaml
]  subtask=-1 task=Build
INFO[0002] Using default-repo=myrepo.mycompany.com from config  subtask=-1 task=DevLoop
myrepo.mycompany.com/buildpack-java-demo:b6e90f9-dirty
INFO[0002] Tags generated in 665.4927ms                  subtask=-1 task=Build
Checking cache...
DEBU[0005] Could not import artifact from Docker, building instead (import of missing images disabled)  subtask=-1 task=Build
 - buildpack-java-demo: Not found. Building
INFO[0005] Cache check completed in 3.481 seconds        subtask=-1 task=Build
Starting build...
Building [buildpack-java-demo]...
DEBU[0006] Skipping credential configuration because docker-credential-gcloud is not on PATH.  subtask=-1 task=DevLoop
latest: Pulling from paketobuildpacks/builder-jammy-base
Digest: sha256:aecb80f56d26fbae3fa7fea4615ecc3c2bfcf3257472e95fae69adf179e7a553
Status: Image is up to date for paketobuildpacks/builder-jammy-base:latest     
DEBU[0007] Skipping credential configuration because docker-credential-gcloud is not on PATH.  subtask=-1 task=DevLoop
latest: Pulling from paketobuildpacks/run-jammy-base
Digest: sha256:be469f0808bd338280f7e6f75a37ae7804e002a54ee100f104686dc148bb43a0
Status: Image is up to date for paketobuildpacks/run-jammy-base:latest
DEBU[0011] Skipping credential configuration because docker-credential-gcloud is not on PATH.  subtask=-1 task=DevLoop
docker.io/paketobuildpacks/azul-zulu@sha256:79419af00c95f85c088e68808f61b2486c39a7e12a0033995970c97e95408069: Pulling from paketobuildpacks/azul-zulu
Digest: sha256:79419af00c95f85c088e68808f61b2486c39a7e12a0033995970c97e95408069
Status: Image is up to date for paketobuildpacks/azul-zulu@sha256:79419af00c95f85c088e68808f61b2486c39a7e12a0033995970c97e95408069
DEBU[0011] Running command: [tput colors]                subtask=-1 task=DevLoop
DEBU[0011] Command output: [256
]                        subtask=-1 task=DevLoop
downloading buildpack: extracting from registry paketo-buildpacks/azul-zulu: fetching image: image with reference docker.io/paketobuildpacks/azul-zulu@sha256:79419af00c95f85c088e68808f61b2486c39a7e12a0033995970c97e95408069 was found but does not match the specified platform: wanted linux/amd64, actual: linux
DEBU[0011] exporting metrics disabled                    subtask=-1 task=DevLoop

Note I do not face the same issue when I use Pack CLI directly

pack set-default-builder paketobuildpacks/builder-jammy-base
pack build buildpack-java-demo --buildpack paketo-buildpacks/azul-zulu --buildpack paketo-buildpacks/java
westito commented 1 year ago

Same here. Any solution? Apple M1

ipolonskij commented 10 months ago

I'm facing the same issue with an Intel i9, Docker Desktop and Skaffold 2.9.0. Did you figure out a solution in the meantime?

jbeaken commented 6 months ago

Same here, Intel AMD, skaffold 2.10.0 using newrelic buildpack

I think it's to do with https://github.com/moby/moby/pull/46495, so downgrading to docker version < 25 worked for me

joncotton commented 3 months ago

Same issue with Skaffold 2.12.0 (where Pack CLI 0.35.0 works fine). Here's a workaround that's not terrible. Push the buildpack image in question to your own container registry—basically mirror it—and modify the manifest to include architecture information. This manifest-tool (currently 2.1.7) works like a charm.

  1. push the image to your mirror registry
  2. create this manifest yaml file—updating for your container registry and, of course, whatever buildpack image needs the architecture spec.
    image: YOUR.azurecr.io/upstream/paketobuildpacks/python:latest
    tags: ["2", "2.19"]
    manifests:
    - image: YOUR.azurecr.io/upstream/paketobuildpacks/python:latest
    platform:
      architecture: amd64
      os: linux
  3. then manifest-tool push from-spec spec.yaml. Now Skaffold works.

From manifest-tool docs:

manifest-tool is a command line utility used to view or push multi-platform container image references located in an OCIv1 or Docker v2.2 compatible container registry...purpose of combining an array of architecture and platform specific container image manifests under a single reference. This allows a container runtime to select the appropriate index entry that matches the local node's architecture and platform.