skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

feat: implement creating `ManifestList` from single platform images

Open renzodavid9 opened this issue 2 years ago • 1 comments

Fixes: #7632 Related: #7082

Description

In this PR, Skaffold will iteratively create single platform images for builders that don't support native multi-arch builds, and then generate a ManifestList programmatically that consists of these individual platform manifests.

User facing changes Users can now provide multiple arguments to the --platform flag.

Testing instructions:

  1. In the examples/getting-started project, run:

    skaffold build --default-repo=your/container/registry --platform=linux/amd64,linux/arm64
    
  2. You should get the output:

    ...
    Building [skaffold-example]...
    Target platforms: [linux/amd64,linux/arm64]
    ...
    [+] Building 0.3s (13/13) FINISHED
    ...
    => => writing image sha256:10af3142e460566f5791c48758f0040cef6932cbcb0766082dcbb0d8db7653e7
    => => naming to gcr.io/k8s-skaffold/skaffold-example:latest_linux_amd64
    ...
    latest_linux_amd64: digest: sha256:15bd4f2380e99b3563f8add1aba9691e414d4cc5701363d9c74960a20fb276c4 size: 739
    ...
    [+] Building 52.8s (13/13) FINISHED
    ...
    => => writing image sha256:68866691e2d6f079b116e097ae4e67a53eaf89e825b52d6f31f2e9cc566974de
    => => naming to gcr.io/k8s-skaffold/skaffold-example:latest_linux_arm64
    ...
    4e0c2525c370: Pushed
    latest_linux_arm64: digest: sha256:868d0aec1cc7d2ed1fa1e840f38ff1aa50c3cc3d3232ea17a065618eaec4e82b size: 739
    Build [skaffold-example] succeeded
    
  3. Run the following docker command to validate the built image:

    docker manifest inspect your/container/registry/skaffold-example:latest | grep -A 3 "platform"
    
      "platform": {
          "architecture": "amd64",
          "os": "linux"
      }
    --
      "platform": {
          "architecture": "arm64",
          "os": "linux"
      }
    

Pending

  • [ ] Add unit tests for the CreateManifestList function.
  • [ ] Add integration test using examples/getting-started.

renzodavid9 avatar Aug 04 '22 19:08 renzodavid9

Codecov Report

Merging #7745 (28107eb) into main (290280e) will decrease coverage by 3.95%. The diff coverage is 53.59%.

@@            Coverage Diff             @@
##             main    #7745      +/-   ##
==========================================
- Coverage   70.48%   66.52%   -3.96%     
==========================================
  Files         515      589      +74     
  Lines       23150    28316    +5166     
==========================================
+ Hits        16317    18837    +2520     
- Misses       5776     8107    +2331     
- Partials     1057     1372     +315     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/credits/export.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/deploy.go 40.90% <0.00%> (-12.94%) :arrow_down:
cmd/skaffold/app/cmd/test.go 44.44% <0.00%> (ø)
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) :arrow_down:
cmd/skaffold/app/cmd/render.go 35.48% <18.18%> (-5.90%) :arrow_down:
cmd/skaffold/app/cmd/lsp.go 28.12% <28.12%> (ø)
cmd/skaffold/app/cmd/run.go 64.28% <33.33%> (-9.63%) :arrow_down:
cmd/skaffold/app/cmd/fix.go 56.41% <37.50%> (-20.07%) :arrow_down:
cmd/skaffold/app/cmd/verify.go 41.17% <41.17%> (ø)
... and 349 more

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov[bot] avatar Aug 04 '22 19:08 codecov[bot]

discussed offline; we'll complete the pending tasks in a follow up PR. Merging this for integration testing with other PRs.

gsquared94 avatar Aug 10 '22 16:08 gsquared94